Merge pull request 'Add boot unit applying a local config' (#34) from benvin/boot-unit into main
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
Reviewed-on: #34
This commit was merged in pull request #34.
This commit is contained in:
@@ -47,6 +47,17 @@ contents:
|
||||
file_info:
|
||||
mode: 0640
|
||||
|
||||
# systemd unit + environment file for applying a local config at boot.
|
||||
- src: packaging/tomswall.service
|
||||
dst: /usr/lib/systemd/system/tomswall.service
|
||||
file_info:
|
||||
mode: 0644
|
||||
- src: packaging/tomswall.env
|
||||
dst: /etc/tomswall/tomswall.env
|
||||
type: config|noreplace
|
||||
file_info:
|
||||
mode: 0644
|
||||
|
||||
# Shell completions (generated by scripts/build-rpm.sh before packaging).
|
||||
- src: dist/completions/tomswall.bash
|
||||
dst: /usr/share/bash-completion/completions/tomswall
|
||||
|
||||
@@ -3,6 +3,7 @@ Description=tomswall control-plane agent (pull and apply firewall config)
|
||||
Documentation=https://git.unkin.net/unkin/tomswall
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Conflicts=tomswall.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Config applied by tomswall.service: a tomswall YAML file or a shorewall directory.
|
||||
TOMSWALL_CONFIG=/etc/tomswall/tomswall.yaml
|
||||
#TOMSWALL_CONFIG=/etc/shorewall
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=tomswall firewall (apply local config at boot)
|
||||
Documentation=https://git.unkin.net/unkin/tomswall
|
||||
DefaultDependencies=no
|
||||
Wants=network-pre.target
|
||||
Before=network-pre.target shutdown.target
|
||||
After=local-fs.target systemd-sysctl.service
|
||||
Conflicts=shutdown.target tomswall-agent.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=5
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
Environment=TOMSWALL_CONFIG=/etc/tomswall/tomswall.yaml
|
||||
EnvironmentFile=-/etc/tomswall/tomswall.env
|
||||
ExecStart=/usr/sbin/tomswall apply -c ${TOMSWALL_CONFIG}
|
||||
ExecReload=/usr/sbin/tomswall apply -c ${TOMSWALL_CONFIG}
|
||||
# Fails open: after StartLimitBurst failures within StartLimitIntervalSec, boot continues without the ruleset.
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
# No ExecStop: stopping the unit leaves the ruleset in place (flush would open the firewall).
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
||||
Reference in New Issue
Block a user