Skip to content
SecureBasisby Sharan AIDownloadBook a demo

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 requiretty for this user (the rule below turns it off for it alone).
CheckLinux commandRuns as
OS detectionuname -a, cat /etc/os-releasethe user itself
Listenersss -tlnproot (to see process names)
Firewall statefirewall-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 listingsroot
Kernel versiondisp+work -vs4hadm (login shell)
Kernel directorysappfpar pf=<profile> DIR_CT_RUNs4hadm (login shell)
prxyinfocat <path>/prxyinfos4hadm
Process tree (hunt)ps -efthe user itself
File hashessha256sum <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.

/etc/sudoers.d/bpmc-readonly
# 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_READ
  • sha256sum is 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 with sudo -l -U bpreader.

Confirm the two login-shell commands in your lab. The kernel checks run sudo -n -i -u s4hadm disp+work -v and sudo -n -i -u s4hadm sappfpar pf=<profile> DIR_CT_RUN in s4hadm's login shell (csh or sh), which sudo matches through that shell. Run both by hand as bpreader before the first check, and add the rule your sudo version needs. If you would rather not, leave them out: the running kernel is still read through SAPControl, and the on-disk kernel check stays unverified.

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.

Never allow firewall-cmd --info-service=*. In sudoers, * also matches spaces, so the read-only user could add firewall write options such as --add-port or --reload to the same command line and run them as root. Use one of the two forms below: each rule matches one service name and nothing else.

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.

bpmc-fw-services.sh
#!/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" }'
Install the generated rules
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-services

sudo 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.

/etc/sudoers.d/bpmc-fw-services
# 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

OSListenersFirewall state (root)File hashes (s4hadm)
AIXnetstat -an (no sudo)lsfilt -v 4 -aopenssl dgst -sha256
Solaris 11.0 to 11.3netstat -anipfstat -iodigest -v -a sha256
Solaris 11.4netstat -anNot supported: Oracle removed IP Filter in 11.4digest -v -a sha256
HP-UXnetstat -anipfstat -ioopenssl 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.