Skip to content

Instantly share code, notes, and snippets.

@Zoddo
Forked from funzoneq/simplehttp.service
Last active June 27, 2020 18:10
Show Gist options
  • Save Zoddo/11aa3d9ef98f25fd4f2d4e90e774c0a9 to your computer and use it in GitHub Desktop.
Save Zoddo/11aa3d9ef98f25fd4f2d4e90e774c0a9 to your computer and use it in GitHub Desktop.
A systemd file for a python SimpleHTTPServer with some hardening
# Based of https://gist.github.com/funzoneq/737cd5316e525c388d51877fb7f542de
[Unit]
Description=Job that runs the python SimpleHTTPServer daemon
Documentation=man:SimpleHTTPServer(1)
After=network.target
[Service]
Type=simple
AmbientCapabilities=CAP_NET_BIND_SERVICE
WorkingDirectory=/home/deluge/Downloads/
ExecStart=/usr/bin/python -m SimpleHTTPServer 80
# Hardening
DynamicUser=true
ProtectSystem=strict
ProtectHome=tmpfs
BindReadOnlyPaths=/home/deluge/Downloads/
PrivateDevices=true
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
[Install]
Alias=http.service
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment