Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    OpenVPN Backup Script

    Scheduled Pinned Locked Moved OpenVPN
    2 Posts 1 Posters 4.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      b00gz
      last edited by

      Guys,

      I currently am using a windows box to run this script to backup firewalls.  What I would like to do (can be done in Linux or Windows) is use a computer and have it have OpenVPN client certs and have it connect to client 1 backup the firewall and then disconnect … next connect to client 2 backup the firewall and then disconnect.  Anyone have any ideas on how I can script connects and disconnects ... like I said this can be done in Linux or Windows (preferable Linux).  All help is appreciated.

      FOR /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do SET tmpdt=%%a-%%b-%%c
      wget -q --post-data=Submit=download --http-user=username --http-passwd=password --no-check-certificate https://10.0.0.1:10443/diag_backup.php -O "D:\backups\firewall%tmpdt%-firewall-config.xml"

      1 Reply Last reply
      Reply Quote 0
      • B
        b00gz
        last edited by

        Still would like to know how to do this in Linux but I figured it out in Windows.  I am going to try some more with Linux later tonight.

        I downloaded PSKill for windows and was able to accomplish this by using 2 scripts.  Run the Connect_Script then Run Disconnect_And_Backup_Script 10 seconds or so after.

        PSKill can be downloaded here http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx

        Connect_Script.bat
        openvpn –config "C:\path\to\file.ovpn"

        Disconnect_And_Backup_Script.bat
        FOR /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do SET tmpdt=%%a-%%b-%%c
        wget -q --post-data=Submit=download --http-user=username --http-passwd=password --no-check-certificate https://IP:PORT/diag_backup.php -O "C:\path\to\backup%tmpdt%-firewall-config.xml"
        pskill openvpn.exe

        1 Reply Last reply
        Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
        Privacy Policy · Cookie Policy