/[smecontribs]/rpms/smeserver-geneweb/contribs9/smeserver-geneweb-2.1.0-proxypass_services.patch
ViewVC logotype

Contents of /rpms/smeserver-geneweb/contribs9/smeserver-geneweb-2.1.0-proxypass_services.patch

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


Revision 1.1 - (show annotations) (download)
Tue Jul 14 18:57:37 2020 UTC (4 years, 3 months ago) by michel
Branch: MAIN
CVS Tags: smeserver-geneweb-2_1_0-4_el6_sme, smeserver-geneweb-2_1_0-5_el6_sme, smeserver-geneweb-2_1_0-3_el6_sme, HEAD
Error occurred while calculating annotation data.
make: « clog » est à jour.

1 diff -aurN smeserver-geneweb-2.1.0.old/createlinks smeserver-geneweb-2.1.0/createlinks
2 --- smeserver-geneweb-2.1.0.old/createlinks 2019-10-05 19:30:02.000000000 +0400
3 +++ smeserver-geneweb-2.1.0/createlinks 2020-07-13 00:28:21.560000000 +0400
4 @@ -1,37 +1,34 @@
5 #!/usr/bin/perl -w
6
7 use esmith::Build::CreateLinks qw(:all);
8 -use File::Basename;
9 -use File::Path;
10
11 # Panel Link
12 panel_link('geneweb', 'manager');
13
14 my $gw = "/opt/geneweb/gw/gw";
15 +my $srv = "/var/service";
16
17 -for my $event (qw(
18 - geneweb-modify
19 - ))
20 -{
21 templates2events("$gw/only.txt",
22 - qw(geneweb-modify bootstrap-console-save console-save));
23 -
24 -templates2events("/etc/rc.d/init.d/gwd",
25 - qw(geneweb-modify bootstrap-console-save console-save));
26 -
27 -}
28 -
29 -for my $event (qw(geneweb-modify))
30 -{
31 - safe_symlink("sigusr1",
32 - "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
33 - safe_symlink("restart",
34 - "root/etc/e-smith/events/$event/services2adjust/geneweb");
35 -
36 -}
37 -
38 -for my $event (qw(post-upgrade))
39 -{
40 - event_link("geneweb-restart", $event, "05");
41 + qw( geneweb-modify bootstrap-console-save console-save ));
42 +templates2events("$srv/geneweb/run",
43 + qw( geneweb-modify bootstrap-console-save console-save ));
44 +templates2events("$srv/gwsetup/run",
45 + qw( geneweb-modify bootstrap-console-save console-save ));
46 +templates2events("/etc/rc.d/init.d/geneweb",
47 + qw( geneweb-modify bootstrap-console-save console-save ));
48 +templates2events("/etc/rc.d/init.d/gwsetup",
49 + qw( geneweb-modify bootstrap-console-save console-save));
50 +templates2events("/etc/httpd/conf/httpd.conf",
51 + qw( geneweb-modify bootstrap-console-save console-save));
52 +
53 +safe_symlink("sigusr1",
54 + "root/etc/e-smith/events/geneweb-modify/services2adjust/httpd-e-smith");
55 +safe_symlink("restart",
56 + "root/etc/e-smith/events/geneweb-modify/services2adjust/geneweb");
57 +safe_symlink("restart",
58 + "root/etc/e-smith/events/geneweb-modify/services2adjust/gwsetup");
59 +
60 +for my $event (qw(post-upgrade)) {
61 + event_link("geneweb-restart", $event, "05");
62 + event_link("gwsetup-restart", $event, "05");
63 }
64 -
65 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/access smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/access
66 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/access 1970-01-01 04:00:00.000000000 +0400
67 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/access 2020-07-13 12:39:09.219000000 +0400
68 @@ -0,0 +1 @@
69 +private
70 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/domain smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/domain
71 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/domain 1970-01-01 04:00:00.000000000 +0400
72 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/domain 2020-05-01 21:53:37.000000000 +0400
73 @@ -0,0 +1 @@
74 +geneweb
75 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/only smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/only
76 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/only 2007-04-07 15:07:11.000000000 +0400
77 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/only 1970-01-01 04:00:00.000000000 +0400
78 @@ -1 +0,0 @@
79 -127.0.0.1
80 \ Pas de fin de ligne à la fin du fichier
81 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/status smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/status
82 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/status 2007-04-07 15:13:42.000000000 +0400
83 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/status 2020-07-13 12:39:28.644000000 +0400
84 @@ -1 +1 @@
85 -disabled
86 \ Pas de fin de ligne à la fin du fichier
87 +disabled
88 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/TCPPort smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/TCPPort
89 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/TCPPort 1970-01-01 04:00:00.000000000 +0400
90 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/TCPPort 2020-05-01 21:53:37.000000000 +0400
91 @@ -0,0 +1 @@
92 +2317
93 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/type smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/type
94 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/geneweb/type 2007-03-05 00:27:09.000000000 +0400
95 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/geneweb/type 2020-07-13 12:39:35.108000000 +0400
96 @@ -1 +1 @@
97 -service
98 \ Pas de fin de ligne à la fin du fichier
99 +service
100 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/access smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/access
101 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/access 1970-01-01 04:00:00.000000000 +0400
102 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/access 2020-07-13 12:39:47.427000000 +0400
103 @@ -0,0 +1 @@
104 +private
105 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/domain smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/domain
106 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/domain 1970-01-01 04:00:00.000000000 +0400
107 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/domain 2020-05-01 21:53:37.000000000 +0400
108 @@ -0,0 +1 @@
109 +gwsetup
110 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/only smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/only
111 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/only 1970-01-01 04:00:00.000000000 +0400
112 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/only 2020-07-13 12:39:56.699000000 +0400
113 @@ -0,0 +1 @@
114 +127.0.0.1
115 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/status smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/status
116 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/status 1970-01-01 04:00:00.000000000 +0400
117 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/status 2020-07-13 12:40:02.260000000 +0400
118 @@ -0,0 +1 @@
119 +disabled
120 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/TCPPort smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/TCPPort
121 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/TCPPort 1970-01-01 04:00:00.000000000 +0400
122 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/TCPPort 2020-05-01 21:53:37.000000000 +0400
123 @@ -0,0 +1 @@
124 +2316
125 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/type smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/type
126 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/defaults/gwsetup/type 1970-01-01 04:00:00.000000000 +0400
127 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/defaults/gwsetup/type 2020-07-13 12:40:07.732000000 +0400
128 @@ -0,0 +1 @@
129 +service
130 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/migrate/20geneweb smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/migrate/20geneweb
131 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/db/configuration/migrate/20geneweb 1970-01-01 04:00:00.000000000 +0400
132 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/db/configuration/migrate/20geneweb 2020-07-13 12:55:13.523000000 +0400
133 @@ -0,0 +1,30 @@
134 +# create status and access for geneweb and gwsetup if not existing
135 +# set domain if empty
136 +
137 +my $rec;
138 +
139 +for my $service ( qw( geneweb gwsetup ) ) {
140 + if ( $rec = $DB->get($service) ) {
141 + if ( ! $rec->prop('status') ) {
142 + $rec->set_prop('status', 'disabled');
143 + }
144 + if ( ! $rec->prop('access') ) {
145 + $rec->set_prop('access', 'private');
146 + }
147 + if ( ! $rec->prop('domain') ) {
148 + $rec->set_prop('domain', $service . '.' .
149 + ($DB->get('DomainName')->value() || ''));
150 + }
151 + }
152 +}
153 +
154 +# move only IP from geneweb to gwsetup if existing
155 +
156 +my $ip = $DB->get_prop('geneweb', 'only');
157 +my $ip2 = $DB->get_prop('gwsetup', 'only');
158 +
159 +if ( $ip and ! $ip2 ) {
160 + $DB->delete_prop('geneweb','only');
161 + ($DB->get('gwsetup'))->set_prop('only', $ip);
162 +}
163 +
164 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb smeserver-geneweb-2.1.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb
165 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb 2019-10-05 19:30:02.000000000 +0400
166 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb 2020-07-14 22:29:08.521000000 +0400
167 @@ -38,7 +38,7 @@
168 <entry>
169 <base>SUCCESS</base>
170 <trans><![CDATA[
171 - Successful change... now browse <br/>to port 2316 from your client
172 + Successful change... now browse <br/> enabled services from your client
173 ]]>
174 </trans>
175 </entry>
176 @@ -46,7 +46,7 @@
177 <entry>
178 <base>DESC_GENEWEB_ADMIN_IP_DESCRIPTION</base>
179 <trans>
180 - This IP must be on your local network and be a valid IP (i.e. 192.168.24.244)
181 + This IP must be on your local network and be a valid IP (i.e. 192.168.0.244)
182 </trans>
183 </entry>
184
185 @@ -82,21 +82,106 @@
186 <base>LABEL_DBDIR_STATUS</base>
187 <trans>Current assigned Geneweb Database(s) directory:</trans>
188 </entry>
189 +
190 <entry>
191 <base>ERR_DIR_NOT_EXIST</base>
192 <trans>Directory not found.</trans>
193 </entry>
194 +
195 <entry>
196 <base>DESC_GENEWEB_BASE_DIR_DESCRIPTION</base>
197 - <trans>This directory must exist on server and be writeable for Geneweb. (geneweb:geneweb 770)</trans>
198 + <trans>This directory must exist on server and be writeable for Geneweb. (geneweb:geneweb 770)
199 + - default is '/opt/geneweb/bases -
200 + </trans>
201 </entry>
202 +
203 <entry>
204 <base>LABEL_GENEWEB_BASE_DIR</base>
205 <trans>New directory for Geneweb database(s). :</trans>
206 </entry>
207 +
208 <entry>
209 <base>NO_CHANGE</base>
210 <trans>No change... no update !
211 </trans>
212 </entry>
213 +
214 + <entry>
215 + <base>GENEWEB_STATUS</base>
216 + <trans>Geneweb server
217 + </trans>
218 + </entry>
219 +
220 + <entry>
221 + <base>GENEWEB_ACCESS</base>
222 + <trans>Geneweb server access
223 + </trans>
224 + </entry>
225 +
226 + <entry>
227 + <base>DESC_GENEWEB</base>
228 + <trans><![CDATA[<br><hr class="sectionbar" /><br><p><b>Geneweb server</b> (geneweb) is generally enabled and publicly accessible.<br>
229 + Geneweb databases can be found in the <b>directory</b> shown below. This location can be changed. <br>
230 + </p>]]>
231 + </trans>
232 + </entry>
233 +
234 + <entry>
235 + <base>GWSETUP_STATUS</base>
236 + <trans>Geneweb administration
237 + </trans>
238 + </entry>
239 +
240 + <entry>
241 + <base>GWSETUP_ACCESS</base>
242 + <trans>Geneweb administration access
243 + </trans>
244 + </entry>
245 +
246 + <entry>
247 + <base>DESC_GWSETUP</base>
248 + <trans> <![CDATA[<p><b>Geneweb administration service</b> (gwsetup) is generally intended for private access.<br>
249 + It is used during <b>setup only</b>.
250 + </p> ]]>
251 + </trans>
252 + </entry>
253 +
254 + <entry>
255 + <base>ERROR_STATUS_GENEWEB</base>
256 + <trans><![CDATA[ <font color="red">GENEWEB service is <b>inactive</b></font> (geneweb) ]]></trans>
257 + </entry>
258 +
259 + <entry>
260 + <base>ERROR_STATUS_GWSETUP</base>
261 + <trans><![CDATA[ <font color="red">GENEWEB administration service is <b>inactive</b></font> (gwsetup) ]]></trans>
262 + </entry>
263 +
264 + <entry>
265 + <base>ERROR2_STATUS_GENEWEB</base>
266 + <trans><![CDATA[ <font color="orange">GENEWEB service should <b>not be active</b></font> (gwd) ]]></trans>
267 + </entry>
268 +
269 + <entry>
270 + <base>ERROR2_STATUS_GWSETUP</base>
271 + <trans><![CDATA[ <font color="orange">GENEWEB administration service should <b>not be active</b></font> (gwsetup) ]]></trans>
272 + </entry>
273 +
274 + <entry>
275 + <base>PRIVATE</base>
276 + <trans>Private</trans>
277 + </entry>
278 +
279 + <entry>
280 + <base>PUBLIC</base>
281 + <trans>Public</trans>
282 + </entry>
283 +
284 + <entry>
285 + <base>DESC_GWSETUP_ACCESS</base>
286 + <trans> <![CDATA[<p> The 'public' access mode is possible but <font color="red"><b>not recommended</b></font> for security reason. <br>
287 + It is even advisable to place it in the <font color="orange">'disabled '</font> state when it is not used.
288 + </p> ]]>
289 + </trans>
290 + </entry>
291 +
292 </lexicon>
293 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86GwsetupAlias smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86GwsetupAlias
294 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86GwsetupAlias 1970-01-01 04:00:00.000000000 +0400
295 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86GwsetupAlias 2020-05-13 19:14:04.000000000 +0400
296 @@ -0,0 +1,41 @@
297 +{
298 +# gwsetup ( verify settings!)
299 + my $status = $gwsetup{'status'} || 'disabled';
300 +
301 + if ($status eq 'enabled')
302 + {
303 + $OUT .="#-------------------------------------------------\n";
304 + $OUT .="# gwsetup settings from smeserver-gwsetup\n";
305 + $OUT .="#-------------------------------------------------\n";
306 + $OUT .="\n";
307 +
308 + $OUT .= qq(
309 +<LocationMatch ^/(gwsetup|gwd)>
310 + SSLRequireSSL
311 + order deny,allow
312 + deny from all
313 + );
314 +
315 + my $access = ($gwsetup{'access'} || 'private');
316 + if ("$access" eq "private")
317 + {
318 + $OUT .= " allow from $localAccess $externalSSLAccess";
319 + }
320 + elsif ("$access" eq "public")
321 + {
322 + $OUT .= " allow from all";
323 + }
324 + $OUT .= qq(
325 + AuthName "gwsetup"
326 + AuthType Basic
327 + AuthBasicProvider external
328 + AuthExternal pwauth
329 + require user admin
330 +</LocationMatch>
331 + );
332 + }
333 + else
334 + {
335 + $OUT .= "# gwsetup is disabled";
336 + }
337 +}
338 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28gwd_gwsProxyPass smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28gwd_gwsProxyPass
339 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28gwd_gwsProxyPass 1970-01-01 04:00:00.000000000 +0400
340 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28gwd_gwsProxyPass 2020-07-13 14:50:01.992000000 +0400
341 @@ -0,0 +1,23 @@
342 +{
343 + # vim: ft=perl:
344 +# proxypass for geneweb and gwsetup
345 +
346 + $haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
347 + $plainPort = ${'httpd-e-smith'}{TCPPort} || '80';
348 + $sslPort = ${modSSL}{TCPPort} || '443';
349 +
350 + $OUT = '';
351 + foreach $place ('geneweb','gwsetup') {
352 + if ((${$place}{'status'} || 'disabled') eq 'enabled'){
353 + if (($port eq $plainPort) && ($haveSSL eq 'yes')) {
354 + $OUT .= ' RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$' . "\n";
355 + $OUT .= " RewriteRule ^/$place(/.*|\$) https://%{HTTP_HOST}/$place\$1 [L,R]\n\n";
356 + }
357 + $OUT .= " ProxyPass /$place/ http://127.0.0.1:${$place}{TCPPort}/\n";
358 + $OUT .= " ProxyPassReverse /$place/ http://127.0.0.1:${$place}{TCPPort}/\n";
359 +
360 + } else {
361 + $OUT .= " # $place disabled\n";
362 + }
363 + }
364 +}
365 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/geneweb/geneweb_ALL smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/geneweb/geneweb_ALL
366 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/geneweb/geneweb_ALL 1970-01-01 04:00:00.000000000 +0400
367 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/geneweb/geneweb_ALL 2020-05-18 20:45:56.000000000 +0400
368 @@ -0,0 +1,59 @@
369 +#!/bin/sh
370 +# chkconfig: 345 99 01
371 +#
372 +# geneweb: Starts the genealogy Server
373 +#
374 +# Version: @(#) /etc/rc.d/init.d/geneweb 1.0
375 +#
376 +# description: Starts and stops the genealogy Server at boot time and shutdown.
377 +#
378 +# processname: geneweb
379 +# hide: true
380 +
381 +# Source function library.
382 +if [ -f /etc/rc.d/init.d/functions ]; then
383 + . /etc/rc.d/init.d/functions
384 +fi
385 +
386 +GWLANG=$(/sbin/e-smith/db configuration getprop sysconfig Language | sed -e 's/_.*$//')
387 +BD=$(/sbin/e-smith/db configuration getprop geneweb DBDir || echo "/opt/geneweb/bases")
388 +HD="/opt/geneweb/gw/gw"
389 +BIN=$HD/gwd
390 +
391 +start() \{
392 + echo -n "Starting GeneWeb Services (geneweb):"
393 + $BIN -daemon -hd $HD -bd $BD -lang $GWLANG
394 +# daemon $BIN -daemon -lang $GWLANG -log /var/log/geneweb.log -hd $HD -bd $BD
395 + touch /var/lock/subsys/geneweb
396 +\}
397 +
398 +stop() \{
399 + echo -n "Shutting down GeneWeb Service (geneweb): "
400 + killproc $BIN
401 + rm -f /var/lock/subsys/geneweb
402 + echo ""
403 +\}
404 +
405 +restart() \{
406 + echo "Restarting GeneWeb Service (geneweb): "
407 + stop
408 + sleep 1
409 + start
410 +\}
411 +
412 +# See how we were called.
413 +cd $BD
414 +
415 +case "$1" in
416 + start|stop|restart)
417 + $1
418 + ;;
419 + status)
420 + status $BIN
421 + ;;
422 + *)
423 + echo "*** Usage: geneweb \{start|stop|status|restart\}"
424 + exit 1
425 +esac
426 +
427 +exit 0
428 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL
429 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL 2019-10-05 19:30:02.000000000 +0400
430 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL 1970-01-01 04:00:00.000000000 +0400
431 @@ -1,64 +0,0 @@
432 -#!/bin/sh
433 -# chkconfig: 345 99 01
434 -#
435 -# gwd: Starts the genealogy Server
436 -#
437 -# Version: @(#) /etc/rc.d/init.d/gwd 1.0
438 -#
439 -# description: Starts and stops the genealogy Server at boot time and shutdown.
440 -#
441 -# processname: gwd
442 -# hide: true
443 -
444 -# Source function library.
445 -if [ -f /etc/rc.d/init.d/functions ]; then
446 - . /etc/rc.d/init.d/functions
447 -fi
448 -
449 -{
450 - my $db_dir = ${'geneweb'}{'DBDir'} || "/opt/geneweb/bases";
451 - $OUT .= <<END_BD;
452 -BD="$db_dir"
453 -END_BD
454 -}
455 -#BD="/opt/geneweb/bases" (default)
456 -HD="/opt/geneweb/gw/gw"
457 -
458 -start() \{
459 - echo "Starting GeneWeb Services:"
460 - $HD/gwd -log /var/log/gwd.log -daemon -hd $HD -bd $BD -setup_link
461 - $HD/gwsetup -daemon -gd $HD 2>> /var/log/gwsetup.log
462 - touch /var/lock/subsys/gwd
463 -\}
464 -
465 -stop() \{
466 - echo -n "Shutting down GeneWeb Services: "
467 - killproc $HD/gwd
468 - killproc $HD/gwsetup
469 - rm -f /var/lock/subsys/gwd
470 - echo
471 -\}
472 -
473 -restart() \{
474 - echo -n "Restarting GeneWeb Services: "
475 - stop
476 - sleep 1
477 - start
478 -\}
479 -
480 -# See how we were called.
481 -cd $BD
482 -
483 -case "$1" in
484 - start|stop|restart)
485 - $1
486 - ;;
487 - status)
488 - status gwd
489 - ;;
490 - *)
491 - echo "*** Usage: gwd \{start|stop|status|restart\}"
492 - exit 1
493 -esac
494 -
495 -exit 0
496 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/gwsetup/gwsetup_ALL smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/gwsetup/gwsetup_ALL
497 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/gwsetup/gwsetup_ALL 1970-01-01 04:00:00.000000000 +0400
498 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/gwsetup/gwsetup_ALL 2020-05-18 20:46:17.000000000 +0400
499 @@ -0,0 +1,68 @@
500 +#!/bin/sh
501 +# chkconfig: 345 99 01
502 +#
503 +# gwsetup: Starts the genealogy Server Administration service
504 +#
505 +# Version: @(#) /etc/rc.d/init.d/gwsetup 1.0
506 +#
507 +# description: Starts and stops the genealogy Server Administration service at boot time and shutdown.
508 +#
509 +# processname: gwsetup
510 +# hide: true
511 +
512 +# Source function library.
513 +if [ -f /etc/rc.d/init.d/functions ]; then
514 + . /etc/rc.d/init.d/functions
515 +fi
516 +
517 +HD="/opt/geneweb/gw/gw"
518 +BIN="$\{HD\}/gwsetup"
519 +
520 +USER="root" #geneweb"
521 +GWLANG=$(/sbin/e-smith/db configuration getprop sysconfig Language | sed -e 's/_.*$//')
522 +
523 +BD=$(/sbin/e-smith/db configuration getprop geneweb DBDir || echo "/opt/geneweb/bases")
524 +TcpPort=$(/sbin/e-smith/db configuration getprop gwsetup TCPPort)
525 +
526 +#OPTIONS="-lang $GWLANG -gd $HD -bindir $HD -p $TcpPort"
527 +
528 +start() \{
529 + echo -n "Starting GeneWeb Setup service (gwsetup):"
530 + $HD/gwsetup -daemon -gd $HD -bindir $HD -p $TcpPort -lang $GWLANG
531 +# daemon --user $USER $BIN -daemon -lang $GWLANG -gd $HD -bindir $HD -p $TcpPort
532 +# daemon --user $USER $BIN $OPTIONS
533 +# 1>> /var/log/gwsetup.log 2>&1
534 +# daemon --check $servicename --user $USER $BIN $OPTIONS
535 + touch /var/lock/subsys/gwsetup
536 +\}
537 +
538 +stop() \{
539 + echo -n "Shutting down GeneWeb Setup service (gwsetup):"
540 + killproc $BIN
541 + rm -f /var/lock/subsys/gwsetup
542 + echo ""
543 +\}
544 +
545 +restart() \{
546 + echo "Restarting GeneWeb Setup service (gwsetup): "
547 + stop
548 + sleep 1
549 + start
550 +\}
551 +
552 +# See how we were called.
553 +cd $BD
554 +
555 +case "$1" in
556 + start|stop|restart)
557 + $1
558 + ;;
559 + status)
560 + status $BIN
561 + ;;
562 + *)
563 + echo "*** Usage: gwsetup \{start|stop|status|restart\}"
564 + exit 1
565 +esac
566 +
567 +exit 0
568 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb
569 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb 2019-10-05 19:30:02.000000000 +0400
570 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb 1970-01-01 04:00:00.000000000 +0400
571 @@ -1,10 +0,0 @@
572 -# Template fragment at the suggestion of Luiz Zaidan <luiz@zaidan.eng.br> after observing that
573 -# the access to GeneWeb was not consistently being allowed remotely
574 -{
575 - my $status = ${'httpd-e-smith'}{status} || "disabled";
576 - my $access = ${'httpd-e-smith'}{access} || "public";
577 -
578 - $OUT = allow_tcp_in(2317,
579 - ($status eq "enabled") && ($access eq "public"));
580 -}
581 -
582 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/geneweb/run/01run_ALL smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/geneweb/run/01run_ALL
583 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/geneweb/run/01run_ALL 1970-01-01 04:00:00.000000000 +0400
584 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/geneweb/run/01run_ALL 2020-07-13 14:32:56.719000000 +0400
585 @@ -0,0 +1,14 @@
586 +exec 2>&1
587 +
588 +BD=$(/sbin/e-smith/db configuration getprop geneweb DBDir || echo '/opt/geneweb/bases')
589 +
590 +TcpPort=$(/sbin/e-smith/db configuration getprop geneweb TCPPort || echo '2317')
591 +
592 +GWLANG=$(/sbin/e-smith/db configuration getprop sysconfig Language | sed -e 's/_.*$//')
593 +
594 +HD="/opt/geneweb/gw/gw"
595 +
596 +BIN=$HD/gwd
597 +
598 +exec $BIN -hd $HD -bd $BD -lang $GWLANG -p $TcpPort -setup_link
599 +
600 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/geneweb/run/template-begin smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/geneweb/run/template-begin
601 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/geneweb/run/template-begin 1970-01-01 04:00:00.000000000 +0400
602 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/geneweb/run/template-begin 2020-07-13 00:22:18.029000000 +0400
603 @@ -0,0 +1 @@
604 +#!/bin/sh
605 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/geneweb/run/template-end smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/geneweb/run/template-end
606 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/geneweb/run/template-end 1970-01-01 04:00:00.000000000 +0400
607 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/geneweb/run/template-end 2020-07-13 00:22:46.501000000 +0400
608 @@ -0,0 +1,2 @@
609 +
610 +# end
611 \ Pas de fin de ligne à la fin du fichier
612 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/gwsetup/run/01run_ALL smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/gwsetup/run/01run_ALL
613 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/gwsetup/run/01run_ALL 1970-01-01 04:00:00.000000000 +0400
614 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/gwsetup/run/01run_ALL 2020-07-14 21:31:38.401000000 +0400
615 @@ -0,0 +1,14 @@
616 +
617 +exec 2>&1
618 +
619 +USER="root" #geneweb"
620 +
621 +BD=$(/sbin/e-smith/db configuration getprop geneweb DBDir || echo '/opt/geneweb/bases')
622 +TcpPort=$(/sbin/e-smith/db configuration getprop gwsetup TCPPort || echo '2316')
623 +GWLANG=$(/sbin/e-smith/db configuration getprop sysconfig Language | sed -e 's/_.*$//')
624 +
625 +HD="/opt/geneweb/gw/gw"
626 +BIN="$HD/gwsetup"
627 +
628 +cd $BD
629 +exec $BIN -gd $HD -bindir $HD -p $TcpPort -lang $GWLANG
630 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/gwsetup/run/template-begin smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/gwsetup/run/template-begin
631 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/gwsetup/run/template-begin 1970-01-01 04:00:00.000000000 +0400
632 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/gwsetup/run/template-begin 2020-07-13 00:22:18.000000000 +0400
633 @@ -0,0 +1 @@
634 +#!/bin/sh
635 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/gwsetup/run/template-end smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/gwsetup/run/template-end
636 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates/var/service/gwsetup/run/template-end 1970-01-01 04:00:00.000000000 +0400
637 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates/var/service/gwsetup/run/template-end 2020-07-13 00:22:46.000000000 +0400
638 @@ -0,0 +1,2 @@
639 +
640 +# end
641 \ Pas de fin de ligne à la fin du fichier
642 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/geneweb smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/geneweb
643 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/geneweb 1970-01-01 04:00:00.000000000 +0400
644 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/geneweb 2020-07-11 18:43:34.000000000 +0400
645 @@ -0,0 +1,3 @@
646 +UID="root"
647 +GID="root"
648 +PERMS=0755
649 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd
650 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd 2019-10-05 19:30:02.000000000 +0400
651 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd 1970-01-01 04:00:00.000000000 +0400
652 @@ -1,3 +0,0 @@
653 -UID="root"
654 -GID="root"
655 -PERMS=0754
656 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwsetup smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwsetup
657 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwsetup 1970-01-01 04:00:00.000000000 +0400
658 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwsetup 2020-07-11 18:43:44.000000000 +0400
659 @@ -0,0 +1,3 @@
660 +UID="root"
661 +GID="root"
662 +PERMS=0755
663 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/var/service/geneweb/run smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/var/service/geneweb/run
664 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/var/service/geneweb/run 1970-01-01 04:00:00.000000000 +0400
665 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/var/service/geneweb/run 2020-07-12 11:45:24.000000000 +0400
666 @@ -0,0 +1,3 @@
667 +UID="root"
668 +GID="root"
669 +PERMS=0755
670 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/var/service/gwsetup/run smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/var/service/gwsetup/run
671 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/templates.metadata/var/service/gwsetup/run 1970-01-01 04:00:00.000000000 +0400
672 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/templates.metadata/var/service/gwsetup/run 2020-07-12 11:45:24.000000000 +0400
673 @@ -0,0 +1,3 @@
674 +UID="root"
675 +GID="root"
676 +PERMS=0755
677 diff -aurN smeserver-geneweb-2.1.0.old/root/etc/e-smith/web/functions/geneweb smeserver-geneweb-2.1.0/root/etc/e-smith/web/functions/geneweb
678 --- smeserver-geneweb-2.1.0.old/root/etc/e-smith/web/functions/geneweb 2019-10-05 19:30:02.000000000 +0400
679 +++ smeserver-geneweb-2.1.0/root/etc/e-smith/web/functions/geneweb 2020-07-14 22:11:28.506000000 +0400
680 @@ -60,6 +60,7 @@
681 =end testing
682
683 =cut
684 +# <description>GENEWEB_ADMINACCESS_STATUS_DESCRIPTION</description>
685
686 __DATA__
687 <form
688 @@ -69,28 +70,60 @@
689
690 <page name="First"
691 pre-event="print_status_message()">
692 - <description>GENEWEB_ADMINACCESS_STATUS_DESCRIPTION</description>
693 -
694 - <field
695 - type="literal"
696 - id="only"
697 - value="get_only()">
698 - <label>LABEL_ONLY_STATUS</label>
699 - </field>
700 +
701 + <field
702 + type="literal"
703 + id="status_gwsetup"
704 + value="get_gwsetup_st()">
705 + <label>GWSETUP_STATUS</label>
706 + <description>DESC_GWSETUP</description>
707 + </field>
708 +
709 + <field
710 + type="literal"
711 + id="stat_gws"
712 + value="get_stat_gws()">
713 + <label> </label>
714 + </field>
715 +
716 + <field
717 + type="literal"
718 + id="access_gwsetup"
719 + value="get_gwsetup_ac()">
720 + <label>GWSETUP_ACCESS</label>
721 + <description>DESC_GWSETUP_ACCESS</description>
722 + </field>
723 +
724 + <field
725 + type="literal"
726 + id="st_geneweb"
727 + value="get_geneweb_st()">
728 + <label>GENEWEB_STATUS</label>
729 + <description>DESC_GENEWEB</description>
730 + </field>
731 +
732 + <field
733 + type="literal"
734 + id="stat_gwd"
735 + value="get_stat_gwd()">
736 + <label> </label>
737 + </field>
738
739 - <field
740 - type="literal"
741 - id="dbdir"
742 + <field
743 + type="literal"
744 + id="ac_geneweb"
745 + value="get_geneweb_ac()">
746 + <label>GENEWEB_ACCESS</label>
747 + </field>
748 +
749 + <field
750 + type="literal"
751 + id="dbdir"
752 value="get_dbdir()">
753 - <label>LABEL_DBDIR_STATUS</label>
754 - </field>
755 -
756 - <field
757 - type="literal"
758 - id="button_admin"
759 - value="">
760 - <description>DESC_STATE_ADMIN_BUTTON</description>
761 - </field>
762 + <label>LABEL_DBDIR_STATUS</label>
763 + </field>
764 +
765 + <subroutine src="print_button('NEXT')" />
766
767 </page>
768
769 @@ -99,40 +132,53 @@
770 post-event="change_settings()">
771
772 <field
773 - type="text"
774 - id="geneweb_only"
775 - size="15"
776 - validation="must_be_local">
777 - <label>LABEL_GENEWEB_ADMIN_IP</label>
778 - <description>DESC_GENEWEB_ADMIN_IP_DESCRIPTION</description>
779 - </field>
780 -
781 + type="select"
782 + id="gwsetup_st"
783 + options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'"
784 + value="get_gwsetup_st()">
785 + <label>GWSETUP_STATUS</label>
786 + <description>DESC_GWSETUP</description>
787 + </field>
788 +
789 <field
790 - type="literal"
791 - id="only"
792 - value="get_only()">
793 - <label>LABEL_ONLY_STATUS</label>
794 - </field>
795 + type="select"
796 + id="gwsetup_ac"
797 + options="'private' => 'PRIVATE', 'public' => 'PUBLIC'"
798 + value="get_gwsetup_ac()">
799 + <label>GWSETUP_ACCESS</label>
800 + <description>DESC_GWSETUP_ACCESS</description>
801 + </field>
802 +
803 + <field
804 + type="select"
805 + id="geneweb_st"
806 + options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'"
807 + value="get_geneweb_st()">
808 + <label>GENEWEB_STATUS</label>
809 + <description>DESC_GENEWEB</description>
810 + </field>
811 +
812 + <field
813 + type="select"
814 + id="geneweb_ac"
815 + options="'private' => 'PRIVATE', 'public' => 'PUBLIC'"
816 + value="get_geneweb_ac()">
817 + <label>GENEWEB_ACCESS</label>
818 + </field>
819
820 <field
821 type="text"
822 id="geneweb_dbdir"
823 - size="64"
824 - validation="must_exist">
825 + size="64"
826 + validation="dir_must_exist"
827 + value="get_dbdir()">
828 <label>LABEL_GENEWEB_BASE_DIR</label>
829 <description>DESC_GENEWEB_BASE_DIR_DESCRIPTION</description>
830 </field>
831 -
832 - <field
833 - type="literal"
834 - id="dbdir"
835 - value="get_dbdir()">
836 - <label>LABEL_DBDIR_STATUS</label>
837 - </field>
838
839 -
840 <subroutine src="print_button('SAVE')" />
841
842 </page>
843 -
844 +
845 </form>
846 +
847 diff -aurN smeserver-geneweb-2.1.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm smeserver-geneweb-2.1.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm
848 --- smeserver-geneweb-2.1.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm 2019-10-05 19:47:28.000000000 +0400
849 +++ smeserver-geneweb-2.1.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm 2020-07-14 21:42:07.608000000 +0400
850 @@ -7,81 +7,30 @@
851 package esmith::FormMagick::Panel::geneweb;
852
853 use strict;
854 -#use warnings;
855 +use warnings;
856 +
857 use esmith::FormMagick;
858 use esmith::ConfigDB;
859 -use esmith::NetworksDB;
860 +use esmith::HostsDB;
861 use esmith::util;
862 +
863 use File::Basename;
864 use Exporter;
865 -use Net::IPv4Addr;
866
867 our @ISA = qw(esmith::FormMagick Exporter);
868
869 our @EXPORT = qw(
870 - get_dbdir
871 - must_exist
872 get_prop
873 - get_value
874 - get_only
875 - change_settings
876 - must_be_local
877 );
878
879 our $VERSION = sprintf '%d.%03d', q$Revision: 0.09 $ =~ /: (\d+).(\d+)/;
880
881 -our $db = esmith::ConfigDB->open || die "Couldn't open ConfigDB\n";
882 -our $networks = esmith::NetworksDB->open || die "Couldn't open NetworksDB\n";
883 -
884 -=pod
885 -
886 -=head1 NAME
887 -
888 -esmith::FormMagick::Panels::geneweb - Panel providing exclusive single
889 -IP assignment for it's administrative access (:2316)
890 -
891 -=head1 SYNOPSYS
892 -
893 - use esmith::FormMagick::Panel::geneweb;
894 -
895 - my $panel = esmith::FormMagick::Panel::geneweb->new;
896 - $panel->display();
897 -
898 -=head1 DESCRIPTION
899 -
900 -Geneweb geneology server installs two separate server accesses, the database
901 -interface (accessed at $domain:2317/DBname); the administration interface
902 -(accessed at $domain:2316 but only by the single IP assigend by the file
903 -/opt/geneweb/gw/gw/only.txt which defaults to 127.0.0.1). This panel provides a
904 -'non-commandline' form to enter an alternative IP on the LAN from which to
905 -administer Geneweb.
906 -
907 -=cut
908 -
909 -# {{{ new
910 -
911 -=head2 new()
912 -
913 -Exactly as for esmith::FormMagick
914 -
915 -=begin testing
916 +our $cdb = esmith::ConfigDB->open || die "Couldn't open Configuration DB\n";
917
918 -$ENV{ESMITH_CONFIG_DB} = "10e-smith-base/configuration.conf"
919 -$ENV{ESMITH_NETWORKS_DB} = "10e-smith-base/networks.conf"
920 +our $REGEXP_DOMAIN = qq([a-zA-Z0-9\-\.]+);
921
922 -use_ok('esmith::FormMgick::Panel::geneweb');
923 -use vars qw($panel);
924 -ok($panel = esmith::FormMagick::Panel::geneweb->new(), "Create panel object");
925 -isa_ok($panel, 'esmith::FormMagick::Panel::geneweb');
926
927 -=end testing
928 -
929 -=cut
930 -
931 -
932 -
933 -sub new
934 -{
935 +sub new {
936 shift;
937 my $self = esmith::FormMagick->new();
938 $self->{calling_package} = (caller)[0];
939 @@ -90,17 +39,13 @@
940 return $self;
941 }
942
943 -=head2 get_prop
944
945 -=cut
946 -
947 -sub get_prop
948 -{
949 +sub get_prop {
950 my $fm = shift if (ref($_[0]) );
951 my $item = shift;
952 my $prop = shift;
953
954 - my $record = $db->get($item);
955 + my $record = $cdb->get($item);
956 if ($record) {
957 return $record->prop($prop);
958 }
959 @@ -109,124 +54,114 @@
960 }
961 }
962
963 -=head2 get_value
964
965 -=cut
966 +sub get_dbdir {
967 + return $cdb->get_prop("geneweb", "DBDir");
968 +}
969
970 -sub get_value
971 -{
972 - my $fm = shift;
973 - my $item = shift;
974 - my $record = $db->get($item);
975 - #return ($db->get("geneweb")->prop($item));
976 - if ($record) {
977 - return $record->value();
978 - }
979 - else {
980 - return '';
981 - }
982 +
983 +sub get_geneweb_st {
984 + return $cdb->get_prop("geneweb", "status");
985 }
986 -
987 -=head2 get_only
988
989 -method to retrieve the value of /opt/geneweb/gw/gw/only.txt for the form
990 -=cut
991
992 -sub get_only
993 -{
994 - return $db->get_prop("geneweb", "only");
995 +sub get_geneweb_ac {
996 + return $cdb->get_prop("geneweb", "access");
997 }
998 -
999 -=head2 get_dbdir
1000
1001 -method to retrieve the value of /opt/geneweb/bases or other location for the form
1002 -=cut
1003
1004 -sub get_dbdir
1005 -{
1006 - return $db->get_prop("geneweb", "DBDir");
1007 +sub get_gwsetup_st {
1008 + return $cdb->get_prop("gwsetup", "status");
1009 }
1010
1011 -=head2 change_settings
1012
1013 -Sub to change settings as per user input in the panel
1014 -=cut
1015 +sub get_gwsetup_ac {
1016 + return $cdb->get_prop("gwsetup", "access");
1017 +}
1018 +
1019 +
1020 +sub change_settings {
1021
1022 -sub change_settings
1023 -{
1024 my $self = shift;
1025 my $q = $self->{'cgi'};
1026 - my $n_gw_ip = $q->param("geneweb_only") || '';
1027 - my $n_gw_dbdir = $q->param("geneweb_dbdir") || '';
1028 - if (!($n_gw_ip || $n_gw_dbdir)) {
1029 - return $self->success("NO_CHANGE")
1030 - }
1031 - my $gw_ip = get_only();
1032 - my $gw_dbdir = get_dbdir();
1033 - if (($n_gw_ip eq $gw_ip) && ($n_gw_dbdir eq $gw_dbdir)) {
1034 - return $self->success("NO_CHANGE")
1035 - }
1036 - if ($n_gw_ip) { $db->set_prop("geneweb", "only", $n_gw_ip) }
1037 - if ($n_gw_dbdir) { $db->set_prop("geneweb", "DBDir", $n_gw_dbdir) }
1038 +
1039 + my $n_gw_dbdir = $q->param("geneweb_dbdir") || '';
1040 + my $n_gw_st = $q->param("geneweb_st");
1041 + my $n_gw_ac = $q->param("geneweb_ac");
1042
1043 - unless ( system ( "/sbin/e-smith/signal-event", "geneweb-modify" ) == 0 )
1044 - {
1045 - $self->error("ERROR_UPDATING");
1046 - return undef;
1047 - }
1048 - return $self->success("SUCCESS");
1049 -}
1050 + my $n_gws_st = $q->param("gwsetup_st");
1051 + my $n_gws_ac = $q->param("gwsetup_ac");
1052
1053 + my $gw_dbdir = get_dbdir();
1054 + my $gw_st = get_geneweb_st();
1055 + my $gw_ac = get_geneweb_ac();
1056
1057 -=head2 valid_ip_number
1058 + my $gws_st = get_gwsetup_st();
1059 + my $gws_ac = get_gwsetup_ac();
1060
1061 -subroutine to validate IP input.
1062 -=cut
1063 + if ( ($n_gw_dbdir eq $gw_dbdir) && ($n_gw_st eq $gw_st)
1064 + && ($n_gw_ac eq $gw_ac) && ($n_gws_st eq $gws_st) && ($n_gws_ac eq $gws_ac) ) {
1065 + return $self->success("NO_CHANGE");
1066 + }
1067 + if ($n_gw_dbdir) { $cdb->set_prop("geneweb", "DBDir", $n_gw_dbdir) };
1068
1069 -sub must_be_local
1070 -{
1071 - my $self = shift;
1072 - my $q = $self->{cgi};
1073 - my $gw_ip = $q->param("geneweb_only" || '');
1074 - if (!($gw_ip)) { return 'OK'}
1075 - if (!( $gw_ip =~ /^((([01]?[0-9]{1,2}|[2][0-5]{1,2}).){3}([01]?[0-9]{1,2}|[2][0-5]{1,2}))$/ ))
1076 - {
1077 - return 'NOT_VALID_IP';
1078 - }
1079 - # Make sure that the IP is indeed local.
1080 - my $ndb = esmith::NetworksDB->open_ro;
1081 - my @local_list = $ndb->local_access_spec;
1082 -
1083 - foreach my $spec (@local_list)
1084 - {
1085 - if (Net::IPv4Addr::ipv4_in_network($spec, $gw_ip))
1086 - {
1087 - return 'OK';
1088 - }
1089 - }
1090 - # Not OK. The IP is not on any of our local networks.
1091 - return 'ERR_IP_NOT_LOCAL';
1092 + $cdb->set_prop("geneweb", "status", $n_gw_st);
1093 + $cdb->set_prop("geneweb", "access", $n_gw_ac);
1094 +
1095 + $cdb->set_prop("gwsetup", "status", $n_gws_st);
1096 + $cdb->set_prop("gwsetup", "access", $n_gws_ac);
1097 +
1098 + return ( system ( "/sbin/e-smith/signal-event", "geneweb-modify" ) ) ?
1099 + $self->error("ERROR_UPDATING") : $self->success("SUCCESS");
1100 }
1101
1102 -
1103 -=head2 valid_base_directory
1104
1105 -subroutine to validate base directory.
1106 -=cut
1107 +sub dir_must_exist {
1108
1109 -sub must_exist
1110 -{
1111 my $self = shift;
1112 my $q = $self->{cgi};
1113 +
1114 my $gw_dbdir = $q->param("geneweb_dbdir") || '';
1115 + $gw_dbdir = $1 if ($gw_dbdir =~ /^($REGEXP_DOMAIN)$/);
1116 + return 'ERR_DIR_NOT_EXIST' unless ($gw_dbdir);
1117 +
1118 if ($gw_dbdir) {
1119 - if (! -d "$gw_dbdir") { return 'ERR_DIR_NOT_EXIST' }
1120 - # system("su geneweb -c 'touch $gw_dbdir/toto'") == 0
1121 - # or return 'DIR_NOT_WRITEABLE';
1122 - # system("su geneweb -c 'rm -f $gw_dbdir/toto'")
1123 - # return 'DIR_EXIST_AND_WRITEABLE';
1124 + if ( ! -d "$gw_dbdir" ) {
1125 + return $self->localise('ERR_DIR_NOT_EXIST');
1126 + }
1127 }
1128 return 'OK';
1129 }
1130
1131 +
1132 +sub get_stat_gwd {
1133 +
1134 + my $fm = shift;
1135 + if ( get_geneweb_st() eq 'enabled'
1136 + && system ( "/bin/ps cax | /bin/grep 'gwd' > /dev/null") != 0 ) {
1137 + return $fm->localise('ERROR_STATUS_GENEWEB');
1138 + }
1139 + if ( get_geneweb_st() eq 'disabled'
1140 + && system ( "/bin/ps cax | /bin/grep 'gwd' > /dev/null") == 0 ) {
1141 + return $fm->localise('ERROR2_STATUS_GENEWEB');
1142 + }
1143 + return '';
1144 +}
1145 +
1146 +
1147 +sub get_stat_gws {
1148 +
1149 + my $fm = shift;
1150 + if ( get_gwsetup_st() eq 'enabled'
1151 + && system ( "/bin/ps cax | /bin/grep 'gwsetup' > /dev/null") != 0 ) {
1152 + return $fm->localise('ERROR_STATUS_GWSETUP');
1153 + }
1154 + if ( get_gwsetup_st() eq 'disabled'
1155 + && system ( "/bin/ps cax | /bin/grep 'gwsetup' > /dev/null") == 0 ) {
1156 + return $fm->localise('ERROR2_STATUS_GWSETUP');
1157 + }
1158 + return '';
1159 +}
1160 +
1161 +
1162 1;
1163 diff -aurN smeserver-geneweb-2.1.0.old/root/var/service/geneweb/log/run smeserver-geneweb-2.1.0/root/var/service/geneweb/log/run
1164 --- smeserver-geneweb-2.1.0.old/root/var/service/geneweb/log/run 1970-01-01 04:00:00.000000000 +0400
1165 +++ smeserver-geneweb-2.1.0/root/var/service/geneweb/log/run 2015-05-18 20:08:47.000000000 +0400
1166 @@ -0,0 +1,6 @@
1167 +#!/bin/sh
1168 +
1169 +exec \
1170 + /usr/local/bin/setuidgid smelog \
1171 + /usr/local/bin/multilog t s5000000 \
1172 + /var/log/geneweb
1173 diff -aurN smeserver-geneweb-2.1.0.old/root/var/service/gwsetup/log/run smeserver-geneweb-2.1.0/root/var/service/gwsetup/log/run
1174 --- smeserver-geneweb-2.1.0.old/root/var/service/gwsetup/log/run 1970-01-01 04:00:00.000000000 +0400
1175 +++ smeserver-geneweb-2.1.0/root/var/service/gwsetup/log/run 2020-07-11 19:53:22.699000000 +0400
1176 @@ -0,0 +1,6 @@
1177 +#!/bin/sh
1178 +
1179 +exec \
1180 + /usr/local/bin/setuidgid smelog \
1181 + /usr/local/bin/multilog t s5000000 \
1182 + /var/log/gwsetup

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