Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
vribeiro
New Contributor II

Connect to VPN via CLI

Hey guys,

 

I'm trying to make a connection to a VPN via the forticlient CLI in Ubuntu, but I'm not able to make it work, can someone point me to the right direction.

 

I'm running the following command:

/opt/forticlient/forticlient-cli epctrl register destination_ip -p port

As stated here CLI support for FortiClient (Linux) | FortiClient 6.2.0 (fortinet.com).

But it always gives me the following output in the logs:

test.png

 

I would appreciate any help!

 

Thanks!

 

FortiClient

1 Solution
vribeiro
New Contributor II

For anyone using a VPN under CI/CD with this problem, you can use this software adrienverge/openfortivpn: Client for PPP+SSL VPN tunnel services (github.com), It helped me connect to the VPN and make my operations in the machine.

 

To run a command to connect and let it in the background:

openfortivpn -c /tmp/vpn-config > /tmp/vpn-output.log 2>&1 &;sleep 5
 
To kill the process before exiting:
kill $(ps -e | grep openfortivpn | awk '{print $1}'); sleep 2;

View solution in original post

3 REPLIES 3
earthlab
New Contributor III

Hi @vribeiro 


What FortiGate model and version do you use?

You can check Compatibility Chart.

https://fortinetweb.s3.amazonaws.com/docs.fortinet.com/v2/attachments/afec3249-ed3f-11ea-96b9-005056...

I guess you need to try new version , if your fortios is 6.4 or leter.
#note I don't know newer version are support cli mode or not.

vribeiro
New Contributor II

Thanks for your reply @earthlab, I'm sorry for the delay. I figured it out using a software like openfortivpn (adrienverge/openfortivpn: Client for PPP+SSL VPN tunnel services (github.com))

vribeiro
New Contributor II

For anyone using a VPN under CI/CD with this problem, you can use this software adrienverge/openfortivpn: Client for PPP+SSL VPN tunnel services (github.com), It helped me connect to the VPN and make my operations in the machine.

 

To run a command to connect and let it in the background:

openfortivpn -c /tmp/vpn-config > /tmp/vpn-output.log 2>&1 &;sleep 5
 
To kill the process before exiting:
kill $(ps -e | grep openfortivpn | awk '{print $1}'); sleep 2;
Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors