Edie

joined 5 months ago
[–] Edie@hexbear.net 3 points 3 weeks ago (1 children)

If you add the ReadWritePaths I told you to

[–] Edie@hexbear.net 2 points 3 weeks ago (3 children)

ProtectSystem is full, not strict. Otherwise seems fine

[–] Edie@hexbear.net 2 points 3 weeks ago

All these systemd options are documented in the man page, see https://man7.org/linux/man-pages/man5/systemd.exec.5.html

[–] Edie@hexbear.net 2 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

As the name implies, roughly a pager is a piece of software that helps the user get the output one page at a time, by getting the size of rows of the terminal and displaying that many lines.

The most popular pagers in a UNIX text environment are more and less. The latter is kind of a joke as less can actually do more then more.

https://unix.stackexchange.com/questions/144016/what-is-a-pager

[–] Edie@hexbear.net 3 points 3 weeks ago

Yea, make sure to journalctl -eu prunner every time you restart it to check the logs

[–] Edie@hexbear.net 3 points 3 weeks ago (3 children)

I tried setting it up myself, I was correct that MemoryDenyWriteExecute would be a problem.

[–] Edie@hexbear.net 4 points 3 weeks ago

I've made some changes between when I posted it and now (actually I just made a change, ProtectHostname) so make sure you get everything.

[–] Edie@hexbear.net 3 points 3 weeks ago (3 children)

Btw, once these options are added, you can run systemd-analyze security prunner to check which options haven't been enabled (it doesn't know if it should be enabled though. Add --no-pager if you want to copy it)

[–] Edie@hexbear.net 5 points 3 weeks ago* (last edited 3 weeks ago) (11 children)

This is a list of things that could help harden, some of these I am not as sure about

PrivateTmp=true # Does prunner use tmp? Does ffmpeg use tmp?
PrivateMounts=true # prunner/ffmpeg shouldn't need to mount stuff anyways... right?
ProtectClock=true # prunner and ffmpeg do not need to set hardware clock
ProtectKernelTunables=true # "Few services need to write to these at runtime"
ProtectKernelModules=true # I don't see prunner/ffmpeg needing to mod_probe
ProtectKernelLogs=true # prunner/ffmpeg do not need to write to dmesg
ProtectControlGroups=true # Not a container manager
ProtectProc=invisible # Keep an eye out
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 # Other socket types are rare
LockPersonality=true # prunner/ffmpeg shouldn't need to change personality?
#MemoryDenyWriteExecute=true # Wait, prunner is a JS app isn't it? Hoping no JIT is needed **EDIT**: Yes, this is a problem
RestrictSUIDSGID=true # No privilege elevation
RestrictNamespaces=true # ffmpeg does not need namespaces
SystemCallArchitectures=native # hardens other options

ProtectHostname=true # Actually, seems like it might not be a problem. Hostname is "copied from callers namespace"

# Not setting:
# PrivateUsers=true # Meh. Problem I had with it in bind should not be the case here. If you feel like it, try it out.

# SystemCallFilter # Can't be bothered to go through the list

# ProcSubset=pid # Kernel APIs, not sure if ffmpeg needs them
# PrivateDevices=true # afraid ffmpeg needs it
# RestrictRealtime=true # prunner sets the niceness of ffmpeg
[–] Edie@hexbear.net 4 points 3 weeks ago (17 children)

With ProtectSystem=strict you also need ReadWritePaths=/srv/prunner, WorkingDirectory is not excluded from being read-only.

I could recommend a lot of stuff.

[–] Edie@hexbear.net 7 points 3 weeks ago* (last edited 3 weeks ago) (19 children)

ProtectSystem=full

Why can't this be "strict"? What directories does prunner need to write to?

If it's just WorkingDirectory, a ReadWritePaths=/srv/prunner is all that is needed.

Edit: If anyone want's to actually run this, I can help you harden the systemd service.

[–] Edie@hexbear.net 4 points 2 months ago

I guess if I went with them anyways, I should make sure to keep backups. Luckily since I plan on using nixos, setting up a new instance would be rather easy.

view more: next ›