CIS OpenBSD 7 Benchmark

Security configuration recommendations for OpenBSD 7

v1.0.0 01-2025

Overview

▶

This benchmark provides prescriptive guidance for establishing a secure configuration posture for OpenBSD 7. It covers system access controls, service hardening, PF firewall configuration, filesystem permissions, kernel security features, patch management, and system logging. OpenBSD's security-first design provides strong defaults; this benchmark verifies and enhances those settings.

16Recommendations
7Sections
2Profile Levels
SectionAreaFocus
1System Access ControlsSSH hardening, doas configuration, and password policies
2Service HardeningDisabled unnecessary services, httpd TLS, and OpenSMTPD security
3Network & FirewallPF default-deny rules and network sysctl hardening
4Filesystem SecurityMount options with nosuid/nodev/noexec and SUID audit
5Kernel SecuritySecurelevel enforcement and W^X memory protection
6Patch & Package Managementsyspatch automation and HTTPS package verification
7Logging & AuditingSyslog configuration and process accounting

Profile Definitions

▶
ProfileDescriptionIntended Use
L1Level 1 — StandardEssential security for all OpenBSD 7 deployments; minimal performance impact.
L2Level 2 — HardenedAdvanced hardening for PCI-DSS, HIPAA, or high-security environments.

1 — System Access Controls

▶

1.1 Authentication & Authorization

▶
1.1.1 Ensure SSH is configured with key-based authentication only (Automated)
L1 Auto
Description

This recommendation verifies that SSH is configured with key-based authentication only on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check sshd configuration:
grep -E '^(PermitRootLogin|PasswordAuthentication|PubkeyAuthentication|Protocol)' /etc/ssh/sshd_config
Remediation
# Harden sshd_config:
cat >> /etc/ssh/sshd_config <<'EOF'
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
MaxAuthTries 3
LoginGraceTime 30
EOF
rcctl restart sshd
1.1.2 Ensure doas is configured with least privilege (Automated)
L1 Auto
Description

This recommendation verifies that doas is configured with least privilege on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check doas configuration:
cat /etc/doas.conf

# Verify no permit nopass for root:
grep -i 'permit nopass' /etc/doas.conf
Remediation
# Configure doas with least privilege:
cat > /etc/doas.conf <<'EOF'
permit persist :wheel
permit nopass _pbuild
deny root
EOF
chmod 600 /etc/doas.conf
1.1.3 Ensure login.conf enforces strong password policies (Manual)
L1 Manual
Description

This recommendation verifies that login.conf enforces strong password policies on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check login.conf security settings:
grep -E '(minlen|localcipher|passwordcheck)' /etc/login.conf
Remediation
# Harden login.conf password policies:
vi /etc/login.conf
# Under default:\
#   :minlen=12:\
#   :localcipher=blowfish,a:\
#   :passwordcheck=/usr/libexec/auth/login_passwd:

# Rebuild login.conf.db:
cap_mkdb /etc/login.conf

2 — Service Hardening

▶

2.1 Service Configuration

▶
2.1.1 Ensure unnecessary services are disabled (Automated)
L1 Auto
Description

This recommendation verifies that unnecessary services are disabled on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# List enabled services:
rcctl ls on

# Check inetd:
rcctl get inetd flags
Remediation
# Disable unnecessary services:
rcctl disable inetd
rcctl disable snmpd
rcctl disable ntpd  # if using openntpd
rcctl stop inetd
rcctl stop snmpd
2.1.2 Ensure httpd is configured with TLS 1.3 (Automated)
L1 Auto
Description

This recommendation verifies that httpd is configured with TLS 1.3 on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check httpd configuration:
httpd -n
cat /etc/httpd.conf | grep -v '^#' | grep -v '^$'
Remediation
# Harden httpd.conf with TLS:
cat > /etc/httpd.conf <<'EOF'
server "www.example.com" {
  listen on * tls port 443
  tls {
    certificate "/etc/ssl/server.crt"
    key "/etc/ssl/private/server.key"
    protocols "TLSv1.3"
    ciphers "HIGH:!aNULL:!MD5"
  }
  root "/htdocs"
}
EOF
rcctl restart httpd
2.1.3 Ensure OpenSMTPD is hardened with TLS (Automated)
L1 Auto
Description

This recommendation verifies that OpenSMTPD is hardened with TLS on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check smtpd configuration:
smtpd -n
grep -v '^#' /etc/mail/smtpd.conf | grep -v '^$'
Remediation
# Secure OpenSMTPD:
cat > /etc/mail/smtpd.conf <<'EOF'
table aliases file:/etc/mail/aliases
listen on lo0
listen on egress tls pki mail.example.com
action "local" mbox alias <aliases>
action "relay" relay host smtp+tls://relay.example.com
match from local for local action "local"
match from any for domain "example.com" action "local"
EOF
rcctl restart smtpd

3 — Network & Firewall

▶

3.1 PF & Network Stack

▶
3.1.1 Ensure PF firewall is enabled with default-deny policy (Automated)
L1 Auto
Description

This recommendation verifies that PF firewall is enabled with default-deny policy on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check PF firewall status and rules:
pfctl -s info | head -5
pfctl -s rules

# Verify pf is enabled:
rcctl get pf flags
Remediation
# Configure PF with default-deny:
cat > /etc/pf.conf <<'EOF'
set skip on lo
block in log all
pass out quick
pass in on egress proto tcp from any to (egress) port {22, 443}
pass in on egress proto icmp from any to any icmp-type echoreq
EOF
pfctl -f /etc/pf.conf
rcctl enable pf
3.1.2 Ensure network sysctls are hardened (Automated)
L1 Auto
Description

This recommendation verifies that network sysctls are hardened on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check sysctl network hardening:
sysctl net.inet.ip.forwarding
sysctl net.inet.ip.redirect
sysctl net.inet.icmp.rediraccept
sysctl net.inet.tcp.synuseithreshold
Remediation
# Harden network sysctls:
cat >> /etc/sysctl.conf <<'EOF'
net.inet.ip.forwarding=0
net.inet.ip.redirect=0
net.inet.icmp.rediraccept=0
net.inet.ip.sourceroute=0
net.inet.tcp.synuseithreshold=1024
net.inet6.ip6.forwarding=0
EOF
sysctl net.inet.ip.forwarding=0
sysctl net.inet.ip.redirect=0

4 — Filesystem Security

▶

4.1 Permissions & Mount Options

▶
4.1.1 Ensure partitions use nosuid, nodev, and noexec mount options (Automated)
L1 Auto
Description

This recommendation verifies that partitions use nosuid, nodev, and noexec mount options on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check filesystem mount options:
mount | grep -E '(nosuid|nodev|noexec)'

# Verify /tmp mount:
grep '/tmp' /etc/fstab
Remediation
# Add mount security options:
# Edit /etc/fstab:
# /dev/sd0d /tmp ffs rw,nodev,nosuid,noexec 1 2
# /dev/sd0e /var ffs rw,nodev,nosuid 1 2
# /dev/sd0f /usr ffs rw,nodev 1 2
# /dev/sd0g /home ffs rw,nodev,nosuid 1 2
mount -a
4.1.2 Ensure no world-writable files or unnecessary SUID binaries exist (Automated)
L1 Auto
Description

This recommendation verifies that no world-writable files or unnecessary SUID binaries exist on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Find world-writable files:
find / -xdev -type f -perm -0002 -ls 2>/dev/null

# Find SUID/SGID binaries:
find / -xdev \( -perm -4000 -o -perm -2000 \) -type f -ls 2>/dev/null
Remediation
# Remove world-writable permissions:
find / -xdev -type f -perm -0002 -exec chmod o-w {} \;

# Remove unnecessary SUID bits:
chmod u-s /usr/bin/chfn
chmod u-s /usr/bin/chsh
chmod u-s /usr/bin/chpass

5 — Kernel Security

▶

5.1 Securelevel & Exploit Mitigations

▶
5.1.1 Ensure securelevel is set to 2 or higher (Automated)
L1 Auto
Description

This recommendation verifies that securelevel is set to 2 or higher on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check securelevel:
sysctl kern.securelevel

# Verify securelevel in rc.conf:
grep securelevel /etc/rc.conf.local
Remediation
# Set securelevel to 2 (highly secure):
echo 'kern.securelevel=2' >> /etc/sysctl.conf
# In /etc/rc.conf.local:
echo 'kern.securelevel=2' >> /etc/rc.conf.local
5.1.2 Ensure W^X enforcement is enabled (Automated)
L1 Auto
Description

This recommendation verifies that W^X enforcement is enabled on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check W^X enforcement:
sysctl kern.wxabort

# Check pledge/unveil usage:
ktrace -t + /usr/bin/program 2>&1 | grep -i pledge
Remediation
# Enable W^X abort:
echo 'kern.wxabort=1' >> /etc/sysctl.conf
sysctl kern.wxabort=1

6 — Patch & Package Management

▶

6.1 Updates & Signatures

▶
6.1.1 Ensure system patches are applied with syspatch (Automated)
L1 Auto
Description

This recommendation verifies that system patches are applied with syspatch on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check syspatch status:
syspatch -l
syspatch -c

# Check firmware updates:
fw_update -n
Remediation
# Apply available patches:
syspatch

# Update firmware:
fw_update

# Schedule automatic patching (cron):
# 0 3 * * * /usr/sbin/syspatch >> /var/log/syspatch.log 2>&1
6.1.2 Ensure package sources use HTTPS and signatures are verified (Automated)
L1 Auto
Description

This recommendation verifies that package sources use HTTPS and signatures are verified on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check package signatures:
pkg_info -S

# Verify installurl:
cat /etc/installurl
Remediation
# Configure trusted mirror:
echo 'https://cdn.openbsd.org/pub/OpenBSD' > /etc/installurl

# Verify package integrity:
pkg_check

7 — Logging & Auditing

▶

7.1 System Logs & Accounting

▶
7.1.1 Ensure comprehensive syslog configuration is in place (Automated)
L1 Auto
Description

This recommendation verifies that comprehensive syslog configuration is in place on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check system logging:
grep -v '^#' /etc/syslog.conf | grep -v '^$'

# Check newsyslog rotation:
cat /etc/newsyslog.conf | head -20
Remediation
# Configure comprehensive syslog:
cat >> /etc/syslog.conf <<'EOF'
authpriv.*			/var/log/authlog
*.notice;auth,authpriv,cron,ftp,kern,lpr,mail.none	/var/log/messages
security.*			/var/log/security
*.emerg				*
EOF
rcctl restart syslogd
7.1.2 Ensure process accounting is enabled (Automated)
L1 Auto
Description

This recommendation verifies that process accounting is enabled on the OpenBSD 7 operating system. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenBSD 7 operating system vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check accounting:
rc.conf get accounting
ls -la /var/account/
Remediation
# Enable process accounting:
rcctl enable accounting
rcctl start accounting

# Check daily security check:
cat /etc/daily.local
# Ensure daily security run output is reviewed