Skip to content

Security Context runAsUser doesn't match atlantis user in Debian image #306

Open
@gtirloni

Description

@gtirloni

While deploying Atlantis, I noticed it failed to start whenever I enabled --write-git-creds:

Error: initializing server: writing generated .git-credentials file with user, token and hostname to /nonexistent/.git-credentials: open /nonexistent/.git-credentials: no such file or directory

Upon removing that option, I noticed that Atlantis was running as the _apt user in the Debian image:

_apt@atlantis-0:/$ ps auxw
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
_apt         1  0.0  0.0   2228   504 ?        Ss   14:28   0:00 /usr/bin/dumb-init /bin/sh /usr/local/bin/docker-entrypoint.sh server
_apt         7  0.1  0.3 737820 24748 ?        Ssl  14:28   0:00 atlantis server
_apt        31  0.0  0.0   4156  3464 pts/0    Ss   14:28   0:00 /bin/bash
_apt        37  0.0  0.0   6752  3024 pts/0    R+   14:28   0:00 ps auxw

The chart has runAsUser: 100, which works with the Alpine image because the atlantis user there has uid=100:

044f7697a0f2:/# cat /etc/alpine-release 
3.18.0

044f7697a0f2:/# grep atlantis /etc/passwd
atlantis:x:100:1000:Linux User,,,:/home/atlantis:/sbin/nologin

But not in the Debian image:

93716bd16c43:/# cat /etc/debian_version 
11.7

93716bd16c43:/# grep atlantis /etc/passwd
atlantis:x:1000:1000::/home/atlantis:/bin/bash

The workaround is to set this in values.yaml:

  statefulSet:
    securityContext:
      runAsUser: 1000

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions