Security Enhancements and their Setup & Configuration in SAP Basis
I. Introduction to SAP Basis Security
SAP Basis security focuses on protecting the SAP system at the technical layer, encompassing the operating system, database, application server, and network communication. It's about implementing safeguards to prevent unauthorized access, data breaches, system compromises, and ensuring compliance with security policies and regulations.
Key areas of SAP Basis Security:
- User and Authentication Management: Who can access the system and how they prove their identity.
- Authorization Management: What users can do once authenticated.
- Secure Communication: Protecting data in transit.
- System Hardening: Reducing the attack surface of the SAP system components.
- Auditing and Logging: Monitoring security-relevant events.
- Vulnerability Management: Identifying and patching security weaknesses.
II. Core Security Enhancements & Setup
A. User and Authentication Management
-
Strong Password Policies:
- Purpose: Enforce complex and regularly changed passwords to prevent brute-force attacks.
- Configuration: Adjust profile parameters in
RZ10
(instance/default profiles):login/min_password_length
: Minimum password length (e.g., 8-12 characters).login/password_history
: Number of old passwords remembered (e.g., 5-10).login/password_expiration_time
: Password validity in days (e.g., 30-90 days).login/fails_to_user_lock
: Number of failed logon attempts before user lock (e.g., 3-5).login/min_password_letters
,login/min_password_digits
,login/min_password_specials
: Require mixed characters.login/password_regular_expression
: (Newer NetWeaver) Use regex for highly complex rules.
- Setup: Activate the "Password Change at Next Logon" flag (
SU01
) for new users.
-
Single Sign-On (SSO):
- Purpose: Enhance user experience and security by reducing password fatigue and the risk of weak/reused passwords. Centralizes authentication.
- Methods & Setup:
- SNC (Secure Network Communications):
- Principle: SAP's native security layer for application-level data encryption and authentication. Uses external security products (e.g., SAP NetWeaver SSO, CommonCryptoLib, Kerberos, X.509 certificates).
- Setup:
- Install SNC library (
libsapcrypto.so
/sapcrypto.dll
) andCommonCryptoLib
(or other security product). - Configure profile parameters (
snc/enable
,snc/gssapi_lib
,snc/identity/as
,snc/qop
). - Create credentials (e.g., PSEs for X.509) and distribute.
- Configure users (
SU01
) with SNC names. - Configure RFC destinations (
SM59
) for SNC.
- Install SNC library (
- Benefits: End-to-end encryption, strong authentication (digital certificates, Kerberos).
- SAML 2.0 (Security Assertion Markup Language):
- Principle: Web-based SSO standard. SAP system acts as Service Provider (SP), integrating with an Identity Provider (IdP) like Azure AD, Okta, SAP IdM.
- Setup:
- Activate SICF service
/sap/public/bc/sec/saml2
. - Configure SAML 2.0 via
transaction SAML2
. Establish trusted providers (IdP/SP metadata exchange). - User mapping (e.g., email address, User ID).
- Activate SICF service
- Benefits: Standardized, cloud-friendly, supports multi-factor authentication (MFA) at IdP.
- SPNego (Simple and Protected GSS-API Negotiation Mechanism):
- Principle: For Windows-centric environments, leverages Microsoft Active Directory and Kerberos for SSO to SAP ABAP systems.
- Setup:
- Configure Active Directory (Service Principal Names - SPNs for SAP service user).
- Install Kerberos keytab file on SAP system.
- Configure profile parameters (
spnego/enable
,spnego/krb5_lib
,spnego/user_principal
, etc.). - Activate SICF service
/sap/public/bc/spnego
.
- Benefits: Seamless SSO for Windows users, strong Kerberos authentication.
- SNC (Secure Network Communications):
-
Client 000/001/066 Security:
- Purpose: These are default clients;
000
and001
are for SAP reference and post-installation,066
for SAP EarlyWatch/Solution Manager. They have powerful default users. - Configuration:
- Change Default Passwords: Immediately change passwords for
SAP*
,DDIC
,EARLYWATCH
,SAPCPIC
in these clients after installation. - Lock
SAP*
andDDIC
: After initial setup and creating specific administrative users, consider lockingSAP*
andDDIC
in clients000
,001
,066
if not actively used. - Restrict Access: Restrict remote access to these clients.
- Profile Parameter
login/no_automatic_user_sapstar
: Set to1
to disable the automatic creation ofSAP*
if it's deleted. This prevents a backdoor.
- Change Default Passwords: Immediately change passwords for
- Purpose: These are default clients;
B. Authorization Management
-
Principle of Least Privilege:
- Purpose: Users should only have authorizations absolutely necessary for their job function.
- Setup:
- Role-Based Access Control (RBAC): Design roles using
PFCG
. - Composite Roles: Combine single roles.
- Derive Roles: For organizational units (e.g., company code, sales org).
- Restrict Sensitive Authorizations: Restrict objects like
S_TABU_DIS
(table access),S_DEVELOP
(development access),S_ADMI_FCD
(system administration functions). - Separation of Duties (SoD): Identify and prevent conflicting authorizations (e.g., creating and approving a vendor). Use tools like SAP GRC Access Control.
- Role-Based Access Control (RBAC): Design roles using
-
Critical Authorization Monitoring:
- Purpose: Track usage of powerful authorizations to detect misuse.
- Configuration: Configure the Security Audit Log (
SM19
) to monitor specific transactions (SM50
,SM51
,RZ10
,SU01
,PFCG
,SE16
,SA38
,SM59
), successful/failed logons, and changes to security-relevant parameters.
C. Secure Communication
-
RFC (Remote Function Call) Security:
- Purpose: Secure communication between SAP systems and external systems.
- Configuration:
SM59
(RFC Destinations):- SNC Activation: Activate SNC for critical RFCs (Type 3 - ABAP, Type T - TCP/IP).
- Trusted Systems: Use trusted system relationships (S_RFCACL) cautiously.
- Gateway Security: Implement gateway security rules (
reginfo
,secinfo
files) to control which programs can register and connect to the SAP gateway. - Authorization: Ensure the RFC user has only necessary
S_RFC
authorizations. - Secure Communications (SSL/TLS): Use HTTPS for HTTP-based RFCs.
- Profile Parameters:
gw/acl_mode
,gw/reg_no_reg_info
,gw/reg_info
,gw/sec_info
.
-
Web Service Security (SOAP/REST):
- Purpose: Secure external access to SAP web services.
- Configuration:
SICF
(Maintain Service):- Activate SSL/TLS for all external-facing services.
- Require logon for services; avoid anonymous access unless absolutely necessary.
- Use strong authentication methods (e.g., X.509 certificates, SAML assertions).
STRUST
(Trust Manager): Manage SSL Server and Client PSEs for certificate-based authentication.- Message-Level Security: Implement WS-Security for SOAP-based services (digital signatures, encryption of message parts).
D. System Hardening
-
Security Profile Parameters (
RZ10
):DIR_CT_RUN
: Restrict access to executable directories.rsau/enable
: Enable Security Audit Log.rdisp/gui_auto_logout
: Automatic GUI logout for inactivity.rdisp/max_alt_modes
: Limit parallel sessions per user.RZ11
: For runtime parameter changes and documentation.
-
OS and Database Security:
- Principle: Standard OS/DB hardening guidelines apply (e.g., minimum services, strong passwords for OS/DB users, regular patching, file system permissions).
- Database User Management: Only allow necessary OS/DB users to access the database. Restrict default powerful users.
- File System Permissions: Secure SAP installation directories (
/sapmnt
,exe
, work directories). - Firewalls: Implement host-based firewalls (e.g.,
iptables
, Windows Firewall) in addition to network firewalls. - Regular Patching: Apply latest OS, DB, and SAP security patches.
-
Diagnostic and Debugging Tools:
- Purpose: Limit powerful tools like debuggers (
/h
), ABAP Workbench (SE80
), OS commands (SM49
,SM69
). - Configuration: Restrict
S_DEVELOP
,S_TOOLS_EX
,S_ADMI_FCD=ADMN
andSM49
,SM69
authorizations to developers and Basis administrators only. Monitor their usage.
- Purpose: Limit powerful tools like debuggers (
E. Auditing and Logging
-
Security Audit Log (
SM19
/SM20
):- Purpose: Records security-relevant events for analysis and forensics.
- Configuration (
SM19
):- Activate filters for critical events: successful/failed logons, transaction starts (
SM50
,SU01
,PFCG
), RFC calls, changes to user master data, security profile parameters. - Define filters for specific users or clients.
- Activate the audit profile (
rsau/enable = 1
inRZ10
).
- Activate filters for critical events: successful/failed logons, transaction starts (
- Analysis (
SM20
/SM20N
): View and analyze audit log entries. - Storage: Ensure sufficient space for audit logs and regular archiving.
-
Gateway Logging:
- Purpose: Logs connection attempts and activities via the SAP gateway.
- Configuration: Profile parameters
gw/logging
,gw/log_level
,gw/log_file
.
-
Work Process Trace Files:
- Purpose:
dev_w*
anddev_disp
logs can contain security-relevant information (e.g., failed logon attempts, program errors). - Monitoring: Regularly review.
- Purpose:
III. Important Configuration to Keep in Mind
- Top-Down Approach: Start with network and OS security before configuring SAP application security.
- Least Privilege: Apply this principle rigorously to users, RFCs, and system accounts.
- Virtual Hostnames: Use virtual hostnames for all SAP instances (ASCS, DB, HANA) to provide a layer of abstraction and simplify network changes, reducing direct exposure of physical IPs.
- Dedicated Users: Create specific users for RFCs, system integrations, and background jobs with only the necessary authorizations. Avoid using powerful dialog users.
- Regular Patch Management: Stay up-to-date with SAP Security Notes, OS patches, and DB patches. Use SAP Note 1944855 for patch assessment.
- Security Audit Log (
SM19
/SM20
): Always enable and configure this for critical events. It's your primary forensic tool. login/no_automatic_user_sapstar = 1
: Set this parameter to prevent a back-door.- Gateway Security Files (
reginfo
,secinfo
): Harden these files to explicitly control what can register and connect to the SAP gateway. By default, they are often too open. - SSL/TLS Everywhere: Encrypt all network communications where possible: SNC for internal SAP, SSL/TLS for HTTP/HTTPS, secure FTP (SFTP) for file transfers.
- Client 000/001/066: Secure
SAP*
,DDIC
users in these clients immediately after installation. - System Hardening Parameters: Review and set parameters like
rdisp/gui_auto_logout
and restrict debugging authorizations (S_DEVELOP
). - External Security Tools: Consider integrating with Security Information and Event Management (SIEM) systems for centralized logging and analysis.
- Security Notes Implementation: Use SAP Note Assistant (
SNOTE
) to implement recommended security notes. - Transport Layer Security: Ensure secure transport routes between development, quality, and production systems.
- User Defaults: Set sensible defaults for new users (e.g., initial password policy, validity period).
- Monitoring: Actively monitor security logs, audit trails, and system health for anomalies.
30 Interview Questions and Answers (One-Liner) for Security Enhancements in SAP Basis
- Q: What is the purpose of
login/min_password_length
?- A: To enforce a minimum length for user passwords.
- Q: Which transaction is used to manage and configure the Security Audit Log?
- A:
SM19
.
- A:
- Q: What is the main benefit of implementing SSO in SAP?
- A: Enhanced user experience and stronger authentication, reducing password fatigue.
- Q: What does SNC stand for in SAP security?
- A: Secure Network Communications.
- Q: Which profile parameter disables automatic creation of
SAP*
if it's deleted?- A:
login/no_automatic_user_sapstar = 1
.
- A:
- Q: In
SM59
, what setting enables SNC for RFC destinations?- A: Activation of SNC under the "Logon & Security" tab.
- Q: What is the purpose of
rdisp/gui_auto_logout
?- A: To automatically log out inactive GUI users.
- Q: Which standard allows SAP to integrate with Identity Providers like Azure AD for SSO?
- A: SAML 2.0.
- Q: What are
reginfo
andsecinfo
files used for?- A: To secure the SAP gateway (external program registration and client connections).
- Q: What transaction is used to manage SSL certificates in SAP?
- A:
STRUST
.
- A:
- Q: What is the principle of "least privilege" in security?
- A: Users should only have authorizations absolutely necessary for their job.
- Q: Which SAP authorization object is critical for table access?
- A:
S_TABU_DIS
.
- A:
- Q: What is SPNego used for in Windows-centric SAP environments?
- A: SSO via Kerberos and Active Directory.
- Q: Which transaction is used to analyze the Security Audit Log?
- A:
SM20
orSM20N
.
- A:
- Q: What are Service Principal Names (SPNs) related to in SAP security?
- A: SPNego for Kerberos authentication.
- Q: How can you limit the number of parallel sessions a user can have?
- A: Profile parameter
rdisp/max_alt_modes
.
- A: Profile parameter
- Q: Why is it important to change default passwords for users like
SAP*
andDDIC
?- A: To prevent unauthorized access using well-known credentials.
- Q: What is the role of CommonCryptoLib in SAP security?
- A: Provides cryptographic functions for SNC and SSL.
- Q: What is a key security risk of open RFC destinations?
- A: Unauthorized access and execution of functions or commands.
- Q: What kind of encryption does SNC provide for data in transit?
- A: Application-level encryption.
- Q: What is the
login/fails_to_user_lock
parameter for?- A: To set the number of failed logon attempts before a user is locked.
- Q: How can you harden the security of
SICF
services?- A: By activating SSL/TLS and requiring strong authentication.
- Q: What is the main purpose of "Separation of Duties (SoD)"?
- A: To prevent a single individual from performing conflicting tasks that could lead to fraud.
- Q: Which OS-level files are crucial for Gateway security?
- A:
reginfo
andsecinfo
.
- A:
- Q: What is
login/password_expiration_time
used for?- A: To set the validity period of passwords in days.
- Q: What is the
DIR_CT_RUN
parameter related to?- A: Restricting access to executable directories.
- Q: What is the purpose of a SIEM system in SAP security?
- A: Centralized collection, analysis, and correlation of security logs from various sources, including SAP.
- Q: Which transaction helps manage trust relationships via certificates (PSEs)?
- A:
STRUST
.
- A:
- Q: What is a typical recommendation for RFC user authorizations?
- A: Use dedicated RFC users with the least privilege (
S_RFC
only for needed FMs).
- A: Use dedicated RFC users with the least privilege (
- Q: What is the primary method for ensuring patch level security in SAP?
- A: Regularly applying SAP Security Notes via
SNOTE
.
- A: Regularly applying SAP Security Notes via
5 Scenario-Based Hard Questions and Answers for Security Enhancements in SAP Basis
-
Scenario: Your SAP ECC system uses SNC for secure communication between application servers and the database, and for client GUI connections. Users frequently report "SNC Logon Failed" errors, while some RFC connections also fail with SNC-related errors. You've confirmed the SNC library (
libsapcrypto.so
) is present and accessible, andsnc/enable
is set to1
.- Q: What are the common underlying reasons for "SNC Logon Failed" errors in this scenario, and what specific Basis-level troubleshooting steps would you take to diagnose and resolve such issues?
- A:
-
Common Underlying Reasons for "SNC Logon Failed" Errors:
- Incorrect SNC Name (User/RFC): The SNC name configured in
SU01
for the user or inSM59
for the RFC destination does not match the actual SNC identity provided by the security product (e.g., certificate DN, Kerberos principal). This is a very common mistake. - Missing/Expired Credentials (PSEs/Keytabs): The underlying security credentials (e.g., the Personal Security Environment - PSE file for X.509 certificates, or the Kerberos keytab file) are either missing, corrupted, expired, or have incorrect permissions/ownership for the SAP service user (
<sidadm>
). - Incorrect SNC Library Path: The
snc/gssapi_lib
profile parameter points to the wrong path, or thelibsapcrypto.so
itself is corrupted or not the correct version. - Network/Firewall Issues: Although SNC is application-level, underlying network connectivity issues (e.g., firewall blocking specific ports used by the security product for authentication or certificate revocation checks) can manifest as SNC failures.
- Time Synchronization: Significant time differences between the client/server and authentication server (e.g., Domain Controller for Kerberos) can cause authentication failures.
- Trust Issues (for X.509): If X.509 certificates are used, the SAP system's PSE (SSL Server/Client) might not trust the Certificate Authority (CA) that issued the user's/RFC's client certificate, or vice-versa.
- SNC QoS Mismatch: The
snc/qop
(Quality of Protection) level specified in the profile or RFC destination does not match what the client/server expects.
- Incorrect SNC Name (User/RFC): The SNC name configured in
-
Specific Basis-Level Troubleshooting Steps:
- Check SAP Profile Parameters:
- Verify
snc/enable = 1
andsnc/gssapi_lib
path is correct (and library is accessible/readable by<sidadm>
). - Verify
snc/identity/as
matches the system's SNC name andsnc/qop
is appropriate.
- Verify
- Verify User/RFC SNC Names:
- For Users: In
SU01
, check the "SNC" tab for the affected user. Compare the "SNC name" format with the actual identity. Example:p:CN=User Name, OU=Org Unit, O=Company, C=Country
(for X.509) orp:user@REALM
(for Kerberos). - For RFCs: In
SM59
, for the problematic RFC destination, go to "Logon & Security" tab. Ensure "SNC active" is checked and "SNC partner name" is correctly specified for the target system/program.
- For Users: In
- Check Credentials (
STRUST
/ Keytab):- For X.509 (PSEs): Go to
STRUST
. Check theSSL Server Standard
andSSL Client Standard
PSEs. Ensure they are valid (not expired), contain the correct certificates, and have the necessary trusted root certificates. Verify the ownership and permissions of the.pse
andsapgenpse
files at the OS level. - For Kerberos (Keytab): Verify the Kerberos
krb5.conf
path and the keytab file's existence, content, and permissions (read/execute
for<sidadm>
).
- For X.509 (PSEs): Go to
- Security Trace (
snc/data_protection/min = 2
):- Set
snc/data_protection/min
to2
(Integrity) or3
(Privacy) inRZ10
(orRZ11
for temporary runtime change) for more detailed SNC trace messages. - Restart the SAP instance (if changing in
RZ10
). - Reproduce the error.
- Analyze
dev_w*
anddev_ms
(Message Server) trace files. Look forSNC
keywords and specific error codes (e.g.,GSS-API error
).
- Set
- Network and Time Checks:
- Firewall: Temporarily disable host-based firewalls on client/server/DB to rule them out (only in controlled test environments).
- Time Sync: Ensure strict time synchronization (NTP) across all involved systems (SAP instances, DB, AD/IdP).
- Security Product Logs: If using a third-party security product (e.g., Windows Event Viewer for Kerberos, specific logs for SSO solution), check their logs for authentication failures.
- SNC Configuration Tool (e.g.,
sapgenpse
): Usesapgenpse
(for CommonCryptoLib) to verify PSEs, generate certificates, and test SNC parameters outside of SAP.
- Check SAP Profile Parameters:
-
-
Scenario: Your recent external security audit of a production SAP ERP system flagged several critical findings: 1) Too many users with
SAP_ALL
profile inPROD
, 2) Weak password policy parameters are set, 3) Critical transactions likeSE16
(table browser) andSM49
(OS commands) are not being logged in the Security Audit Log (SM20
), and 4) Default SAP client000
has unused users with default passwords.- Q: Detail the specific Basis actions you would take to address each of these four audit findings, including relevant transactions, profile parameters, and best practices.
- A:
- Addressing Audit Findings:
- Too Many Users with
SAP_ALL
Profile inPROD
:- Action: This is a major violation of the "Principle of Least Privilege."
- Identify Users: Use
SUIM
(Users by Complex Selection Criteria -> By Authorization Profiles ->SAP_ALL
). - Review and Restrict: For each user, collaborate with their manager and the security team to understand their exact job function.
- Replace with Custom Roles: Design and assign specific custom roles (
PFCG
) that provide only the necessary authorizations for their daily tasks. - Remove
SAP_ALL
: Once custom roles are assigned and tested, remove theSAP_ALL
profile from these users (SU01
). - Emergency Access (Break-Glass): Implement a robust "break-glass" procedure using a limited set of
SAP_ALL
users (e.g., 2-3 Basis leads) with strict logging and approval processes (e.g., using SAP GRC Emergency Access Management). These accounts should be locked by default and only unlocked for approved, audited emergency situations.
- Identify Users: Use
- Action: This is a major violation of the "Principle of Least Privilege."
- Weak Password Policy Parameters:
- Action: Strengthen password policies to enforce complexity and regular changes.
- Review Parameters (
RZ10
):login/min_password_length
: Increase to10
or12
.login/password_history
: Increase to10
.login/password_expiration_time
: Decrease to60
or90
days.login/min_password_letters
,login/min_password_digits
,login/min_password_specials
: Set to ensure mixed case, numbers, and special characters.- Consider
login/password_regular_expression
for advanced rules.
- Activation: Activate the changes in
RZ10
and restart the SAP instance(s). - Forced Password Change: After changing policies, instruct users to change their passwords, or trigger a mass password reset requiring a new password at next logon.
- Review Parameters (
- Action: Strengthen password policies to enforce complexity and regular changes.
- Critical Transactions (
SE16
,SM49
) Not Logged in Security Audit Log:- Action: Configure
SM19
to log these critical transactions.- Access
SM19
: Go to transactionSM19
. - Create/Modify Profile: Select the active audit profile (or create a new one).
- Add Filters: Go to "Filters" tab. Add new filters:
- For "Event ID" select
DIA
(dialog events) orT
(transaction start). - For "Transaction Code" enter
SE16
,SM49
,SM50
,SU01
,PFCG
,RZ10
, etc. - Ensure "Log for" is set to "Success" and "Failure" (or just "Success" if desired for
SE16
/SM49
).
- For "Event ID" select
- Activate Profile: Ensure the updated profile is activated.
- Verify Parameter (
RZ10
): Ensurersau/enable = 1
. - Monitor (
SM20
/SM20N
): Regularly reviewSM20
/SM20N
to confirm these transactions are now being logged.
- Access
- Action: Configure
- Default SAP Client
000
has Unused Users with Default Passwords:- Action: Secure default users in standard clients.
- Identify Users: In client
000
(or001
/066
), useSU01
to check users likeSAP*
,DDIC
,EARLYWATCH
,SAPCPIC
,TMSADM
. - Change Passwords: Immediately change passwords for ALL these default users to complex, random strings.
- Lock Users: For users not actively used (e.g.,
EARLYWATCH
,SAPCPIC
,TMSADM
if not configured for TMS/Solution Manager), lock them usingSU01
. login/no_automatic_user_sapstar
: Ensure this profile parameter is set to1
inRZ10
for enhanced protection againstSAP*
backdoor.- Restrict Access: Implement network-level restrictions (firewalls) to limit direct access to clients
000
/001
/066
to only Basis administrators from secure subnets.
- Identify Users: In client
- Action: Secure default users in standard clients.
- Too Many Users with
- Addressing Audit Findings:
-
Scenario: Your company decides to implement Single Sign-On (SSO) for all SAP GUI users using Kerberos via SPNego (Simple and Protected GSS-API Negotiation Mechanism). You have a multi-application server SAP ECC system on Windows, connected to a Windows Active Directory domain. The Basis team is responsible for the SAP-side configuration.
- Q: Outline the detailed Basis-level steps for configuring SPNego SSO on the SAP ABAP system, including prerequisite checks and potential challenges specific to a multi-application server environment.
- A:
-
Detailed Basis-Level Steps for SPNego SSO Configuration:
Phase 1: Prerequisites & Active Directory (AD) Coordination
- OS / Network:
- Verify all SAP application servers (including ASCS) are joined to the Active Directory domain.
- Ensure strict time synchronization (NTP) between all SAP servers and Active Directory Domain Controllers.
- Verify DNS resolution for all SAP hostnames.
- SAP Kernel:
- Ensure the SAP kernel is compatible with SPNego (NetWeaver 7.0 EHP2 or higher recommended).
- Ensure
CommonCryptoLib
(or a compatible GSS-API library) is installed and accessible in the kernel's executable directory (e.g.,DIR_EXE
).
- Active Directory (Coordination with AD Team):
- Service Account: Create a dedicated Active Directory user account (e.g.,
SAPService<SID>
) that will represent the SAP system for Kerberos authentication. This account must have "Trust this user for delegation to any service (Kerberos only)" unchecked (security best practice). - Service Principal Names (SPNs): Register the necessary SPNs for the SAP service account. This maps the SAP service to the AD account.
- For the ASCS Virtual Hostname:
setspn -A SAP/<ASCS_VirtualHost> <Domain>\SAPService<SID>
- For the ASCS Virtual Hostname FQDN:
setspn -A SAP/<ASCS_VirtualHost.FQDN> <Domain>\SAPService<SID>
- For each Application Server Physical Hostname:
setspn -A SAP/<PhysicalHost> <Domain>\SAPService<SID>
- For each Application Server Physical Hostname FQDN:
setspn -A SAP/<PhysicalHost.FQDN> <Domain>\SAPService<SID>
- (Note: For a multi-app server system, the SPNs for the application servers are often also needed if users might connect directly to them, although the ASCS SPNs are most critical for initial ticket granting).
- For the ASCS Virtual Hostname:
- Keytab File: The AD team (or you, with appropriate permissions) will generate a Kerberos keytab file (
krb5.keytab
) for theSAPService<SID>
account. This file contains the cryptographic keys and must be securely transferred to the SAP system.
- Service Account: Create a dedicated Active Directory user account (e.g.,
Phase 2: SAP ABAP System Configuration
- Keytab File Placement:
- Place the
krb5.keytab
file in a secure, accessible location on all SAP application servers (including ASCS) (e.g.,C:\usr\sap\<SID>\SYS\global\security\
). Ensure<sidadm>
user has read/execute permissions.
- Place the
- Profile Parameters (
RZ10
):- Go to
RZ10
and configure the following parameters in the Default Profile or Instance Profiles for all relevant application servers:spnego/enable = 1
(Enables SPNego)spnego/krb5_lib = <path_to_CommonCryptoLib>
(e.g.,C:\usr\sap\<SID>\SYS\exe\uc\NTAMD64\sapcrypto.dll
)spnego/krb5_conf_lib = <path_to_Kerberos_config>
(e.g.,C:\Windows\krb5.ini
or leave blank if using default AD configs)spnego/keytab = <path_to_keytab_file>
(e.g.,C:\usr\sap\<SID>\SYS\global\security\krb5.keytab
)spnego/user_principal = SAP/<ASCS_VirtualHost>@YOUR.AD.REALM
(Service Principal Name of the ASCS, specify the full Kerberos realm). This is critical for the ASCS instance.snc/enable = 1
(SPNego relies on SNC infrastructure).snc/gssapi_lib = <path_to_CommonCryptoLib>
(same asspnego/krb5_lib
).snc/permit_insecure_start = 0
(Best practice, forces secure connections).
- Restart SAP Instances: After changing profile parameters, restart all relevant SAP application servers (including ASCS) for changes to take effect.
- Go to
- Activate SPNego Service (
SICF
):- Go to
SICF
. Navigate to path/sap/public/bc/spnego
. - Activate this service.
- Go to
- SNC Configuration in
SU01
(User Mapping):- For each SAP user who will use SPNego, maintain their SNC name in
SU01
(SNC tab). - Format:
p:<AD_User_UPN>@YOUR.AD.REALM
(e.g.,p:johndoe@YOUR.AD.REALM
). Alternatively, for initial setup, you can also usep:*
for testing, then configure specific users. - This maps the Kerberos principal to the SAP user.
- For each SAP user who will use SPNego, maintain their SNC name in
- OS / Network:
-
Potential Challenges Specific to Multi-Application Server Environment:
- Keytab Distribution & Permissions: Ensuring the
krb5.keytab
file is identical, placed correctly, and has correct permissions on all application servers (including ASCS) can be challenging. An incorrect keytab on even one server can cause intermittent SSO failures. - SPN Registration Complexity: Correctly registering all necessary SPNs (especially for application servers if they handle direct user connections or specific services) can be tricky. Missing or duplicate SPNs will cause authentication failures.
- Load Balancing for SSO: If using SAP Web Dispatcher or a hardware load balancer, ensuring Kerberos tickets are correctly handled across multiple application servers is important. The SPN for the Web Dispatcher's virtual hostname might also be needed.
- Client-Side Configuration: Users' desktops must be correctly configured for Kerberos (e.g., trusted sites in IE, no proxies breaking Kerberos authentication). GPOs in AD can help standardize this.
- Troubleshooting Trace Files: Debugging SPNego issues often requires analyzing Kerberos logs (Windows Event Viewer on Domain Controllers/clients), SAP developer traces (
dev_w*
), andsapstartsrv
logs, which can be verbose.
- Keytab Distribution & Permissions: Ensuring the
-
-
Scenario: Your company's internal security team detected suspicious activity originating from an RFC connection. Further investigation revealed a custom RFC-enabled function module (FM) that allows arbitrary OS commands to be executed via
CALL SYSTEM
without sufficient authorization checks. This FM is used by a third-party application via a dedicated RFC user.- Q: What are the immediate and long-term Basis-level security measures you would take to mitigate this vulnerability and secure your SAP system against similar future attacks via RFC?
- A:
-
Immediate Basis-Level Security Measures:
- Disable/Restrict Vulnerable RFC FM:
- Action: Immediately identify the custom RFC-enabled function module. In
SE37
, change its processing type to "Normal function module" (remove "Remote-Enabled Module") or delete it if it's no longer needed. Alternatively, temporarily disable the RFC user or remove itsS_RFC
authorization for that specific FM. - Rationale: Stop the immediate threat of arbitrary OS command execution.
- Action: Immediately identify the custom RFC-enabled function module. In
- Lock/Review RFC User:
- Action: Lock the dedicated RFC user (
SU01
) used by the third-party application. - Action: Review the
S_RFC
authorizations of all RFC users (SUIM
) to identify any other users with overly broad access (e.g.,S_RFC
for*
or critical function groups likeSXPG
). - Rationale: Prevent the attacker from using the same entry point.
- Action: Lock the dedicated RFC user (
- Check Security Audit Log (
SM20
/SM20N
):- Action: Review
SM20
/SM20N
for past activities by the compromised RFC user and any relatedRFC
event IDs. Look forT
(transaction start),B
(RFC call),C
(command execution) events. - Rationale: Understand the extent of the breach and identify any other executed commands.
- Action: Review
- Network-Level Block:
- Action: Coordinate with the network team to immediately block inbound RFC connections from the IP address of the compromised third-party application or its server, if the application is not immediately critical.
- Rationale: Add an immediate layer of network defense.
- Disable/Restrict Vulnerable RFC FM:
-
Long-Term Basis-Level Security Measures:
- Secure Gateway Security Files (
reginfo
,secinfo
):- Action: Harden these files.
reginfo
controls program registration at the Gateway (e.g., for external RFC servers).secinfo
controls which hosts and programs can connect to the Gateway. - Configuration: Define explicit
ACL_ALLOWED_PROGRAMS
inreginfo
for only allowed registered programs. DefineP
(program),H
(host),U
(user) rules insecinfo
for allowed connections. Setgw/acl_mode = 1
inRZ10
. - Rationale: Prevents unauthorized external programs from registering or connecting to the SAP Gateway.
- Action: Harden these files.
- Principle of Least Privilege for RFC Users:
- Action: For every RFC user, define authorizations strictly based on the Function Modules (FMs) they absolutely need to call. Grant
S_RFC
authorization only for specific function groups or FMs, not*
. - Action: Review custom FMs that use
CALL SYSTEM
(or similar OS command execution). These should never be RFC-enabled unless absolutely necessary and with extremely strict internal authorization checks (e.g.,AUTHORITY-CHECK
onS_ADMI_FCD=UNIX
). - Rationale: Limits the impact if an RFC user is compromised.
- Action: For every RFC user, define authorizations strictly based on the Function Modules (FMs) they absolutely need to call. Grant
- Implement SNC for RFC Connections:
- Action: Configure SNC for all critical RFC destinations (
SM59
). This encrypts the communication and provides strong authentication using certificates or Kerberos. - Rationale: Prevents eavesdropping and replay attacks, and ensures mutual authentication.
- Action: Configure SNC for all critical RFC destinations (
- Code Review and Static Analysis:
- Action: Work with development teams to implement security-focused code reviews and static code analysis (e.g., using SAP Code Vulnerability Analysis - CVA) for all custom RFC-enabled FMs, especially those involving OS interaction or sensitive data.
- Rationale: Proactively identify and fix vulnerabilities in custom code.
- Security Audit Log (
SM19
) Enhancement:- Action: Ensure
SM19
is configured to log all RFC calls (event IDB
) and critical system commands (event IDC
). Filter for specific RFC users or function modules. - Rationale: Provides an audit trail for all RFC-related activities.
- Action: Ensure
- Regular Vulnerability Scans:
- Action: Implement regular vulnerability scanning of your SAP systems (using tools like SAP's own security tools or third-party scanners) to identify open ports, insecure configurations, and unpatched vulnerabilities.
- Secure Gateway Security Files (
-
-
Scenario: Your Security Audit Log (
SM20
) is generating an overwhelming number of "successful logon" messages, making it difficult to detect actual suspicious activities. Additionally, your storage team reports that the audit log filesystem is filling up rapidly, requiring frequent manual purges. Your current policy dictates keeping audit logs for at least 3 months.- Q: How would you optimize the Security Audit Log configuration to reduce log volume while retaining critical security information for a 3-month retention policy, and what additional steps would you take to manage log storage and improve alert signal-to-noise ratio?
- A:
-
Optimizing Security Audit Log Configuration (
SM19
) to Reduce Volume:- Refine Event Filters:
- Action: In
SM19
, for the active audit profile, go to the "Filters" tab. - Log Event
A
(Successful Logon): Instead of logging all successful logons for all users, refine this.- Filter by User Type: Only log successful logons for dialog users (
login/user_type_diag
) and system users (login/user_type_system
), but excludeCPIC
users unless specifically required for integration troubleshooting. - Exclude Trusted RFC Users: For high-volume RFC integrations from trusted systems, consider if you truly need every successful RFC logon logged for dedicated, tightly controlled RFC users. If not, exclude them or apply specific, less verbose filters.
- Focus on Failures: Prioritize logging failed logons (Event ID
B
for RFC,A
for dialog) for all users, as these are often more indicative of an attack.
- Filter by User Type: Only log successful logons for dialog users (
- Focus on High-Value Events:
- Ensure critical events are logged: Transaction Starts (
T
) for sensitive Tcodes (SU01
,PFCG
,RZ10
,SM59
,SE16
,SM49
, etc.), User Master Record Changes (U
), Security Profile Parameter Changes (E
), RFC Calls (B
). - Consider not logging verbose but non-critical events (e.g., specific reports that run very frequently but are not security-sensitive).
- Ensure critical events are logged: Transaction Starts (
- Action: In
- Filter by Client/User Group: If certain clients or user groups are "low-risk" or generate excessive noise, consider creating specific filters to exclude them or reduce the granularity of logging for them.
- Activate Profile: After adjusting filters, ensure the new audit profile is activated in
SM19
.
- Refine Event Filters:
-
Additional Steps for Log Storage and Alert Signal-to-Noise Ratio:
- Increase Audit File Size and Number:
- Action: Adjust profile parameters
rsau/max_diskspace/local
(total disk space for local audit files) andrsau/local/file
(individual file size) inRZ10
. Increase these to allow fewer, larger files, reducing overhead and allowing longer local retention. - Rationale: Provides more local buffer before files are sent to the central audit log.
- Action: Adjust profile parameters
- Central Audit Log (
rsau/collect_all_sids
):- Action: If not already configured, set up a central audit log server (
rsau/collect_all_sids = 1
on the collector system,rsau/collector_host
on the systems being logged). This consolidates logs from multiple application servers to one location. - Rationale: Simplifies management, archiving, and analysis.
- Action: If not already configured, set up a central audit log server (
- Automated Archiving and Deletion:
- Action: Implement a regular background job (e.g., using
RSNU_ARCHIVE_SECURITY_AUDIT
orRSNUA000
) to:- Read audit files from the active directory (
DIR_AUDIT
). - Archive them to a dedicated, secure storage (e.g., an NFS share, a content repository, or a separate drive with sufficient space).
- Delete old files from the active directory after successful archiving, while ensuring the 3-month retention policy is met (e.g., keep 3 months of archived files).
- Read audit files from the active directory (
- Rationale: Ensures compliance and prevents filesystem overflow.
- Action: Implement a regular background job (e.g., using
- Integration with SIEM (Security Information and Event Management) System:
- Action: Forward SAP Security Audit Logs (and other relevant logs like Gateway logs, System Logs) to an external SIEM system (e.g., Splunk, QRadar, ArcSight). This usually involves configuring SAP to send syslog messages or using a dedicated connector/agent.
- Rationale:
- Centralized Storage & Long-Term Retention: SIEMs are designed for massive log storage and long-term retention beyond 3 months.
- Advanced Analytics & Correlation: SIEMs can correlate SAP logs with logs from OS, network, firewalls, and other applications, providing a more holistic view of security incidents and reducing false positives (improving signal-to-noise).
- Automated Alerting: Configure the SIEM to generate alerts only for truly suspicious or critical correlated events, rather than every successful logon.
- Review and Optimize Other Logging:
- Action: Review other SAP logs (e.g., Gateway logs
gw/logging
, System LogsSYSLOG
) to ensure they are not excessively verbose if not needed for critical security monitoring.
- Action: Review other SAP logs (e.g., Gateway logs
- Increase Audit File Size and Number:
-
This comprehensive approach helps balance the need for detailed security logging with system performance and storage efficiency.
Comments
Post a Comment