File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -48,4 +48,5 @@ borg_user: "root"
48
48
borg_group : " root"
49
49
backup_user_info :
50
50
home : " /home/{{ borg_user }}"
51
+ borgmatic_run_as_root : false
51
52
...
Original file line number Diff line number Diff line change @@ -192,3 +192,7 @@ argument_specs:
192
192
type : str
193
193
required : false
194
194
description : Name of the SSH public and private key
195
+ borgmatic_run_as_root :
196
+ type : bool
197
+ required : false
198
+ description : If the variable is set, systemd will run borgmatic using sudo.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ ConditionACPower=true
12
12
[Service]
13
13
Type=oneshot
14
14
User={{ borg_user }}
15
- ExecStart={{ 'sudo ' if borg_user != 'root' }}borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}
15
+ ExecStart={{ 'sudo ' if borgmatic_run_as_root }}borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}
16
16
17
17
# Source: https://projects.torsion.org/borgmatic-collective/borgmatic/raw/branch/master/sample/systemd/borgmatic.service
18
18
# Security settings for systemd running as root, optional but recommended to improve security. You
@@ -22,7 +22,7 @@ LockPersonality=true
22
22
# Certain borgmatic features like Healthchecks integration need MemoryDenyWriteExecute to be off.
23
23
# But you can try setting it to "yes" for improved security if you don't use those features.
24
24
MemoryDenyWriteExecute=no
25
- NoNewPrivileges={{ 'no' if borg_user != 'root' else 'yes'}}
25
+ NoNewPrivileges={{ 'no' if borgmatic_run_as_root else 'yes'}}
26
26
PrivateDevices=yes
27
27
PrivateTmp=yes
28
28
ProtectClock=yes
You can’t perform that action at this time.
0 commit comments