> For the complete documentation index, see [llms.txt](https://docs.soniclabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.soniclabs.com/sonic/node-deployment/node-hardening/appendix-b-hardening-file.md).

# Appendix B: Hardening File

The complete Tier 2 drop-in file, for configuration management.

The same file as in [Tier 2](https://docs.soniclabs.com/sonic/node-deployment/node-hardening/tier-2-lock-the-node-in-a-box.md) without explanations, for copying into configuration management. Edit the marked lines.

```ini
# /etc/systemd/system/sonic.service.d/10-hardening.conf
[Service]
NoExecPaths=/
# EDIT: output of step 2.0
ExecPaths=/usr/local/bin/sonicd
MemoryDenyWriteExecute=yes
SystemCallFilter=~memfd_create
SystemCallErrorNumber=EPERM
Environment=GODEBUG=netdns=go
NoNewPrivileges=yes
RestrictSUIDSGID=yes
# EDIT: CapabilityBoundingSet=CAP_NET_BIND_SERVICE only if listening on a port below 1024
CapabilityBoundingSet=
ProtectSystem=strict
# EDIT: data folder
ReadWritePaths=/var/lib/sonic
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectProc=invisible
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
ProtectClock=yes
ProtectHostname=yes
RestrictNamespaces=yes
LockPersonality=yes
RestrictRealtime=yes
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
IPAddressDeny=10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 100.64.0.0/10 169.254.0.0/16 fc00::/7 fe80::/10
IPAddressAllow=localhost
# EDIT: required internal machines (or load balancer subnets) only, one per line
#IPAddressAllow=10.0.1.20
SocketBindDeny=any
# EDIT: your ports (validators: only 5050, plus 6060 if used)
SocketBindAllow=tcp:5050
SocketBindAllow=udp:5050
SocketBindAllow=tcp:18545
SocketBindAllow=tcp:18546
SocketBindAllow=tcp:6060
```

{% hint style="info" %}
systemd only accepts comments on their own line, starting with `#`. Never put a comment at the end of a setting line.
{% endhint %}
