Skip to main content

Connect to SAP in a private network through a proxy

If your SAP system is reachable only inside a private network, deploy an authenticated forward proxy on a VM so Glasslake test executions can reach it. SAP stays off the public internet, because access to the proxy is also private.

▶ Video space reservedConnect to SAP in a private network through a proxy

How the proxy works​

Glasslake routes all cloud browser traffic through the proxy. The proxy authenticates each request, checks that the destination is on the allowlist, and forwards the connection to SAP over the private network.

FromToConnection
Glasslake cloud browserProxy VM (public IP, port 3128)HTTPS with authentication
Proxy VMSAP Fiori (private IP)TCP tunnel over the private network

Access is controlled at two independent layers: firewall rules control which ports are reachable on the VM, and proxy access rules control who can connect and which destinations they can reach.

Squid is the recommended implementation and is documented below. Nginx, Apache HTTPD, and HAProxy are also supported if they provide authenticated forward proxying, destination allowlisting, and secure exposure on a public endpoint.

Before you begin​

RequirementDetails
VM with public IPAWS EC2, GCP Compute Engine, Azure VM, or equivalent, with a static public IP. On-premise VMs (VMware, Hyper-V, KVM) need a public IP or NAT.
OSUbuntu 22.04 LTS (recommended) or Ubuntu 20.04.
VM sizeAt least 1 vCPU and 1 GB RAM for testing; 2 vCPU and 2 GB RAM for production.
Network positionTCP connectivity from the VM to the SAP host on its port (commonly 443, 44300, or 8443). Place the VM in the same network as SAP or use a site-to-site VPN.
Firewall accessInbound port 3128 open to 0.0.0.0/0. Inbound port 22 restricted to your admin IP.
SSH accessSSH key or password access to the VM.

Install and configure Squid​

Run these commands on the VM over SSH. All of them need sudo.

  1. Update the system and install Squid and apache2-utils (which provides htpasswd):

    sudo apt-get update -y
    sudo apt-get install squid apache2-utils -y
  2. Back up the default configuration:

    sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
  3. Create the proxy credentials file. Replace YOUR_USERNAME with your proxy user name, and enter a password when prompted:

    sudo htpasswd -c /etc/squid/passwd YOUR_USERNAME
    sudo chown proxy:proxy /etc/squid/passwd
    sudo chmod 640 /etc/squid/passwd
    warning

    Port 3128 is open to the public internet. Use a password of at least 16 characters with mixed case, numbers, and symbols, and keep it private.

  4. Write /etc/squid/squid.conf. Replace SAP_PRIVATE_IP with the private IP of your SAP system and SAP_PORT with its port:

    # Glasslake HTTP Proxy Connector
    http_port 3128

    # Basic authentication
    auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
    auth_param basic realm Glasslake_Secure_Proxy
    auth_param basic credentialsttl 2 hours
    auth_param basic casesensitive on

    # Method and port ACLs
    acl CONNECT method CONNECT
    acl SSL_ports port 443
    acl SSL_ports port SAP_PORT
    acl Safe_ports port 80
    acl Safe_ports port 443
    acl Safe_ports port SAP_PORT

    # Authentication ACL
    acl authenticated proxy_auth REQUIRED

    # Allowed destinations
    acl sap_target dst SAP_PRIVATE_IP
    acl aws_checkip dstdomain checkip.amazonaws.com

    # Access rules: order is critical
    http_access deny !Safe_ports
    http_access deny CONNECT !SSL_ports
    http_access deny !authenticated
    http_access allow authenticated sap_target
    http_access allow authenticated aws_checkip
    http_access deny all
  5. Validate the configuration. The command must return no errors:

    sudo squid -k parse
  6. Apply and enable Squid:

    sudo systemctl reload squid
    sudo systemctl enable squid
    sudo systemctl status squid
  7. In your VM's firewall or security group, allow inbound TCP 3128 from 0.0.0.0/0 and inbound TCP 22 from your admin IP only. Deny all other inbound ports.

Validate the connection​

Run these tests from any machine with internet access. Replace the placeholders with your values.

  1. Send a request without credentials. It must return 407 Proxy Authentication Required:

    curl -v -k -x http://<PROXY_IP>:3128 -I "https://<SAP_PRIVATE_IP>:<SAP_PORT>/<SAP_PATH>"
  2. Send a request with credentials. It must return 200 Connection established, and a second 200 from SAP means the application is reachable:

    curl -v -k -x http://<USERNAME>:<PASSWORD>@<PROXY_IP>:3128 -I "https://<SAP_PRIVATE_IP>:<SAP_PORT>/<SAP_PATH>"
  3. Send a request to a destination that isn't allowlisted. It must return 403 Forbidden:

    curl -v -k -x http://<USERNAME>:<PASSWORD>@<PROXY_IP>:3128 -I "https://www.google.com"

To watch live traffic, run sudo tail -f /var/log/squid/access.log. TCP_TUNNEL/200 means traffic is flowing to SAP, TCP_DENIED/407 means credentials were missing or invalid, and TCP_DENIED/403 means the destination isn't allowlisted.

Share the connection details with Glasslake​

FieldDescription
Proxy server URLPublic IP or hostname of the VM on port 3128, in the format http://<ip>:3128.
Proxy usernameThe user name you created.
Proxy passwordThe password you created.
SAP URLThe full internal URL of the SAP application, used to verify end-to-end connectivity.
SAP usernameAn SAP user with the minimum permissions needed for integration and validation tests.
SAP passwordThe password for that SAP user.
warning

Share passwords only through your approved secure secret-sharing channel. Never paste them into email, chat, or documents.

Harden and maintain the proxy​

  • Restrict port 22 to your admin IP. Don't leave SSH open to 0.0.0.0/0.
  • Create a separate proxy user per client or per Glasslake project, so you can revoke access individually.
  • Keep the sap_target allowlist as specific as possible. Prefer single IPs over subnet ranges.
  • Install fail2ban with a Squid filter to block IPs that generate repeated 407 responses.
  • Keep Squid access logs for at least 30 days, and consider shipping them to CloudWatch, Datadog, or an equivalent.

To rotate or revoke credentials, run the following, then reload Squid:

# Update the password for an existing user
sudo htpasswd /etc/squid/passwd YOUR_USERNAME

# Delete a user (revokes access immediately)
sudo htpasswd -D /etc/squid/passwd YOUR_USERNAME
sudo systemctl reload squid

Troubleshooting​

SymptomLikely causeAction
407 with valid credentialsThe credentials file has the wrong permissions or path.Run echo "user pass" | sudo /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd. It must return OK.
Connection refused on port 3128Squid isn't running, or the firewall blocks the port.Run sudo systemctl status squid and check the inbound rule for 3128.
200 from the proxy but no SAP responseSAP isn't reachable from the VM.On the VM, run nc -vz <SAP_IP> <SAP_PORT>. It must succeed.
403 for the SAP destinationThe sap_target IP or the port doesn't match.Check that acl sap_target dst matches exactly and that the SAP port is in both SSL_ports and Safe_ports.
Squid fails to reloadConfiguration syntax error.Run sudo squid -k parse and fix the reported errors.
Authentication isn't enforcedhttp_access deny !authenticated is missing or in the wrong place.Make sure it appears before any http_access allow rule.

See also​