-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Hardened service config for greetd - Exposure level after hardening: 2.5 Signed-off-by: Ganga Ram <[email protected]>
- Loading branch information
Showing
1 changed file
with
127 additions
and
0 deletions.
There are no files selected for viewing
127 changes: 127 additions & 0 deletions
127
modules/common/systemd/hardened-configs/common/greetd.nix
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,127 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
{ | ||
############## | ||
# Networking # | ||
############## | ||
PrivateNetwork = true; | ||
IPAccounting = true; | ||
IPAddressDeny = "any"; | ||
RestrictAddressFamilies = [ | ||
"AF_UNIX" | ||
"AF_NETLINK" | ||
]; | ||
|
||
############### | ||
# File system # | ||
############### | ||
|
||
# ProtectHome=true; | ||
ProtectSystem = "full"; | ||
ProtectProc = "noaccess"; | ||
ReadWritePaths = [ | ||
"/run" | ||
"/var/" | ||
]; | ||
#PrivateTmp = true; | ||
|
||
PrivateMounts = true; | ||
ProcSubset = "all"; | ||
|
||
################### | ||
# User separation # | ||
################### | ||
|
||
# Not applicable for the service runs as root | ||
# PrivateUsers = true; | ||
# DynamicUser=true; | ||
|
||
########### | ||
# Devices # | ||
########### | ||
|
||
# PrivateDevices=true; | ||
# DeviceAllow=["/dev/dri/*" "/dev/tty*" "/dev/input/*" "/dev/snd/*" "/dev/urandom"]; | ||
|
||
########## | ||
# Kernel # | ||
########## | ||
|
||
ProtectKernelTunables = true; | ||
ProtectKernelModules = true; | ||
ProtectKernelLogs = true; | ||
|
||
######## | ||
# Misc # | ||
######## | ||
|
||
# KeyringMode="private"; | ||
NoNewPrivileges = true; | ||
UMask = 77; | ||
ProtectHostname = true; | ||
ProtectClock = true; | ||
ProtectControlGroups = true; | ||
RestrictNamespaces = true; | ||
|
||
/* | ||
RestrictNamespaces=[ | ||
#"~user" | ||
#"~pid" | ||
#"~net" | ||
#"~uts" | ||
#"~mnt" | ||
#"~cgroup" | ||
#"~ipc" | ||
]; | ||
*/ | ||
|
||
LockPersonality = true; | ||
MemoryDenyWriteExecute = true; | ||
RestrictRealtime = true; | ||
RestrictSUIDSGID = true; | ||
#RemoveIPC=true; | ||
SystemCallArchitectures = "native"; | ||
NotifyAccess = false; | ||
|
||
################ | ||
# Capabilities # | ||
################ | ||
|
||
#AmbientCapabilities= | ||
CapabilityBoundingSet = [ | ||
#"CAP_DAC_*" | ||
"CAP_IPC_LOCK" | ||
"CAP_SYS_TTY_CONFIG" | ||
"CAP_SETGID" | ||
"CAP_CHOWN" | ||
"CAP_SETUID" | ||
"CAP_IPC_OWNER" | ||
|
||
]; | ||
|
||
################ | ||
# System calls # | ||
################ | ||
|
||
SystemCallFilter = [ | ||
"@setuid" | ||
"@chown" | ||
"@system-service" | ||
"@file-system" | ||
"@basic-io" | ||
"@ipc" | ||
"@signal" | ||
"~@clock" | ||
"~@cpu-emulation" | ||
"~@debug" | ||
"~@module" | ||
"~@mount" | ||
"~@obsolete" | ||
#"~@privileged" | ||
"~@raw-io" | ||
"~@reboot" | ||
"~@swap" | ||
]; | ||
|
||
} |