Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Astaro StrongSWAN ipsec wrapper script

Uploaded in this post is a script file  vpn.sh.txt.
(.txt extension so uploader would let me upload.)

The file has instructions on even how to put it onto your Astaro device through the Terminal.

This script makes it a bit more human friendly to manage and monitor the IPSec VPN connections. But the BEST thing is this: I've had problems with 1 or 2 (out of 30) VPN connections that would go down and stay down until I manually reset them. So one thing this script can do is "monitor" a specific connection and automatically reset it if it detects that it is down.

Quite annoying and may or may not be related to Astaro.. threads seem to try to point fingers at certain types of Cisco routers.

Anyway, because the Astaro router is so brilliantly deployed on a Linux system, that allows Linux folks to fix things and make improvements without having to wait for or get denied by Support. 

In order to do this, you have to SSH into the router and then log into the 'root' account. Doing this will certainly not be supported by their support, however I have had very little that is actually supported from them so doing it by utilizing Linux itself is much more supportable on the Internet. I feel it is almost a crime to provide this router on Linux and start closing down those doors if they choose to do it. Instead of providing means for Linux experts to customize their Astaro functionality, they create roadblocks to prevent it.

So give this script a shot. I'm using it. I may post updates to any fixes if I find them.


This thread was automatically locked due to age.
Parents
  • Interesting...

    I used simply the way of deactivating a connection and comparing "vpn.sh status" before and after.

    Of course, the way of simply copy/paste from that "cc" thing doesn't work as the connections are missing the leading "S_" and trailing "_0" (or higher number).

    But, at least, it's something :-)

    I am now using your script to monitor 4 connections (or 3 connections, one has to connections _0 and _1) where we always have problems and it seems to work like a charm!

    Thanks for the script.

    Oh, btw, isn't the recommended way to look for an empty string "-z STRING" instead of "STRING == ''"?
    (just nipicking [;)] )

    Thanks & Ciao,
    Alfred

  • I used simply the way of deactivating a connection and comparing "vpn.sh status" before and after.

    One note...  it takes a bit of time before ipsec status determines a connection is down before it actually is down, so there could be a delay in that status output.

    Of course, the way of simply copy/paste from that "cc" thing doesn't work as the connections are missing the leading "S_" and trailing "_0" (or higher number).

    But, at least, it's something :-)

    I'm trying to tell you that you don't need to worry about the "S_" thing. It will work with or without it. And all the time the output does show the "_0" at the end because those are specific tunnels. If one of your VPN connections has multiple tunnels in it, you'll see "_1", etc. You do not need to remove those. Copying that whole thing does work. Unless maybe you're trying on a new Astaro version and they changed something? What version are you using this with? And please verify that you really do need to manipulate those names before they actually work.

    I am now using your script to monitor 4 connections (or 3 connections, one has to connections _0 and _1) where we always have problems and it seems to work like a charm!

    Thanks for the script.

    Awesome. Makes me very happy to help make someone's life easier.


    Oh, btw, isn't the recommended way to look for an empty string "-z STRING" instead of "STRING == ''"?
    (just nipicking [;)] )

    Yes it is. However the == ""  does function correctly, so whenever possible I prefer to write code that is most easily read, rather than using some special code or option that someone would have to look up to remember what it means. While the == "" is clearly obvious to anyone who may not even know the scripting language.
Reply

  • I used simply the way of deactivating a connection and comparing "vpn.sh status" before and after.

    One note...  it takes a bit of time before ipsec status determines a connection is down before it actually is down, so there could be a delay in that status output.

    Of course, the way of simply copy/paste from that "cc" thing doesn't work as the connections are missing the leading "S_" and trailing "_0" (or higher number).

    But, at least, it's something :-)

    I'm trying to tell you that you don't need to worry about the "S_" thing. It will work with or without it. And all the time the output does show the "_0" at the end because those are specific tunnels. If one of your VPN connections has multiple tunnels in it, you'll see "_1", etc. You do not need to remove those. Copying that whole thing does work. Unless maybe you're trying on a new Astaro version and they changed something? What version are you using this with? And please verify that you really do need to manipulate those names before they actually work.

    I am now using your script to monitor 4 connections (or 3 connections, one has to connections _0 and _1) where we always have problems and it seems to work like a charm!

    Thanks for the script.

    Awesome. Makes me very happy to help make someone's life easier.


    Oh, btw, isn't the recommended way to look for an empty string "-z STRING" instead of "STRING == ''"?
    (just nipicking [;)] )

    Yes it is. However the == ""  does function correctly, so whenever possible I prefer to write code that is most easily read, rather than using some special code or option that someone would have to look up to remember what it means. While the == "" is clearly obvious to anyone who may not even know the scripting language.
Children
No Data