FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
sinanalshoker
Article Id 331876
Description This article describes how to recover an IPsec pre-shared key in plain text format using the FortiGate API.
Scope All supported versions of FortiOS.
Solution

Note: This article assumes that the admin has an IPsec tunnel set up with a pre-shared key defined, but has forgotten the actual plain text of that key. For demonstration purposes, this article will use a VPN tunnel with a pre-shared key of 'My_PSK'.

Although the pre-shared key 'My_PSK' is known for this example, the focus is to help the admin recover the pre-shared key in plain text format.

 

First, log in into the FortiGate GUI using the super_admin profile

 

FGT.png

 

Next, open a new tab in the browser (such as FireFox or Google Chrome) and use the following path to obtain the PSK in plain text:

 

https://FortiGate_IP/api/v2/cmdb/vpn.ipsec/phase1-interface?plain-text-password=1

 

Retreived_PSK.png