Skip to content

Commit 371a7b7

Browse files
committed
Replace common sysctl conf script with /etc/sysctl.d/ overlay (/etc/sysctl.conf does not exist in trixie)
1 parent 89ea955 commit 371a7b7

2 files changed

Lines changed: 13 additions & 18 deletions

File tree

conf/turnkey.d/sysctl renamed to overlays/turnkey.d/sysctl-hardening/etc/sysctl.d/00-quiet-console.conf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
# Config provided by TurnKey
22

33
# KERN_EMERG 0 system is unusable
44
# KERN_ALERT 1 action must be taken immediately
@@ -11,10 +11,5 @@
1111

1212
# suppress low-level messages on the console
1313
# console default_message minimum_console default_console
14-
sed -i "s|#kernel.printk\(.*\)|kernel.printk = 1 4 1 7|" /etc/sysctl.conf
1514

16-
cat >> /etc/sysctl.conf << EOF
17-
# Disable TCP timestamps
18-
net.ipv4.tcp_timestamps = 0
19-
#
20-
EOF
15+
kernel.printk = 1 4 1 7

overlays/turnkey.d/sysctl-hardening/etc/sysctl.d/10-hardening-turnkey.conf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1+
# System Hardening config provided by TurnKey
12
#
2-
# /etc/sysctl.d/10-hardening.conf - Configuration file
3-
# for hardening system variables as recommended by Lynis.
3+
# hardened system variables as recommended by Lynis
4+
# - https://cisofy.com/lynis/
45
#
5-
# Settings can be overridden in /etc/sysctl.conf.
6-
# See /etc/sysctl.d/ for additional system variables.
7-
# See sysctl.conf (5) for information.
6+
# For more info see:
7+
# - sysctl.conf (5) (i.e. 'man sysctl.conf')
8+
# - https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
89
#
9-
##############################################################3
10+
##############################################################
1011
# Harden kernel recommendations by Lynis
1112
fs.suid_dumpable = 0
1213
kernel.core_uses_pid = 1
1314
kernel.dmesg_restrict = 1
1415
kernel.kptr_restrict = 2
1516
kernel.sysrq = 0
1617

17-
18-
##############################################################3
18+
##############################################################
1919
# Functions previously found in netbase
2020
#
2121

@@ -67,6 +67,6 @@ net.ipv6.conf.all.accept_source_route = 0
6767
net.ipv4.conf.all.log_martians = 1
6868
net.ipv4.conf.default.log_martians = 1
6969
#
70-
# Disable TCP timestamps
71-
net.ipv4.tcp_timestamps = 0
72-
#
70+
# Explcitly enable tcp_timestamps (should be default)
71+
# - kernel now adds a random offset for each connection so safe to enable
72+
net.ipv4.tcp_timestamps = 1

0 commit comments

Comments
 (0)