Skip to content

Steam user not correctly set, multiple administrators not possible #969

@Tahvohck

Description

@Tahvohck

Context:

  • Full User steam controls access to steamcmd. As much as possible, it is isolated from the rest of the system. This is mostly set up this way because that's how steamcmd suggests it. It does mean that while the command isn't globally installed, it's still "centrally" installed.
  • System User serv-ark controls the ark system and nothing else. As much as possible, it is isolated from the rest of the system. For security reasons, it is not even able to update the server itself.
  • Server admins are part of the serverctl group. They have access to steam's user folder and /srv/ark-server/. They are the users that have permission to change the server core files.
  • I'm running the server out of /srv/ark-server, this is where all ark files are installed. It is owned by serv-ark:serverctl. It has the setgid flag (-s-) so that files created in it stay owned by serverctl.

When managing things manually, this worked pretty well. Server admins updated the game, then started a systemd unit file that started the server, switching to serv-ark:serverctl and setting the working directory in the process. The only permission they needed was to start the unit file (a specific line in sudoers). The server is never run as a user with more permissions than it needs, and it can't interact with any other steam servers I run.

With ark-server-tools, I'm having problems getting this setup to work. If I run the command as serv-ark this happens:

$ sudo -u serv-ark `which arkmanager` status
/usr/local/bin/arkmanager: line 217: cd: /home/serv-ark: No such file or directory
[  ERROR  ]     Your SteamCMD exec could not be found.
Running command 'status' for instance 'main'
[  ERROR  ]     Your SteamCMD exec could not be found.
 Server running:   No
 Server listening:   No
 Server build ID:   2964722
 Server version:   281.110

Start runs basically the same, but status gives a good example. There are a couple of issues I'm hitting here.

  1. As a system user, serv-ark has no home directory. I didn't previously need one, so I'm not sure why ark-server-tools needs it.
  2. I assume steamcmd is used so that updates can be checked for on startup, but it can't do this because serv-ark doesn't have permission to do that. Also, I have autoupdate on start turned off. It also does this on shutdown, which I can see no reason for. With that said, shouldn't it be running as steamcmd_user anyway, based on the config files?
  3. If I ran arkmanager as any other user first, the log files can't be updated. It should probably make the files with the same permissions as the log directory.
  4. I have to jump hoops just to get serv-ark to run the program because /usr/local/bin isn't in a system user's PATH. That's... minor, but annoying.

If I run the server as a member of serverctl, because they have permission to run steamcmd everything seems to work fine. This is basically the same as current "intended" usage. The only problem is that the server is then run as them. If another administrator were to log in, they wouldn't be able to meaningfully interact with the server. They can't stop it, status returns incorrect information, they can't even start their own server because the port is bound already.


Thankfully, writing this up allowed me to rubber-duck the situation, so any of the other problems are eliminated. It's also gotten pretty long, so I apologize if it's rambling. With that said, I propose the following changes to operation:

  1. The steamcmd_user is completely removed from the configuration. It's assumed that if you can run arkmanager, you have the right permissions to run steamcmd.sh.
  2. Replace it with a server daemon user. In global installation mode, this is defaulted to steam, but still configurable. In single-user installations it's defaulted to the installing user (--me syntax should still work here)
  3. If the script is running a 'management' command, it continues as normal. Managing users are assumed to have write permission to the install directory. Maybe they're assumed to have write permission to the log files too, to prevent exposing the logging API via the script and minimize the number of child processes.
  4. If the script is running a 'server' command, the first thing it does after parsing arguments and loading settings is to immediately fork to the server daemon user and exit. The child arkmanager is no longer assumed to have write access to the core server files, and it does not attempt to change away from the installation directory. It is assumed to have write permission to the log directory. The only sudo permission administrators need is permission to run sudo arkmanager

Under this flow, a user running the server as themselves would notice no change. sudo to yourself is allowed without any configuration, and the script continues as normal. Users running the server in a restricted sandbox would still be able to configure the server, download updates, and set up cron jobs, but would run the server itself as the sandboxed user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions