CPM / PSM - Network Port Requirements and Connectivity Checklist for SAP NetWeaver and S/4HANA
Symptom
When attempting to manage passwords via CPM or launch privileged sessions via PSM against an SAP NetWeaver or S/4HANA target, the connection fails with network or socket-level errors:
- RfcCommunicationException: WSAETIMEDOUT - Connection timed out
- WSAECONNREFUSED - Connection refused
- LOCATION: CPIC (TCP/IP) on local host with p: ... ERROR: partner <host>:<port> not reached
- Message Server connection failed: Service sapms<SID> unknown
Environment
12.6;14.0;14.2;14.6;15.2 Privileged Access Manager (PAM, self-hosted);Privilege Cloud Central Policy Manager (CPM);Privileged Session Management (PSM);Secrets Rotation Service (SRS)
SAP NetWeaver AS ABAP
SAP S/4HANA (On-Premises, RISE with SAP, SAP Cloud Appliance Library on AWS/Azure)
Cause
Connecting to modern SAP systems involves multiple distinct network layers depending on the configured RFC connection type (Direct, Message Server load balancing, SAProuter proxy, and SNC encryption).
Common connectivity pitfalls include:
1. Firewall / Cloud Security Group Restrictions: Default cloud appliance and enterprise firewalls block SNC (port 48xx), Message Server (port 36xx), and SAProuter (port 3299).
2. The Message Server Port 3600 vs 3601 Trap: Standard SAP formulas calculate the Message Server port as "3600 + Central Instance System Number". In modern S/4HANA and multi-tier architectures (including SAP Cloud Appliance Library), the Message Server runs on the ASCS instance (Central Services, typically "SYSNR 01"), listening on TCP port 3601, not port 3600.
3. Missing Windows 'services' file mapping: When connecting via Message Server, the client operating system must resolve the service name 'sapms<SID>' to its corresponding TCP port.
4. SNC Port Differentiation: Standard RFC connections target port '33xx', whereas SNC-secured RFC connections require port '48xx'. Opening port '33xx' alone is insufficient when 'UseSNC=Yes' is specified.
Resolution
### 1. Master SAP Port Matrix
Ensure all required firewall rules and cloud access points (AWS Security Groups, Azure NSG, local firewalls) are open between the CPM/PSM servers and the SAP application tier:
| Port | Protocol | SAP Component / Service | When Required | Notes |
|:---:|:---:|:---|:---|:---|
| 32xx | TCP | SAP Dispatcher ('sapdp<SYSNR>') | PSM SAP GUI sessions | e.g. Port '3200' for System Number '00'. |
| 33xx | TCP | RFC Gateway ('sapgw<SYSNR>') | Standard CPM Direct RFC | e.g. Port '3300' for System Number '00'. |
| 48xx | TCP | SNC RFC Gateway ('sapgw<SYSNR>s') | CPM Direct RFC with 'UseSNC=Yes' | e.g. Port '4800' for System Number '00'. Must be opened separately from port 3300. |
| 36xx | TCP | ABAP Message Server ('sapms<SID>') | CPM Message Server connections | Runs on ASCS instance. e.g., Port '3601' if ASCS is '01'. |
| 3299 | TCP | SAProuter ('sapdp99') | Connections routed via SAProuter proxy | Default SAProuter listening port. |
*(Note: '<SYSNR>' represents the two-digit SAP System Number, e.g., '00', '01', '10').*
---
### 2. Client Windows 'services' File Configuration
When utilizing Message Server load-balanced connections (Logon Groups like 'PUBLIC'), the Windows CPM server must resolve the SAP Message Server service name.
1. On the CPM and PSM servers, navigate to:
===
C:\Windows\System32\drivers\etc\
===
2. Open the 'services' file in an elevated text editor (Run as Administrator).
3. Append the service entry for each target SAP System ID (SID) and its ASCS Message Server port:
===
sapms<SID> 36<ASCS_SYSNR>/tcp
===
*Example for System 'S4H' with ASCS instance '01':*
===
sapmsS4H 3601/tcp
===
4. Save the file. (Reboot is not required; service lookups resolve immediately).
> Warning: Never map arbitrary dummy entries in the 'services' file for non-existent SIDs, as this can cause diagnostic connectivity tests to misroute.
---
### 3. Verifying Port Reachability from CPM / PSM
#### Option A: Using the Automated Health-Check Script ('Test-SapHealthCheck.ps1')
CyberArk provides a standalone PowerShell diagnostic tool, 'Test-SapHealthCheck.ps1', designed to run on customer CPM/PSM hosts or jump boxes with zero dependencies on Visual Studio or CyberArk services.
1. Download or copy 'Test-SapHealthCheck.ps1' to the CPM/PSM server.
2. Run standard DNS and port validation (no SAP DLLs required):
In powershell, run the command below:
===
.\Test-SapHealthCheck.ps1 -AsHost "<SAP_AppServer_Host_or_IP>" -SystemNumber 00 -MsPort 3601
===
3. To include an end-to-end NCo RFC Ping (validates network + RFC gateway response):
In powershell, run the command below:
===
.\Test-SapHealthCheck.ps1 -AsHost "<SAP_AppServer_Host_or_IP>" -SystemNumber 00 -MsPort 3601 `
-SapNcoPath "C:\CyberArk\Password Manager\bin"
===
4. For SNC-enabled targets:
In powershell, run the command below:
===
.\Test-SapHealthCheck.ps1 -AsHost "<SAP_AppServer_Host_or_IP>" -SystemNumber 00 -MsPort 3601 `
-SapNcoPath "C:\CyberArk\Password Manager\Vault\SAP_SNC" -SncEnabled -SncPartnerName "p:CN=<SAP_SID>"
===
*The script outputs a color-coded status check and produces a formatted diagnostic block ready to attach to a CyberArk Support ticket.*
#### Option B: Manual Verification via Built-in PowerShell Cmdlets
Before deploying or troubleshooting CPM plugins, test network reachability manually:
In powershell, run the command below:
===
# Test RFC Gateway (Direct connection)
Test-NetConnection -ComputerName "<SAP_Host_or_IP>" -Port 3300
# Test SNC-secured RFC Gateway
Test-NetConnection -ComputerName "<SAP_Host_or_IP>" -Port 4800
# Test Message Server (ASCS)
Test-NetConnection -ComputerName "<SAP_MessageServer_Host_or_IP>" -Port 3601
# Test SAProuter
Test-NetConnection -ComputerName "<SAProuter_Host_or_IP>" -Port 3299
===
All commands must return 'TcpTestSucceeded : True'. If any test returns 'False', engage the customer's network/cloud team to open the corresponding port.
---
### 4. Linux SAProuter Startup Precaution (For Administrators Hosting SAProuter on Linux)
If the customer hosts SAProuter on Linux (e.g. SLES / RHEL) and encounters immediate process crashes upon launching 'saprouter':
- The SAP kernel dynamic linker requires 'LD_LIBRARY_PATH' to resolve ICU libraries ('libicuuc.so', 'libicui18n.so').
- Ensure the startup script or systemd service exports the kernel directory:
bash
===
export LD_LIBRARY_PATH=/usr/sap/<SID>/D<INST>/exe:$LD_LIBRARY_PATH
saprouter -r -K "p:CN=<SAProuter_Identity>"
===
---
## Related Knowledge Base Articles & Documentation
- CyberArk Docs: *SAP NetWeaver and S/4HANA Account Management*
- SAP Note 128447: *Trusted/trusting systems network requirements*
- SAP Community: *SAP S/4HANA Fully-Activated Appliance Open Ports and Connectivity Guide*