crazy-max / csgo-server-launcher

Counter-Strike Global Offensive Dedicated Server Launcher
GNU Lesser General Public License v3.0
588 stars 119 forks source link

Processes and Folders always belong to the default user #92

Open TAINCER opened 3 years ago

TAINCER commented 3 years ago

Behaviour

Docker should use the specified user with the group in the .env file, but it's always 1000 (default)

Steps to reproduce this issue

  1. use the docker-compose.yml and .env file from the example in the Repository.
  2. Change the PID and GID Values to another user on the Host system.
  3. Change the version to 2.4 and change the Ports accordingly.
  4. The folders and processes are owned by the wrong user (PUIDand PGID1000)

Configuration

docker-compose.yml:

version: "2.4"

services:
  csgo:
    image: crazymax/csgo-server-launcher:latest
    container_name: csgo0
    cpuset: "0"
    ports:
      - "${PORT}:${PORT}/tcp"
      - "${PORT}:${PORT}/udp"
      - "${TV_PORT}:${TV_PORT}/tcp"
      - "${TV_PORT}:${TV_PORT}/udp"
    env_file:
      - "./.env"
    volumes:
      - "/home/${GAME_USERNAME}/csgo:/var/steamcmd/games/csgo"
      - "./steam:/home/steam/Steam"
    tty: true
    ulimits:
      nproc: 65535
      nofile:
        soft: 32000
        hard: 40000
    restart: always

.env:

TZ=Europe/Berlin
PUID=1001
PGID=1001
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_TLS=on
SMTP_STARTTLS=on
SMTP_TLS_CHECKCERT=on
SMTP_AUTH=on
SMTP_USER=foo
SMTP_PASSWORD_FILE=bar
SMTP_FROM=foo@gmail.com
SMTP_DOMAIN=localhost

GAME_USERNAME=cs1

PORT=27015
TV_PORT=27020
GSLT=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STEAM_LOGIN=anonymous
STEAM_PASSWORD=anonymous
UPDATE_EMAIL=
UPDATE_RETRY=3
CLEAR_DOWNLOAD_CACHE=0
API_AUTHORIZATION_KEY=
WORKSHOP_COLLECTION_ID=125499818
WORKSHOP_START_MAP=125488374
MAXPLAYERS=12
TICKRATE=128
EXTRAPARAMS=+sv_pure 1 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +tv_port 27020

cs1 user:

uid=1001(cs1) gid=1001(cs1) groups=1001(cs1),1002(ftpuser)

Logs

Setting timezone to Europe/Berlin...
Checking if steam UID / GID has changed...
usermod: user steam is currently used by process 1
groupmod: Permission denied.
groupmod: cannot lock /etc/group; try again later.
NOTICE: UPDATE_EMAIL is not set
Setting msmtp configuration...
/entrypoint.sh: line 20: bar: No such file or directory
Fixing permissions...
Starting csgo...
NOTICE: /var/steamcmd/games/csgo/srcds_run does not exist or is not executable.
steamcmd already exists...
Updating csgo...
/var/steamcmd/games/csgo/csgo/logs does not exist, creating...
Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt".

After that comes the SteamCMD download, login, and CS:GO Download, there is nothing special there.

Screenshots:

The created csgo server folder: image

The running processes: (while steamcmd was downloading, the same user when the server is running) image

netr0m commented 3 years ago

@crazy-max From a quick glance, this seems to relate to the following line(s): in the Dockerfile?

RUN groupadd -f -g 1000 steam \
  && useradd -o --shell /bin/bash -u 1000 -g 1000 -m steam \