How to dis/connect VPN from shell?



  • Hi everyone, thanks in advance for your help!

    We have an IPSec VPN with one of our customers (Checkpoint on the other side) that suddenly loses one of it's SA -shown in the IPSec status page- and we have to manually re-connect the VPN. Imagine what a distress that causes in our team and developers on a saturday morning (specially our IT team!).

    So I created a script to be executed with 'cron' but it doesn't seem to work. It only makes thing worse! The whole VPN goes down.

    Here's the script:

    #!/bin/sh
    
    /usr/local/sbin/ipsec down con6000
    sleep 3
    /usr/local/sbin/ipsec up con6000
    /usr/local/sbin/ipsec route con6000
    
    

    So I'm wondering… how could I create a script to disconnect and reconnect the VPN? The URL that reconnects the VPN in the web admin is: https://pfsense.firewall/status_ipsec.php?act=connect&ikeid=6000

    Any help and hints you could provide will be very much appreciated!

    Thanks!!


Log in to reply