/[smecontribs]/rpms/smeserver-openvpn-s2s/contribs8/smeserver-openvpn-s2s-0.1-limit_network_delete_and_create.patch
ViewVC logotype

Contents of /rpms/smeserver-openvpn-s2s/contribs8/smeserver-openvpn-s2s-0.1-limit_network_delete_and_create.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Mar 3 21:10:29 2013 UTC (11 years, 8 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-openvpn-s2s-0_1-21_el5_sme, smeserver-openvpn-s2s-0_1-22_el5_sme, smeserver-openvpn-s2s-0_1-25_el5_sme, smeserver-openvpn-s2s-0_1-26_el5_sme, smeserver-openvpn-s2s-0_1-24_el5_sme, smeserver-openvpn-s2s-0_1-23_el5_sme, smeserver-openvpn-s2s-0_1-27_el5_sme, HEAD
Error occurred while calculating annotation data.
Initial import

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-openvpn-s2s-0.1/root/etc/e-smith/events/actions/openvpn-s2s-delete-networks mezzanine_patched_smeserver-openvpn-s2s-0.1/root/etc/e-smith/events/actions/openvpn-s2s-delete-networks
2 --- smeserver-openvpn-s2s-0.1/root/etc/e-smith/events/actions/openvpn-s2s-delete-networks 2010-10-16 17:56:47.000000000 +0200
3 +++ mezzanine_patched_smeserver-openvpn-s2s-0.1/root/etc/e-smith/events/actions/openvpn-s2s-delete-networks 2010-10-16 23:47:20.000000000 +0200
4 @@ -20,18 +20,37 @@
5 #----------------------------------------------------------------------
6
7 use strict;
8 +use esmith::ConfigDB;
9 use esmith::NetworksDB;
10 use esmith::event;
11
12 my $db = esmith::NetworksDB->open || die "Couldn't open netwoks db\n";
13 +my $ovpndb = esmith::ConfigDB->open_ro('openvpn-s2s') || die "Couldn't open openvpn-s2s db\n";
14 my @nets = $db->networks;
15 +my @vpnnets = ();
16 +my $vpnnet;
17 +
18 +# buils a list of network used by a VPN daemon
19 +foreach my $vpn ($ovpndb->get_all_by_prop(type=>'server'),
20 + $ovpndb->get_all_by_prop(type=>'client')){
21 + $vpnnet = $vpn->prop('RemoteNetworks') || '';
22 + if ($vpnnet ne ''){
23 + my ($vpnnet,undef) = split(/\//, $vpnnet);
24 + push @vpnnets, $vpnnet;
25 + }
26 + push @vpnnets, $vpn->prop('RemoteIP');
27 +}
28
29 foreach my $net (@nets){
30 my $key = $net->key;
31 my $vpn = $db->get_prop($key,"VPN") || '';
32 +
33 if ($vpn ne ''){
34 - $db->set_prop($key, type=>'network-deleted');
35 - event_signal("network-delete","$key");
36 + unless (grep{ $_ eq $key} @vpnnets){
37 + $db->set_prop($key, type=>'network-deleted');
38 + event_signal("network-delete","$key");
39 + $db->get($key)->delete;
40 + }
41 }
42 }
43
44 diff -Nur -x '*.orig' -x '*.rej' smeserver-openvpn-s2s-0.1/root/etc/openvpn/s2s/bin/up mezzanine_patched_smeserver-openvpn-s2s-0.1/root/etc/openvpn/s2s/bin/up
45 --- smeserver-openvpn-s2s-0.1/root/etc/openvpn/s2s/bin/up 2010-10-16 17:56:47.000000000 +0200
46 +++ mezzanine_patched_smeserver-openvpn-s2s-0.1/root/etc/openvpn/s2s/bin/up 2010-10-16 23:55:50.000000000 +0200
47 @@ -25,12 +25,22 @@
48 net="route_network_$N"
49 mask="route_netmask_$N"
50 if [ ! -z "${!net}" ]; then
51 - /sbin/e-smith/db networks set ${!net} network Mask ${!mask} Router $ifconfig_remote VPN $vpnid
52 - /sbin/e-smith/signal-event network-create ${!net}
53 + db=$(/sbin/e-smith/db networks getprop ${!net} VPN)
54 + if [ ! -z $db ]; then
55 + # if the network already exists in the DB, just push the route
56 + /sbin/route add -net $net netmask $mask gw $ifconfig_remote
57 + else
58 + /sbin/e-smith/db networks set ${!net} network Mask ${!mask} Router $ifconfig_remote VPN $vpnid
59 + /sbin/e-smith/signal-event network-create ${!net}
60 + fi
61 fi
62 done
63
64 -# In any cas, create a local network for the VPN itself
65 -/sbin/e-smith/db networks set $ifconfig_remote network Mask 255.255.255.255 VPN $vpnid
66 -/sbin/e-smith/signal-event network-create $ifconfig_remote
67 +
68 +# Check route for the VPN itself
69 +db=$(/sbin/e-smith/db networks getprop $ifconfig_remote VPN)
70 +if [ -z $db ]; then
71 + /sbin/e-smith/db networks set $ifconfig_remote network Mask 255.255.255.255 VPN $vpnid
72 + /sbin/e-smith/signal-event network-create $ifconfig_remote
73 +fi
74

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed