about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2019-12-10 15:29:12 +0100
committersternenseemann <git@lukasepple.de>2019-12-10 15:30:50 +0100
commit63a7e84d7a9b30f0ed8a799f3a071c5fda40e8cb (patch)
treeb235c700c63e5d77909f93f91f050b0c184158c2
parente77da464cdc779a16a8a1faf8c5741d540e7bc4f (diff)
etc: improve security of systemd unit
Also match port number in spacecookie.socket and spacecookie.json.
-rw-r--r--README.md4
-rw-r--r--etc/spacecookie.json2
-rw-r--r--etc/spacecookie.service2
-rw-r--r--etc/spacecookie.socket1
4 files changed, 6 insertions, 3 deletions
diff --git a/README.md b/README.md
index 7cb95ad..b195a0c 100644
--- a/README.md
+++ b/README.md
@@ -54,8 +54,8 @@ to install `spacecookie.service` and `spacecookie.socket` like so:
 	systemctl start  spacecookie.socket
 	systemctl start  spacecookie.service # optional, started by the socket automatically if needed
 
-Don't forget to change the paths in the systemd files and match the user name in
-`spacecookie.socket` with the one in `spacecookie.json`!
+You'll have to ensure that the paths are correct and the user and group specified
+in `spacecookie.socket` and `spacecookie.service` exist.
 
 ### Without systemd
 
diff --git a/etc/spacecookie.json b/etc/spacecookie.json
index 72aa46a..3333b10 100644
--- a/etc/spacecookie.json
+++ b/etc/spacecookie.json
@@ -1,6 +1,6 @@
 {
   "hostname" : "localhost",
-  "port" : 7070,
+  "port" : 70,
   "user" : null,
   "root" : "/srv/gopher"
 }
diff --git a/etc/spacecookie.service b/etc/spacecookie.service
index d69be8b..4dc746e 100644
--- a/etc/spacecookie.service
+++ b/etc/spacecookie.service
@@ -8,6 +8,8 @@ ExecStart=/path/to/spacecookie /path/to/spacecookie.json
 FileDescriptorStoreMax=1
 NotifyAccess=main
 StandardError=journal
+User=spacecookie
+Group=spacecookie
 
 [Install]
 WantedBy=multi-user.target
diff --git a/etc/spacecookie.socket b/etc/spacecookie.socket
index 6bd5793..588a86a 100644
--- a/etc/spacecookie.socket
+++ b/etc/spacecookie.socket
@@ -5,5 +5,6 @@ Description=Socket for the Spacecookie Gopher Daemon
 BindIPv6Only=both
 SocketGroup=spacecookie
 SocketUser=spacecookie
+SocketMode=0660
 
 ListenStream=[::]:70