initial commit of file from CVS for smeserver-openvpn-routed on Thu 6 Mar 14:40:52 GMT 2025
This commit is contained in:
25
root/etc/e-smith/events/actions/openvpn-routed-delete-net
Normal file
25
root/etc/e-smith/events/actions/openvpn-routed-delete-net
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::NetworksDB;
|
||||
use esmith::event;
|
||||
|
||||
my $c = esmith::ConfigDB->open_ro || die "Couldn't open config db\n";
|
||||
my $n = esmith::NetworksDB->open || die "Couldn't open netwoks db\n";
|
||||
my @nets = $n->networks;
|
||||
my $ovpn = $c->get('openvpn-routed');
|
||||
my $net = $ovpn->prop('Network') || '192.168.29.0/255.255.255.0';
|
||||
my ($vpnnet,$mask) = split /\//, $net;
|
||||
|
||||
foreach my $net (@nets){
|
||||
my $key = $net->key;
|
||||
my $vpn = $n->get_prop($key,"VPNRouted") || '';
|
||||
|
||||
if ($vpn eq 'yes'){
|
||||
unless ($key eq $vpnnet){
|
||||
$n->set_prop($key, type=>'network-deleted');
|
||||
event_signal("network-delete","$key");
|
||||
$n->get($key)->delete;
|
||||
}
|
||||
}
|
||||
}
|
7
root/etc/e-smith/events/actions/openvpn-routed-jail
Normal file
7
root/etc/e-smith/events/actions/openvpn-routed-jail
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#copy any files needed for the jail
|
||||
|
||||
#be sure we have the needed timezone
|
||||
/bin/cp -L /etc/localtime /etc/openvpn/routed/etc
|
||||
|
32
root/etc/e-smith/events/actions/openvpn-routed-update-crl
Normal file
32
root/etc/e-smith/events/actions/openvpn-routed-update-crl
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL=$(/sbin/e-smith/db configuration getprop openvpn-routed CrlUrl)
|
||||
DOMAIN=$(/sbin/e-smith/db configuration get DomainName)
|
||||
|
||||
if [ -z $URL ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/usr/bin/wget $URL -O /tmp/cacrl_routed.pem > /dev/null 2>&1
|
||||
|
||||
/usr/bin/openssl crl -inform PEM -in /tmp/cacrl_routed.pem -text > /dev/null 2>&1
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
/bin/mv -f /tmp/cacrl_routed.pem /etc/openvpn/routed/pub/cacrl.pem > /dev/null 2>&1
|
||||
else
|
||||
cat > /tmp/crlmail_routed <<END
|
||||
|
||||
An error occured while updating the CRL for OpenVPN-Routed
|
||||
because openssl didn't recognize the file as a valid CRL.
|
||||
Below is the copy of the latest CRL downloaded from
|
||||
$URL
|
||||
|
||||
|
||||
END
|
||||
|
||||
cat /tmp/cacrl_routed.pem >> /tmp/crlmail_routed
|
||||
mail -s 'CRL update failed' admin@$DOMAIN < /tmp/crlmail_routed
|
||||
fi
|
||||
|
||||
rm -f /tmp/cacrl_routed.pem
|
||||
rm -f /tmp/crlmail_routed
|
Reference in New Issue
Block a user