OS prerequisites
A read-only OS user and a sudoers file you can read in one minute
The Infra checks log in as a dedicated user, read what an administrator would read, and run commands as root or as the SAP admin login on the server (system ID + adm; s4hadm on this page, for the example system S4H) only through sudo -n: if a rule is missing, the check fails at once instead of waiting on a password prompt, and its mission stays unverified.
The OS user
- Create a dedicated user on each SAP host, for example
bpreader, with SSH key or password logon. Its own shell needs no special rights. - The commands it runs, per check, are listed below. Each one is shown in the product's dry run and on every evidence record.
- Credentials are entered per session in SecureBasis and held in memory only.
SSH (Linux and Unix)
- Port 22, or the port you set per system.
- The host key must be known before the first connection: SecureBasis checks a pinned fingerprint or your
known_hosts, and refuses to connect otherwise. - Sudoers must not set
requirettyfor this user (the rule below turns it off for it alone).
| Check | Linux command | Runs as |
|---|---|---|
| OS detection | uname -a, cat /etc/os-release | the user itself |
| Listeners | ss -tlnp | root (to see process names) |
| Firewall state | firewall-cmd --list-all-zones, firewall-cmd --permanent --list-all-zones, then firewall-cmd --info-service=<service> for each service the active and default zones use (and the services those include). When a run names a zone: firewall-cmd --list-all --zone=<zone> and firewall-cmd --permanent --list-all --zone=<zone> instead of the two zone listings | root |
| Kernel version | disp+work -v | s4hadm (login shell) |
| Kernel directory | sappfpar pf=<profile> DIR_CT_RUN | s4hadm (login shell) |
| prxyinfo | cat <path>/prxyinfo | s4hadm |
| Process tree (hunt) | ps -ef | the user itself |
| File hashes | sha256sum <files> | s4hadm |
Least-privilege sudoers (Linux, read-only checks)
Two files per host: the fixed reads below, and the firewall services (next section). Replace s4hadm, S4H and D00 with your SID's values, add one block per SID on the host, and check every path with command -v on your distribution. Name the files without a dot: sudo skips files in /etc/sudoers.d whose name contains one.
# SecureBasis: read-only checks. Edit with: visudo -f /etc/sudoers.d/bpmc-readonly
Defaults:bpreader !requiretty
# Root reads: listeners with process names, and the firewall configuration (runtime + permanent).
Cmnd_Alias BP_ROOT_READ = /usr/sbin/ss -tlnp, \
/usr/bin/firewall-cmd --list-all-zones, \
/usr/bin/firewall-cmd --permanent --list-all-zones
bpreader ALL=(root) NOPASSWD: BP_ROOT_READ
# Only if a run names a firewalld zone: one pair per zone you name. Uncomment and replace
# "public". In sudoers, an "=" inside an argument is written "\=".
# Cmnd_Alias BP_ZONE_READ = /usr/bin/firewall-cmd --list-all --zone\=public, \
# /usr/bin/firewall-cmd --permanent --list-all --zone\=public
# bpreader ALL=(root) NOPASSWD: BP_ZONE_READ
# Reads as s4hadm (the SAP admin login): exact files only (no wildcards: in sudoers, * also matches spaces,
# so a wildcard argument would let the user add other files to the command line).
Cmnd_Alias BP_S4H_READ = /usr/bin/cat /usr/sap/S4H/D00/data/prxyinfo, \
/usr/bin/sha256sum
bpreader ALL=(s4hadm) NOPASSWD: BP_S4H_READsha256sumis allowed without fixed arguments because it prints hashes only, never file contents. Remove it to switch off the file-hash check.- Validate each file with
visudo -cf <file>, then list what the user may run withsudo -l -U bpreader.
Firewall services: one exact rule per service
To learn which ports a zone opens, the firewall check reads every service that the active and default zones use with firewall-cmd --info-service=<service>, and then the services those include. A default RHEL or SLES zone already lists services such as ssh, cockpit or dhcpv6-client. Without a rule for a service, its ports stay unknown and the M3 LOCKDOWN check on that host cannot be verified.
Any sudo version: generate one exact rule per service on the host. Run the script as root, and run it again after you add a custom firewalld service.
#!/bin/sh
# Prints one exact sudoers rule per firewalld service on this host. Run as root.
set -euf
services=$(firewall-cmd --get-services)
printf '%s\n' $services | grep -xE '[A-Za-z0-9_.+-]{1,64}' | LC_ALL=C sort -u |
awk 'BEGIN { printf "Cmnd_Alias BP_FW_SERVICES =" }
{ printf "%s \\\n /usr/bin/firewall-cmd --info-service\\=%s", (NR > 1 ? "," : ""), $0 }
END { print ""; print "bpreader ALL=(root) NOPASSWD: BP_FW_SERVICES" }'sh bpmc-fw-services.sh > /root/bpmc-fw-services
visudo -cf /root/bpmc-fw-services && \
install -m 0440 -o root -g root /root/bpmc-fw-services /etc/sudoers.d/bpmc-fw-servicessudo 1.9.10 or later (check with sudo -V): one rule with a regular expression does the same. The expression has no space in it, so it matches a single service name and never a second argument.
# sudo 1.9.10 or later only. Edit with: visudo -f /etc/sudoers.d/bpmc-fw-services
bpreader ALL=(root) NOPASSWD: /usr/bin/firewall-cmd ^--info-service=[A-Za-z0-9_.+-]{1,64}$AIX, Solaris and HP-UX
| OS | Listeners | Firewall state (root) | File hashes (s4hadm) |
|---|---|---|---|
| AIX | netstat -an (no sudo) | lsfilt -v 4 -a | openssl dgst -sha256 |
| Solaris 11.0 to 11.3 | netstat -an | ipfstat -io | digest -v -a sha256 |
| Solaris 11.4 | netstat -an | Not supported: Oracle removed IP Filter in 11.4 | digest -v -a sha256 |
| HP-UX | netstat -an | ipfstat -io | openssl dgst -sha256 |
Use the full path that command -v prints on your host in each sudoers rule. The Unix command packs are built from vendor documentation; their lab confirmation is listed in the release notes.
Windows (WinRM)
- WinRM over HTTPS on port 5986, with a server certificate that the machine running SecureBasis trusts (or a CA file you give it). Plain HTTP is for labs only.
- NTLM with message encryption. Every connection is pinned to the target address, so a proxy cannot carry the session.
- Use an account in the local Administrators group: Windows shows other accounts' process command lines only to administrators.
Approved changes (only if you use them)
The kernel switch, snapshots and the firewall lockdown need more: systemd-run, systemctl, at, cp, sh, saproot.sh, the firewall write commands, and SAP binaries such as sapcontrol as the SAP admin login (s4hadm). Running sh as root is equivalent to root, so treat these rights as root access:
- Put them in a separate file, for example
/etc/sudoers.d/bpmc-change, and add it only for the approved maintenance window. Remove it afterwards. - Every change still needs a dry run, a second person's approval and an open window inside SecureBasis.
- For a read-only assessment, never create this file.