initial commit of file from CVS for smeserver-openvpn-bridge on Sat Sep 7 19:57:25 AEST 2024
This commit is contained in:
6
root/etc/e-smith/events/actions/openvpn-bridge-jail
Normal file
6
root/etc/e-smith/events/actions/openvpn-bridge-jail
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
#copy any files needed for the jail
|
||||
|
||||
#be sure we have the needed timezone
|
||||
/bin/cp -L /etc/localtime /etc/openvpn/bridge/etc
|
39
root/etc/e-smith/events/actions/openvpn-bridge-reload-ccd
Normal file
39
root/etc/e-smith/events/actions/openvpn-bridge-reload-ccd
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
use esmith::ConfigDB;
|
||||
my $config_db = esmith::ConfigDB->open_ro();
|
||||
my $db_rules = esmith::ConfigDB->open_ro('openvpn-bridge');
|
||||
my @rules = $db_rules->get_all_by_prop(type => 'rule');
|
||||
my $netmask = $config_db->get('LocalNetmask')->value;
|
||||
my $userAuth = ${'openvpn-bridge'}{userAuth};
|
||||
|
||||
my $ccd = "/etc/openvpn/bridge/ccd";
|
||||
unlink <$ccd/*>;
|
||||
|
||||
foreach (@rules){
|
||||
my $rule = $_->key;
|
||||
my $rec_rule = $db_rules->get("$rule");
|
||||
my $ip = $rec_rule->prop('ip') || '';
|
||||
my $redirectGW = $rec_rule->prop('redirectGW') || 'disabled';
|
||||
my $access = $rec_rule->prop('access') || 'allowed';
|
||||
unless (open (CCD, ">$ccd/$rule")){
|
||||
die "Error opening $ccd/$rule";
|
||||
}
|
||||
|
||||
if ($ip ne ''){
|
||||
print CCD "--ifconfig-push $ip $netmask\n";
|
||||
}
|
||||
else{
|
||||
print CCD "# No fixed IP defined\n";
|
||||
}
|
||||
if ($access eq 'denied'){
|
||||
print CCD "--disable\n";
|
||||
}
|
||||
if ($redirectGW eq 'enabled'){
|
||||
print CCD "push \"redirect-gateway def1\"\n";
|
||||
}
|
||||
close CCD;
|
||||
}
|
||||
|
||||
|
29
root/etc/e-smith/events/actions/openvpn-bridge-update-crl
Normal file
29
root/etc/e-smith/events/actions/openvpn-bridge-update-crl
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL=$(/sbin/e-smith/db configuration getprop openvpn-bridge CrlUrl)
|
||||
DOMAIN=$(/sbin/e-smith/db configuration get DomainName)
|
||||
|
||||
/usr/bin/wget $URL -O /tmp/cacrl.pem > /dev/null 2>&1
|
||||
|
||||
/usr/bin/openssl crl -inform PEM -in /tmp/cacrl.pem -text > /dev/null 2>&1
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
/bin/mv -f /tmp/cacrl.pem /etc/openvpn/bridge/pub/cacrl.pem > /dev/null 2>&1
|
||||
else
|
||||
cat > /tmp/crlmail <<END
|
||||
|
||||
An error occured while updating the CRL for OpenVPN-Bridge
|
||||
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.pem >> /tmp/crlmail
|
||||
mail -s 'CRL update failed' admin@$DOMAIN < /tmp/crlmail
|
||||
fi
|
||||
|
||||
rm -f /tmp/cacrl.pem
|
||||
rm -f /tmp/crlmail
|
||||
|
Reference in New Issue
Block a user