-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathneo-bot.service
More file actions
63 lines (55 loc) 路 1.65 KB
/
Copy pathneo-bot.service
File metadata and controls
63 lines (55 loc) 路 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[Unit]
Description=NeoMutt IRC Bot
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=60
StartLimitBurst=5
[Service]
Type=simple
Environment="PYTHONUNBUFFERED=TRUE"
WorkingDirectory=/home/neo-bot/neo-bot
# NOTE: We deliberately do NOT auto-update via VCS on every restart.
# A tampered or force-pushed remote would otherwise execute new code as
# the bot user on every restart. Update the bot manually:
# cd /home/neo-bot/neo-bot
# git fetch --tags
# git checkout <tag>
# systemctl restart neo-bot
# Inject the GitHub token via systemd credentials. The file is mounted
# read-only at $CREDENTIALS_DIRECTORY/github_token (mode 0400, owned by
# the service user) and is not visible to other processes.
LoadCredential=github_token:/home/neo-bot/GITHUB_TOKEN
ExecStart=/home/neo-bot/neo-bot/neo-bot.py \
--tls \
irc.libera.chat neomutt neo-bot
User=neo-bot
Group=neo-bot
RestartSec=10
Restart=on-failure
# --- Hardening -----------------------------------------------------------
NoNewPrivileges=true
ProtectSystem=strict
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
ProtectClock=true
ProtectHostname=true
ProtectProc=invisible
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
LockPersonality=true
MemoryDenyWriteExecute=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources @mount @debug @cpu-emulation @obsolete
CapabilityBoundingSet=
AmbientCapabilities=
RestrictAddressFamilies=AF_INET AF_INET6
UMask=0077
ReadWritePaths=
[Install]
WantedBy=default.target