1 |
unnilennium |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/openvpn-bridge mezzanine_patched_smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/openvpn-bridge |
2 |
|
|
--- smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/openvpn-bridge 2008-09-02 23:13:34.000000000 +0200 |
3 |
|
|
+++ mezzanine_patched_smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/openvpn-bridge 1970-01-01 01:00:00.000000000 +0100 |
4 |
|
|
@@ -1,239 +0,0 @@ |
5 |
|
|
-#!/bin/sh |
6 |
|
|
-# |
7 |
|
|
-# openvpn This shell script takes care of starting and stopping |
8 |
|
|
-# openvpn on RedHat or other chkconfig-based system. |
9 |
|
|
-# |
10 |
|
|
-# chkconfig: 345 24 76 |
11 |
|
|
-# |
12 |
|
|
-# description: OpenVPN is a robust and highly flexible tunneling application that |
13 |
|
|
-# uses all of the encryption, authentication, and certification features |
14 |
|
|
-# of the OpenSSL library to securely tunnel IP networks over a single |
15 |
|
|
-# UDP port. |
16 |
|
|
-# |
17 |
|
|
- |
18 |
|
|
-# Contributed to the OpenVPN project by |
19 |
|
|
-# Douglas Keller <doug@voidstar.dyndns.org> |
20 |
|
|
-# 2002.05.15 |
21 |
|
|
- |
22 |
|
|
-# To install: |
23 |
|
|
-# copy this file to /etc/rc.d/init.d/openvpn |
24 |
|
|
-# shell> chkconfig --add openvpn |
25 |
|
|
-# shell> mkdir /etc/openvpn |
26 |
|
|
-# make .conf or .sh files in /etc/openvpn (see below) |
27 |
|
|
- |
28 |
|
|
-# To uninstall: |
29 |
|
|
-# run: chkconfig --del openvpn |
30 |
|
|
- |
31 |
|
|
-# Author's Notes: |
32 |
|
|
-# |
33 |
|
|
-# I have created an /etc/init.d init script and enhanced openvpn.spec to |
34 |
|
|
-# automatically register the init script. Once the RPM is installed you |
35 |
|
|
-# can start and stop OpenVPN with "service openvpn start" and "service |
36 |
|
|
-# openvpn stop". |
37 |
|
|
-# |
38 |
|
|
-# The init script does the following: |
39 |
|
|
-# |
40 |
|
|
-# - Starts an openvpn process for each .conf file it finds in |
41 |
|
|
-# /etc/openvpn. |
42 |
|
|
-# |
43 |
|
|
-# - If /etc/openvpn/xxx.sh exists for a xxx.conf file then it executes |
44 |
|
|
-# it before starting openvpn (useful for doing openvpn --mktun...). |
45 |
|
|
-# |
46 |
|
|
-# - In addition to start/stop you can do: |
47 |
|
|
-# |
48 |
|
|
-# service openvpn reload - SIGHUP |
49 |
|
|
-# service openvpn reopen - SIGUSR1 |
50 |
|
|
-# service openvpn status - SIGUSR2 |
51 |
|
|
-# |
52 |
|
|
-# Modifications: |
53 |
|
|
-# |
54 |
|
|
-# 2003.05.02 |
55 |
|
|
-# * Changed == to = for sh compliance (Bishop Clark). |
56 |
|
|
-# * If condrestart|reload|reopen|status, check that we were |
57 |
|
|
-# actually started (James Yonan). |
58 |
|
|
-# * Added lock, piddir, and work variables (James Yonan). |
59 |
|
|
-# * If start is attempted twice, without an intervening stop, or |
60 |
|
|
-# if start is attempted when previous start was not properly |
61 |
|
|
-# shut down, then kill any previously started processes, before |
62 |
|
|
-# commencing new start operation (James Yonan). |
63 |
|
|
-# * Do a better job of flagging errors on start, and properly |
64 |
|
|
-# returning success or failure status to caller (James Yonan). |
65 |
|
|
-# |
66 |
|
|
-# 2005.04.04 |
67 |
|
|
-# * Added openvpn-startup and openvpn-shutdown script calls |
68 |
|
|
-# (James Yonan). |
69 |
|
|
-# |
70 |
|
|
- |
71 |
|
|
-# Location of openvpn binary |
72 |
|
|
-openvpn="" |
73 |
|
|
-openvpn_locations="/usr/sbin/openvpn /usr/local/sbin/openvpn" |
74 |
|
|
-for location in $openvpn_locations |
75 |
|
|
-do |
76 |
|
|
- if [ -f "$location" ] |
77 |
|
|
- then |
78 |
|
|
- openvpn=$location |
79 |
|
|
- fi |
80 |
|
|
-done |
81 |
|
|
- |
82 |
|
|
-# configuration file |
83 |
|
|
-conf=server-bridge |
84 |
|
|
- |
85 |
|
|
-# Lockfile |
86 |
|
|
-lock="/var/lock/subsys/openvpn-bridge" |
87 |
|
|
- |
88 |
|
|
-# PID directory |
89 |
|
|
-piddir="/var/run/openvpn" |
90 |
|
|
- |
91 |
|
|
-# Our working directory |
92 |
|
|
-work=/etc/openvpn |
93 |
|
|
- |
94 |
|
|
-# Source function library. |
95 |
|
|
-. /etc/rc.d/init.d/functions |
96 |
|
|
- |
97 |
|
|
-# Source networking configuration. |
98 |
|
|
-. /etc/sysconfig/network |
99 |
|
|
- |
100 |
|
|
-# Check that networking is up. |
101 |
|
|
-if [ ${NETWORKING} = "no" ] |
102 |
|
|
-then |
103 |
|
|
- echo "Networking is down" |
104 |
|
|
- exit 0 |
105 |
|
|
-fi |
106 |
|
|
- |
107 |
|
|
-# Check that binary exists |
108 |
|
|
-if ! [ -f $openvpn ] |
109 |
|
|
-then |
110 |
|
|
- echo "openvpn binary not found" |
111 |
|
|
- exit 0 |
112 |
|
|
-fi |
113 |
|
|
- |
114 |
|
|
-# See how we were called. |
115 |
|
|
-case "$1" in |
116 |
|
|
- start) |
117 |
|
|
- echo -n $"Starting openvpn: " |
118 |
|
|
- |
119 |
|
|
- /sbin/modprobe tun >/dev/null 2>&1 |
120 |
|
|
- |
121 |
|
|
- # From a security perspective, I think it makes |
122 |
|
|
- # sense to remove this, and have users who need |
123 |
|
|
- # it explictly enable in their --up scripts or |
124 |
|
|
- # firewall setups. |
125 |
|
|
- |
126 |
|
|
- #echo 1 > /proc/sys/net/ipv4/ip_forward |
127 |
|
|
- |
128 |
|
|
- if [ ! -d $piddir ]; then |
129 |
|
|
- mkdir $piddir |
130 |
|
|
- fi |
131 |
|
|
- |
132 |
|
|
- if [ -f $lock ]; then |
133 |
|
|
- # we were not shut down correctly |
134 |
|
|
- if [ -s $piddir/$conf.pid ]; then |
135 |
|
|
- kill `cat $piddir/$conf.pid` >/dev/null 2>&1 |
136 |
|
|
- fi |
137 |
|
|
- rm -f $piddir/$conf.pid |
138 |
|
|
- rm -f $lock |
139 |
|
|
- sleep 2 |
140 |
|
|
- fi |
141 |
|
|
- |
142 |
|
|
- rm -f $piddir/$conf.pid |
143 |
|
|
- cd $work |
144 |
|
|
- |
145 |
|
|
- errors=0 |
146 |
|
|
- successes=0 |
147 |
|
|
- |
148 |
|
|
- # Run startup script, if defined |
149 |
|
|
- if [ -f $work/$conf.up ]; then |
150 |
|
|
- $work/$conf.up |
151 |
|
|
- fi |
152 |
|
|
- |
153 |
|
|
- rm -f $piddir/$conf.pid |
154 |
|
|
- $openvpn --daemon --writepid $piddir/$conf.pid --config $work/$conf.ovpn --cd $work |
155 |
|
|
- if [ $? = 0 ]; then |
156 |
|
|
- successes=1 |
157 |
|
|
- else |
158 |
|
|
- errors=1 |
159 |
|
|
- fi |
160 |
|
|
- |
161 |
|
|
- if [ $errors = 1 ]; then |
162 |
|
|
- failure; echo |
163 |
|
|
- else |
164 |
|
|
- success; echo |
165 |
|
|
- fi |
166 |
|
|
- |
167 |
|
|
- if [ $successes = 1 ]; then |
168 |
|
|
- touch $lock |
169 |
|
|
- fi |
170 |
|
|
- ;; |
171 |
|
|
- stop) |
172 |
|
|
- echo -n $"Shutting down openvpn: " |
173 |
|
|
- cd $work |
174 |
|
|
- # Run shutdown script, if defined |
175 |
|
|
- if [ -s $piddir/$conf.pid ]; then |
176 |
|
|
- kill `cat $piddir/$conf.pid` >/dev/null 2>&1 |
177 |
|
|
- fi |
178 |
|
|
- if [ -f $work/$conf.down ]; then |
179 |
|
|
- $work/$conf.down |
180 |
|
|
- fi |
181 |
|
|
- rm -f $piddir/$conf.pid |
182 |
|
|
- |
183 |
|
|
- success; echo |
184 |
|
|
- rm -f $lock |
185 |
|
|
- ;; |
186 |
|
|
- restart) |
187 |
|
|
- $0 stop |
188 |
|
|
- sleep 2 |
189 |
|
|
- $0 start |
190 |
|
|
- ;; |
191 |
|
|
- reload) |
192 |
|
|
- if [ -f $lock ]; then |
193 |
|
|
- if [ -s $piddir/$conf.pid ]; then |
194 |
|
|
- kill -HUP `cat $piddir/$conf.pid` >/dev/null 2>&1 |
195 |
|
|
- fi |
196 |
|
|
- else |
197 |
|
|
- echo "openvpn: service not started" |
198 |
|
|
- exit 1 |
199 |
|
|
- fi |
200 |
|
|
- ;; |
201 |
|
|
- reopen) |
202 |
|
|
- if [ -f $lock ]; then |
203 |
|
|
- if [ -s $piddir/$conf.pid ]; then |
204 |
|
|
- kill -USR1 `cat $piddir/$conf.pid` >/dev/null 2>&1 |
205 |
|
|
- fi |
206 |
|
|
- else |
207 |
|
|
- echo "openvpn: service not started" |
208 |
|
|
- exit 1 |
209 |
|
|
- fi |
210 |
|
|
- ;; |
211 |
|
|
- condrestart) |
212 |
|
|
- if [ -f $lock ]; then |
213 |
|
|
- $0 stop |
214 |
|
|
- # avoid race |
215 |
|
|
- sleep 2 |
216 |
|
|
- $0 start |
217 |
|
|
- fi |
218 |
|
|
- ;; |
219 |
|
|
- status) |
220 |
|
|
- if [ -f $lock ]; then |
221 |
|
|
- if [ -s $piddir/$conf.pid ]; then |
222 |
|
|
- kill -USR2 `cat $piddir/$conf.pid` >/dev/null 2>&1 |
223 |
|
|
- fi |
224 |
|
|
- echo "Status written to /var/log/messages" |
225 |
|
|
- else |
226 |
|
|
- echo "openvpn: service not started" |
227 |
|
|
- exit 1 |
228 |
|
|
- fi |
229 |
|
|
- ;; |
230 |
|
|
- adjust) |
231 |
|
|
- CONF_STATUS=$(/sbin/e-smith/db configuration getprop openvpn-bridge status) |
232 |
|
|
- $0 stop |
233 |
|
|
- sleep 2 |
234 |
|
|
- if [ $CONF_STATUS == 'enabled' ]; then |
235 |
|
|
- $0 start |
236 |
|
|
- fi |
237 |
|
|
- ;; |
238 |
|
|
- *) |
239 |
|
|
- echo "Usage: openvpn {start|stop|restart|condrestart|reload|reopen|status|adjust}" |
240 |
|
|
- exit 1 |
241 |
|
|
- ;; |
242 |
|
|
-esac |
243 |
|
|
-exit 0 |
244 |
|
|
diff -Nur -x '*.orig' -x '*.rej' smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/reset-openvpn mezzanine_patched_smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/reset-openvpn |
245 |
|
|
--- smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/reset-openvpn 2008-12-02 14:23:04.000000000 +0100 |
246 |
|
|
+++ mezzanine_patched_smeserver-openvpn-bridge-2.0/root/etc/rc.d/init.d/reset-openvpn 1970-01-01 01:00:00.000000000 +0100 |
247 |
|
|
@@ -1,7 +0,0 @@ |
248 |
|
|
-#!/bin/bash |
249 |
|
|
-#################################### |
250 |
|
|
-# Reset SME openvpn configuration after unclean shutdown |
251 |
|
|
-#################################### |
252 |
|
|
-eth=$(/sbin/e-smith/db configuration getprop bridge ethernetInterface) |
253 |
|
|
-/sbin/e-smith/db configuration setprop InternalInterface Name $eth |
254 |
|
|
- |