diff options
author | Micah Anderson <micah@riseup.net> | 2013-08-10 21:32:48 +0200 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2013-08-10 21:32:48 +0200 |
commit | 21da13b26af0a695dcd040c385f13536caa95ce6 (patch) | |
tree | 743778e6a995749b2e3e82dae909565aad6149dc | |
parent | a70f43599a375c22f4c474ea9add49684efcda6b (diff) | |
parent | 36f1100cd8fd53fe47b417ec4ec064a63368ab08 (diff) |
-rw-r--r-- | manifests/base.pp | 4 | ||||
-rw-r--r-- | templates/scripts/info.sh.erb | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/manifests/base.pp b/manifests/base.pp index b5742c3..e0f3d18 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -53,6 +53,10 @@ class strongswan::base { content => "#!/bin/bash\n${strongswan::binary} status | grep INSTALLED | awk -F\\{ '{ print \$1 }'\n", notify => undef, mode => '0500'; + "/usr/local/sbin/${binary_name}_info": + content => template('strongswan/scripts/info.sh.erb'), + notify => undef, + mode => '0500'; "/usr/local/sbin/${binary_name}_start_unconnected": content => template('strongswan/scripts/start_unconnected.sh.erb'), notify => undef, diff --git a/templates/scripts/info.sh.erb b/templates/scripts/info.sh.erb new file mode 100644 index 0000000..d48a97e --- /dev/null +++ b/templates/scripts/info.sh.erb @@ -0,0 +1,8 @@ +#!/bin/bash +connected=`<%= scope.lookupvar('strongswan::base::binary_name') %>_connected_hosts` +grep -El '^conn' /etc/ipsec.d/hosts/* | while read line; do + host=`basename $line '.conf'` + echo $connected | grep -q $host + ([ $? -eq 0 ] && echo "+ ${host}") || echo " ${host}" +done + |