Description
This article describes how to collect and read debug logs output from proxy service (WAD) when a connection attempt is made using ZTNA Access Proxy TCP-Forwarding with SAML Authentication.
Scope
FortiGate running FortiOS versions 7.0+, 7.2+, 7.4+
Solution
The following topology will be used while tracing the debug log entries.
![ztna-workflow.png ztna-workflow.png](/t5/image/serverpage/image-id/32745i824287B91543C7A8/image-dimensions/631x480/is-moderation-mode/true?v=v2)
To enable the debug level for the proxy service the following commands may be used.
diagnose wad debug enable all
diagnose debug application samld -1
diagnose debug enable
Note.
WAD debug filters may be applied to avoid impact on FortiGate System Resources depending on how much traffic is being proxied by this FortiGate
![wad-debug-filter.png wad-debug-filter.png](/t5/image/serverpage/image-id/32751iA15EB3050CA28A86/image-dimensions/769x357/is-moderation-mode/true?v=v2)
In this example, FortiClient received a ZTNA Destination to RDP to server 172.16.1.10:3389 via Proxy Gateway 192.168.10.43:8887.
![ztna-destination-example.png ztna-destination-example.png](/t5/image/serverpage/image-id/32752iB5B04CADF15DE5EA/image-dimensions/661x463/is-moderation-mode/true?v=v2)
- The endpoint performed an RDP connection to 172.16.1.10:3389. This connection is received from a client on the external IP and external port of ZTNA Server VIP.
![debug-wad-ztna-1.png debug-wad-ztna-1.png](/t5/image/serverpage/image-id/32753iFAB478169FFBFD44/image-size/large/is-moderation-mode/true?v=v2&px=999)
- FortiGate then requests a Client Certificate, which will be verified by EMS ZTNA Root CA of available EMS Connectors.
![debug-wad-ztna-2.png debug-wad-ztna-2.png](/t5/image/serverpage/image-id/32754iBE9C50E07008EBE5/image-size/large/is-moderation-mode/true?v=v2&px=999)
- Client provides Certificate. If it is not cached on FortiGate, its serial number is shown, and then verified by EMS ZTNA Root CA.
![debug-wad-ztna-3a.png debug-wad-ztna-3a.png](/t5/image/serverpage/image-id/32764i8E5ACE73B4529029/image-size/large/is-moderation-mode/true?v=v2&px=999)
- Client provides Certificate. If it is found in the cache, the action taken is from the cached result.
![debug-wad-ztna-3.png debug-wad-ztna-3.png](/t5/image/serverpage/image-id/32755i0CDA5CEEB527008A/image-size/large/is-moderation-mode/true?v=v2&px=999)
- TLS handshake is completed with WAD and the ticket is offered to the client
![debug-wad-ztna-4.png debug-wad-ztna-4.png](/t5/image/serverpage/image-id/32756iD2C1C9EC06BBEC12/image-size/large/is-moderation-mode/true?v=v2&px=999)
- The client makes the request once the TLS handshake has been completed and authenticated using its ZTNA certificate.
![debug-wad-ztna-5.png debug-wad-ztna-5.png](/t5/image/serverpage/image-id/32757i4827F4B7474ED397/image-size/large/is-moderation-mode/true?v=v2&px=999)
- The payload of requests from clients is decapsulated and then the following checks are done in order:
- API Gateway:
- Virtual Host and then Pattern.
- Real Server:
- FQDN (DNS query) and IP Address.
- Route lookup to check for destination reachability (if not, likely a '504 Gateway Timeout' is presented).
- Policy match starts and the source address and interface are checked.
![debug-wad-ztna-6.png debug-wad-ztna-6.png](/t5/image/serverpage/image-id/32758iC69A92310C08A2AE/image-size/large/is-moderation-mode/true?v=v2&px=999)
- Policy Matching continues after the source address and interface are checked.
- Device check:
- ZTNA Certificate Serial Number.
- ZTNA Tags.
- Authentication:
![debug-wad-ztna-7.png debug-wad-ztna-7.png](/t5/image/serverpage/image-id/32759i7DB6D8409CD4B364/image-size/large/is-moderation-mode/true?v=v2&px=999)
- The authentication process starts once the Authentication rule matches.
- SAML redirection and captive portal from FortiClient or External Browser is presented:
- For external browsers as user agents, saml-redirect must be enabled via CLI under saml api-gateway.
- After successful authentication with IdP and WAD, the original request is again sent with the SAML cookie.
![debug-wad-ztna-8.png debug-wad-ztna-8.png](/t5/image/serverpage/image-id/32760iC0AB8D9DB24F6F8D/image-size/large/is-moderation-mode/true?v=v2&px=999)
- After the authentication, the process is completed.
- FortiGate establishes the connection to the Real Server:
![debug-wad-ztna-9.png debug-wad-ztna-9.png](/t5/image/serverpage/image-id/32761iC0EA614E1F3F210D/image-size/large/is-moderation-mode/true?v=v2&px=999)
- Then upgrades connection, switches protocols if needed, and data starts passing between client and server protected via ZTNA Access Proxy:
![debug-wad-ztna-9c.png debug-wad-ztna-9c.png](/t5/image/serverpage/image-id/32763i1A2B0B47CACFC341/image-size/large/is-moderation-mode/true?v=v2&px=999)