Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(crypto): CRP-2376 CRP-2377: Run fstrim_tool with randomized dela…
…y on the guest OS crypto partition
- Loading branch information
1 parent
5da5953
commit 7a3c9dc
Showing
5 changed files
with
141 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
ic-os/guestos/rootfs/etc/systemd/system/fstrim_tool.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[Unit] | ||
Description=Discard unused blocks on /var/lib/ic/crypto filesystem | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/opt/ic/bin/fstrim_tool --target /var/lib/ic/crypto --metrics /run/node_exporter/collector_textfile/fstrim.prom | ||
DeviceAllow=/dev/vda | ||
IPAddressDeny=any | ||
LockPersonality=yes | ||
MemoryDenyWriteExecute=yes | ||
NoNewPrivileges=yes | ||
PrivateDevices=no | ||
PrivateNetwork=yes | ||
PrivateTmp=yes | ||
PrivateUsers=no | ||
ProtectClock=yes | ||
ProtectControlGroups=yes | ||
ProtectHome=yes | ||
ProtectHostname=yes | ||
ProtectKernelModules=yes | ||
ProtectKernelTunables=yes | ||
ProtectSystem=strict | ||
ReadOnlyPaths=/var/lib/ic/crypto | ||
ReadWritePaths=/run/node_exporter/collector_textfile | ||
RestrictAddressFamilies=AF_UNIX | ||
RestrictAddressFamilies=~AF_UNIX | ||
RestrictNamespaces=yes | ||
RestrictRealtime=yes | ||
RestrictSUIDSGID=yes | ||
SystemCallArchitectures=native | ||
SystemCallErrorNumber=EPERM | ||
SystemCallFilter=@system-service | ||
UMask=022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Discard unused blocks once a week | ||
|
||
[Timer] | ||
OnCalendar=weekly | ||
AccuracySec=1h | ||
Persistent=true | ||
RandomizedDelaySec=12h | ||
|
||
[Install] | ||
WantedBy=timers.target |
36 changes: 36 additions & 0 deletions
36
ic-os/guestos/rootfs/etc/systemd/system/setup-fstrim-metrics.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[Unit] | ||
Description=Initialize fstrim metrics | ||
Before=node_exporter.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/opt/ic/bin/fstrim_tool --target /var/lib/ic/crypto --metrics /run/node_exporter/collector_textfile/fstrim.prom --initialize_metrics_only | ||
DeviceAllow=/dev/vda | ||
IPAddressDeny=any | ||
LockPersonality=yes | ||
MemoryDenyWriteExecute=yes | ||
NoNewPrivileges=yes | ||
PrivateDevices=no | ||
PrivateNetwork=yes | ||
PrivateTmp=yes | ||
PrivateUsers=no | ||
ProtectClock=yes | ||
ProtectControlGroups=yes | ||
ProtectHome=yes | ||
ProtectHostname=yes | ||
ProtectKernelModules=yes | ||
ProtectKernelTunables=yes | ||
ProtectSystem=strict | ||
ReadWritePaths=/run/node_exporter/collector_textfile | ||
RestrictAddressFamilies=AF_UNIX | ||
RestrictAddressFamilies=~AF_UNIX | ||
RestrictNamespaces=yes | ||
RestrictRealtime=yes | ||
RestrictSUIDSGID=yes | ||
SystemCallArchitectures=native | ||
SystemCallErrorNumber=EPERM | ||
SystemCallFilter=@system-service | ||
UMask=022 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters