]> git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/tripwire.cgi
Merge remote-tracking branch 'dweismueller/vdr_vnsiserver5_new' into next
[ipfire-2.x.git] / html / cgi-bin / tripwire.cgi
1 #!/usr/bin/perl
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 use strict;
23 # enable only the following on debugging purpose
24 #use warnings;
25 #use CGI::Carp 'fatalsToBrowser';
26
27 require '/var/ipfire/general-functions.pl';
28 require "${General::swroot}/lang.pl";
29 require "${General::swroot}/header.pl";
30
31 my %tripwiresettings = ();
32 my %checked = ();
33 my %netsettings = ();
34 my $message = "";
35 my $errormessage = "";
36 my @Logs = `ls -r /var/ipfire/tripwire/report/ 2>/dev/null`;
37 my $file = `ls -tr /var/ipfire/tripwire/report/ | tail -1 2>/dev/null`;
38 my @cronjobs = `ls /etc/fcron.daily/tripwire* 2>/dev/null`;
39 my $Log =$Lang::tr{'no log selected'};
40
41 my %color = ();
42 my %mainsettings = ();
43 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
44 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
45
46 ############################################################################################################################
47 ################################################# Tripwire Default Variablen ################################################
48
49 $tripwiresettings{'ROOT'} = '/usr/sbin';
50 $tripwiresettings{'POLFILE'} = '/var/ipfire/tripwire/tw.pol';
51 $tripwiresettings{'DBFILE'} = '/var/ipfire/tripwire/$(HOSTNAME).twd';
52 $tripwiresettings{'REPORTFILE'} = '/var/ipfire/tripwire/report/$(DATE).twr';
53 $tripwiresettings{'SITEKEYFILE'} = '/var/ipfire/tripwire/site.key';
54 $tripwiresettings{'LOCALKEYFILE'} = '/var/ipfire/tripwire/local.key';
55 $tripwiresettings{'EDITOR'} = '/usr/bin/vi';
56 $tripwiresettings{'LATEPROMPTING'} = 'false';
57 $tripwiresettings{'LOOSEDIRECTORYCHECKING'} = 'false';
58 $tripwiresettings{'MAILNOVIOLATIONS'} = 'false';
59 $tripwiresettings{'EMAILREPORTLEVEL'} = '3';
60 $tripwiresettings{'REPORTLEVEL'} = '3';
61 $tripwiresettings{'MAILMETHOD'} = 'SENDMAIL';
62 $tripwiresettings{'SMTPHOST'} = 'ipfire.myipfire.de';
63 $tripwiresettings{'SMTPPORT'} = '25';
64 $tripwiresettings{'SYSLOGREPORTING'} = 'false';
65 $tripwiresettings{'MAILPROGRAM'} = '/usr/sbin/sendmail -oi -t';
66 $tripwiresettings{'SITEKEY'} = 'ipfire';
67 $tripwiresettings{'LOCALKEY'} = 'ipfire';
68 $tripwiresettings{'ACTION'} = '';
69
70 &General::readhash("${General::swroot}/tripwire/settings", \%tripwiresettings);
71
72 ############################################################################################################################
73 ######################################################### Tripwire HTML Part ###############################################
74
75 &Header::showhttpheaders();
76
77 &Header::getcgihash(\%tripwiresettings);
78 &Header::openpage('Tripwire', 1,);
79 &Header::openbigbox('100%', 'left', '', $errormessage);
80
81 ############################################################################################################################
82 ############################################### Tripwire Config Datei erstellen ############################################
83
84 if ($tripwiresettings{'ACTION'} eq $Lang::tr{'save'})
85 {
86 system("/usr/local/bin/tripwirectrl readconfig >/dev/null 2>&1");
87 open (FILE, ">${General::swroot}/tripwire/twcfg.txt") or die "Can't save tripwire config: $!";
88 flock (FILE, 2);
89
90 print FILE <<END
91
92 ROOT =$tripwiresettings{'ROOT'}
93 POLFILE =$tripwiresettings{'POLFILE'}
94 DBFILE =$tripwiresettings{'DBFILE'}
95 REPORTFILE =$tripwiresettings{'REPORTFILE'}
96 SITEKEYFILE =$tripwiresettings{'SITEKEYFILE'}
97 LOCALKEYFILE =$tripwiresettings{'LOCALKEYFILE'}
98 EDITOR =$tripwiresettings{'EDITOR'}
99 LATEPROMPTING =$tripwiresettings{'LATEPROMPTING'}
100 LOOSEDIRECTORYCHECKING =$tripwiresettings{'LOOSEDIRECTORYCHECKING'}
101 MAILNOVIOLATIONS =$tripwiresettings{'MAILNOVIOLATIONS'}
102 EMAILREPORTLEVEL =$tripwiresettings{'EMAILREPORTLEVEL'}
103 REPORTLEVEL =$tripwiresettings{'REPORTLEVEL'}
104 MAILMETHOD =$tripwiresettings{'MAILMETHOD'}
105 SMTPHOST =$tripwiresettings{'SMTPHOST'}
106 SMTPPORT =$tripwiresettings{'SMTPPORT'}
107 SYSLOGREPORTING =$tripwiresettings{'SYSLOGREPORTING'}
108 MAILPROGRAM =$tripwiresettings{'MAILPROGRAM'}
109
110 END
111 ;
112 close FILE;
113
114 &General::writehash("${General::swroot}/tripwire/settings", \%tripwiresettings);
115 system("/usr/local/bin/tripwirectrl lockconfig >/dev/null 2>&1");
116 }
117
118 ############################################################################################################################
119 ################################################## Sicherheitsabfrage für CGI ##############################################
120
121 if ($tripwiresettings{'ACTION'} eq 'addcron')
122 {
123 print <<END
124 <br />
125 <table width='95%' cellspacing='0'>
126 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'add cron'}</b>
127 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
128 <tr><td align='center' colspan='2'>HH<input type='text' size='2' name='HOUR' value='08'/>MM<input type='text' size='2' name='MINUTE' value='00'/><br /><br /></td></tr>
129 <tr><td align='right' width='50%'>
130 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
131 <input type='hidden' name='ACTION' value='addcronyes' /></form></td>
132 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
133 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
134 <input type='hidden' name='ACTION' value='cancel' /></form></td>
135 </tr>
136 </table>
137 END
138 ;
139 }
140
141 if ($tripwiresettings{'ACTION'} eq 'globalreset')
142 {
143 print <<END
144 <br />
145 <table width='95%' cellspacing='0'>
146 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'resetglobals'}</b>
147 <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'defaultwarning'}<br /><br /></font></td></tr>
148 <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
149 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
150 <input type='hidden' name='ACTION' value='globalresetyes' /></form></td>
151 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
152 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
153 <input type='hidden' name='ACTION' value='cancel' /></form></td>
154 </tr>
155 </table>
156 END
157 ;
158 }
159
160 if ($tripwiresettings{'ACTION'} eq 'generatepolicypw')
161 {
162 print <<END
163 <br />
164 <table width='95%' cellspacing='0'>
165 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'generatepolicy'}</b>
166 <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningpolicy'}<br /><br /></font></td></tr>
167 <tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'sitekey'}</td><td align='left'><input type='password' name='SITEKEY' value='$tripwiresettings{'SITEKEY'}' size="30" /></td></tr>
168 <tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /><br /><br /></td></tr>
169 <tr><td align='right' width='50%'>
170 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
171 <input type='hidden' name='ACTION' value='generatepolicyyes' /></form></td>
172 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
173 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
174 <input type='hidden' name='ACTION' value='cancel' /></form></td>
175 </tr>
176 </table>
177 END
178 ;
179 }
180
181 if ($tripwiresettings{'ACTION'} eq 'policyresetpw')
182 {
183 print <<END
184 <br />
185 <table width='95%' cellspacing='0'>
186 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'resetpolicy'}</b>
187 <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningpolicy'}<br /><br /></font></td></tr>
188 <tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'sitekey'}</td><td align='left'><input type='password' name='SITEKEY' value='$tripwiresettings{'SITEKEY'}' size="30" /></td></tr>
189 <tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /><br /><br /></td></tr>
190 <tr><td align='right' width='50%'>
191 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
192 <input type='hidden' name='ACTION' value='resetpolicyyes' /></form></td>
193 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
194 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
195 <input type='hidden' name='ACTION' value='cancel' /></form></td>
196 </tr>
197 </table>
198 END
199 ;
200 }
201
202 if ($tripwiresettings{'ACTION'} eq 'updatedatabasepw')
203 {
204 print <<END
205 <br />
206 <table width='95%' cellspacing='0'>
207 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'updatedatabase'}</b>
208 <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningdatabase'}<br /><br /></font></td></tr>
209 <tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /><br /><br /></td></tr>
210 <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
211 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
212 <input type='hidden' name='ACTION' value='updatedatabaseyes' /></form></td>
213 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
214 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
215 <input type='hidden' name='ACTION' value='cancel' /></form></td>
216 </tr>
217 </table>
218 END
219 ;
220 }
221 if ($tripwiresettings{'ACTION'} eq 'keyreset')
222 {
223 print <<END
224 <br />
225 <table width='95%' cellspacing='0'>
226 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'keyreset'}</b>
227 <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningkeys'}<br /><br /></font></td></tr>
228 <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
229 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
230 <input type='hidden' name='ACTION' value='keyresetyes' /></form></td>
231 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
232 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
233 <input type='hidden' name='ACTION' value='cancel' /></form></td>
234 </tr>
235 </table>
236 END
237 ;
238 }
239
240 if ($tripwiresettings{'ACTION'} eq 'generatekeys')
241 {
242 print <<END
243 <br />
244 <table width='95%' cellspacing='0'>
245 <tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'generatekeys'}</b>
246 <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningkeys'}<br /><br /></font></td></tr>
247 <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
248 $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
249 <input type='hidden' name='ACTION' value='generatekeysyes' /></form></td>
250 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
251 <input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
252 <input type='hidden' name='ACTION' value='cancel' /></form></td>
253 </tr>
254 </table>
255 END
256 ;
257 }
258
259 ############################################################################################################################
260 ######################################################## Tripwire Funktionen ###############################################
261
262 if ($tripwiresettings{'ACTION'} eq 'globalresetyes')
263 {
264 &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";&Header::closebox();
265 $tripwiresettings{'ROOT'} = '/usr/sbin';
266 $tripwiresettings{'POLFILE'} = '/var/ipfire/tripwire/tw.pol';
267 $tripwiresettings{'DBFILE'} = '/var/ipfire/tripwire/$(HOSTNAME).twd';
268 $tripwiresettings{'REPORTFILE'} = '/var/ipfire/tripwire/report/$(DATE).twr';
269 $tripwiresettings{'SITEKEYFILE'} = '/var/ipfire/tripwire/site.key';
270 $tripwiresettings{'LOCALKEYFILE'} = '/var/ipfire/tripwire/local.key';
271 $tripwiresettings{'EDITOR'} = '/usr/bin/vi';
272 $tripwiresettings{'LATEPROMPTING'} = 'false';
273 $tripwiresettings{'LOOSEDIRECTORYCHECKING'} = 'false';
274 $tripwiresettings{'MAILNOVIOLATIONS'} = 'false';
275 $tripwiresettings{'EMAILREPORTLEVEL'} = '3';
276 $tripwiresettings{'REPORTLEVEL'} = '3';
277 $tripwiresettings{'MAILMETHOD'} = 'SENDMAIL';
278 $tripwiresettings{'SMTPHOST'} = 'ipfire.myipfire.de';
279 $tripwiresettings{'SMTPPORT'} = '25';
280 $tripwiresettings{'SYSLOGREPORTING'} = 'false';
281 $tripwiresettings{'MAILPROGRAM'} = '/usr/sbin/sendmail -oi -t';
282 $tripwiresettings{'SITEKEY'} = 'ipfire';
283 $tripwiresettings{'LOCALKEY'} = 'ipfire';
284 $tripwiresettings{'ACTION'} = '';
285 system("/usr/local/bin/tripwirectrl readconfig >/dev/null 2>&1");
286 open (FILE, ">${General::swroot}/tripwire/twcfg.txt") or die "Can't save tripwire config: $!";
287 flock (FILE, 2);
288 print FILE <<END
289
290 ROOT =$tripwiresettings{'ROOT'}
291 POLFILE =$tripwiresettings{'POLFILE'}
292 DBFILE =$tripwiresettings{'DBFILE'}
293 REPORTFILE =$tripwiresettings{'REPORTFILE'}
294 SITEKEYFILE =$tripwiresettings{'SITEKEYFILE'}
295 LOCALKEYFILE =$tripwiresettings{'LOCALKEYFILE'}
296 EDITOR =$tripwiresettings{'EDITOR'}
297 LATEPROMPTING =$tripwiresettings{'LATEPROMPTING'}
298 LOOSEDIRECTORYCHECKING =$tripwiresettings{'LOOSEDIRECTORYCHECKING'}
299 MAILNOVIOLATIONS =$tripwiresettings{'MAILNOVIOLATIONS'}
300 EMAILREPORTLEVEL =$tripwiresettings{'EMAILREPORTLEVEL'}
301 REPORTLEVEL =$tripwiresettings{'REPORTLEVEL'}
302 MAILMETHOD =$tripwiresettings{'MAILMETHOD'}
303 SMTPHOST =$tripwiresettings{'SMTPHOST'}
304 SMTPPORT =$tripwiresettings{'SMTPPORT'}
305 SYSLOGREPORTING =$tripwiresettings{'SYSLOGREPORTING'}
306 MAILPROGRAM =$tripwiresettings{'MAILPROGRAM'}
307
308 END
309 ;
310 close FILE;
311 &General::writehash("${General::swroot}/tripwire/settings", \%tripwiresettings);
312 system("/usr/local/bin/tripwirectrl lockconfig >/dev/null 2>&1l");
313 system("/usr/local/bin/tripwirectrl keys ipfire ipfire >/dev/null 2>&1");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';
314 }
315 if ($tripwiresettings{'ACTION'} eq 'generatekeysyes'){&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";system("/usr/local/bin/tripwirectrl keys $tripwiresettings{'SITEKEY'} $tripwiresettings{'LOCALKEY'} >/dev/null 2>&1");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
316 if ($tripwiresettings{'ACTION'} eq 'keyresetyes'){&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";system("/usr/local/bin/tripwirectrl keys ipfire ipfire >/dev/null 2>&1");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
317 if ($tripwiresettings{'ACTION'} eq 'resetpolicyyes'){&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";system("/usr/local/bin/tripwirectrl resetpolicy tripwiresettings{'SITEKEY'} $tripwiresettings{'LOCALKEY'} >/dev/null 2>&1");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
318 if ($tripwiresettings{'ACTION'} eq 'generatepolicyyes'){&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";system("/usr/local/bin/tripwirectrl generatepolicy $tripwiresettings{'SITEKEY'} $tripwiresettings{'LOCALKEY'} >/dev/null 2>&1");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
319 if ($tripwiresettings{'ACTION'} eq 'updatedatabaseyes'){&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";system("/usr/local/bin/tripwirectrl updatedatabase $tripwiresettings{'LOCALKEY'} /var/ipfire/tripwire/report/$file >/dev/null 2>&1");$tripwiresettings{'LOCALKEY'} = 'ipfire';}
320 if ($tripwiresettings{'ACTION'} eq 'generatereport'){&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'tripwireoperating'}</font></center>";system("/usr/local/bin/tripwirectrl generatereport >/dev/null 2>&1");}
321 if ($tripwiresettings{'ACTION'} eq 'addcronyes'){system("/usr/local/bin/tripwirectrl addcron $tripwiresettings{'HOUR'} $tripwiresettings{'MINUTE'} >/dev/null 2>&1");}
322 if ($tripwiresettings{'ACTION'} eq 'deletecron'){system("/usr/local/bin/tripwirectrl disablecron $tripwiresettings{'CRON'} >/dev/null 2>&1");@cronjobs = `ls /etc/fcron.daily/tripwire* 2>/dev/null`;}
323
324 ############################################################################################################################
325 ##################################################### Tripwire globale Optionen ############################################
326
327 &Header::openbox('100%', 'center', 'Tripwire');
328 print <<END
329 <br />
330
331 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
332 <table width='95%' cellspacing='0'>
333 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'basic options'}</b></td></tr>
334 <tr><td align='left' width='40%'>$Lang::tr{'emailreportlevel'}</td><td align='left'><input type='text' name='EMAILREPORTLEVEL' value='$tripwiresettings{'EMAILREPORTLEVEL'}' size="30" /></td></tr>
335 <tr><td align='left' width='40%'>$Lang::tr{'reportlevel'}</td><td align='left'><input type='text' name='REPORTLEVEL' value='$tripwiresettings{'REPORTLEVEL'}' size="30" /></td></tr>
336 <tr><td align='left' width='40%'>$Lang::tr{'mailmethod'}</td><td align='left'><input type='text' name='MAILMETHOD' value='$tripwiresettings{'MAILMETHOD'}' size="30" /></td></tr>
337 <tr><td align='left' width='40%'>$Lang::tr{'smtphost'}</td><td align='left'><input type='text' name='SMTPHOST' value='$tripwiresettings{'SMTPHOST'}' size="30" /></td></tr>
338 <tr><td align='left' width='40%'>$Lang::tr{'smtpport'}</td><td align='left'><input type='text' name='SMTPPORT' value='$tripwiresettings{'SMTPPORT'}' size="30" /></td></tr>
339 <tr><td align='left' width='40%'>$Lang::tr{'mailprogramm'}</td><td align='left'><input type='text' name='MAILPROGRAM' value='$tripwiresettings{'MAILPROGRAM'}' size="30" /></td></tr>
340 </table>
341 <br />
342 <table width='10%' cellspacing='0'>
343 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
344 <input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
345 <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td>
346 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
347 <input type='hidden' name='ACTION' value='globalreset' />
348 <input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
349 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
350 <input type='hidden' name='ACTION' value='globalcaption' />
351 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
352 </table>
353 </from>
354 END
355 ;
356 if ($tripwiresettings{'ACTION'} eq 'globalcaption')
357 {
358 print <<END
359 <br />
360 <table width='95%' cellspacing='0'>
361 <tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
362 <tr><td align='right' width='33%'><img src='/images/media-floppy.png' alt='$Lang::tr{'save settings'}' /></td><td align='left'>$Lang::tr{'save settings'}</td></tr>
363 <tr><td align='right' width='33%'><img src='/images/reload.gif' alt='$Lang::tr{'restore settings'}' /></td><td align='left'>$Lang::tr{'restore settings'}</td></tr>
364 </table>
365 END
366 ;
367
368 }
369
370 &Header::closebox();
371
372 ############################################################################################################################
373 ################################################### Tripwire Init Policy and keygen ########################################
374
375 &Header::openbox('100%', 'center', $Lang::tr{'generate tripwire keys and init'});
376 print <<END
377 <br />
378
379 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
380 <table width='95%' cellspacing='0'>
381 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'keys'}</b></td></tr>
382 <tr><td align='left' width='40%'>$Lang::tr{'sitekey'}</td><td align='left'><input type='password' name='SITEKEY' value='$tripwiresettings{'SITEKEY'}' size="30" /></td></tr>
383 <tr><td align='left' width='40%'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /></td></tr>
384 </table>
385 <br />
386 <table width='10%' cellspacing='0'>
387 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
388 <input type='hidden' name='ACTION' value='generatekeys'/>
389 <input type='image' alt='$Lang::tr{'generatekeys'}' title='$Lang::tr{'generatekeys'}' src='/images/system-lock-screen.png' /></form></td>
390 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
391 <input type='hidden' name='ACTION' value='keyreset' />
392 <input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
393 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
394 <input type='hidden' name='ACTION' value='keycaption' />
395 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
396 </table>
397 </from>
398 END
399 ;
400 if ($tripwiresettings{'ACTION'} eq 'keycaption')
401 {
402 print <<END
403 <br />
404 <table width='95%' cellspacing='0'>
405 <tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
406 <tr><td align='right' width='33%'><img src='/images/system-lock-screen.png' alt='$Lang::tr{'generatekeys'}' /></td><td align='left'>$Lang::tr{'generatekeys'}</td></tr>
407 <tr><td align='right' width='33%'><img src='/images/reload.gif' alt='$Lang::tr{'keyreset'}' /></td><td align='left'>$Lang::tr{'keyreset'}</td></tr>
408 </table>
409 END
410 ;
411
412 }
413
414 &Header::closebox();
415
416 ############################################################################################################################
417 ################################################# Tripwire general functions ###############################################
418
419 &Header::openbox('100%', 'center', $Lang::tr{'tripwire functions'});
420 print <<END
421 <br />
422
423 <table width='95%' cellspacing='0'>
424 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
425 <input type='hidden' name='ACTION' value='generatepolicypw'/>
426 <input type='image' alt='$Lang::tr{'generatepolicy'}' title='$Lang::tr{'generatepolicy'}' src='/images/document-new.png' /></form></td>
427 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
428 <input type='hidden' name='ACTION' value='policyresetpw' />
429 <input type='image' alt='$Lang::tr{'resetpolicy'}' title='$Lang::tr{'resetpolicy'}' src='/images/reload.gif' /></form></td>
430 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
431 <input type='hidden' name='ACTION' value='generatereport' />
432 <input type='image' alt='$Lang::tr{'generatereport'}' title='$Lang::tr{'generatereport'}' src='/images/document-properties.png' /></form></td>
433 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
434 <input type='hidden' name='ACTION' value='updatedatabasepw' />
435 <input type='image' alt='$Lang::tr{'updatedatabase'}' title='$Lang::tr{'updatedatabase'}' src='/images/network-server.png' /></form></td>
436 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
437 <input type='hidden' name='ACTION' value='policycaption' />
438 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
439 </table>
440 END
441 ;
442 if ($tripwiresettings{'ACTION'} eq 'policycaption')
443 {
444 print <<END
445 <br />
446 <table width='95%' cellspacing='0'>
447 <tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
448 <tr><td align='right' width='33%'><img src='/images/document-new.png' alt='$Lang::tr{'generatepolicy'}' /></td><td align='left'>$Lang::tr{'generatepolicy'}</td></tr>
449 <tr><td align='right' width='33%'><img src='/images/reload.gif' alt='$Lang::tr{'resetpolicy'}' /></td><td align='left'>$Lang::tr{'resetpolicy'}</td></tr>
450 <tr><td align='right' width='33%'><img src='/images/document-properties.png' alt='$Lang::tr{'generatereport'}' /></td><td align='left'>$Lang::tr{'generatereport'}</td></tr>
451 <tr><td align='right' width='33%'><img src='/images/network-server.png' alt='$Lang::tr{'updatedatabase'}' /></td><td align='left'>$Lang::tr{'updatedatabase'}</td></tr>
452 </table>
453 END
454 ;
455
456 }
457 &Header::closebox();
458
459 ############################################################################################################################
460 ####################################################### Tripwire Log View ##################################################
461
462 &Header::openbox('100%', 'center', $Lang::tr{'tripwire reports'});
463 print <<END
464 <a name="$Lang::tr{'log view'}"</a>
465 <br />
466 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'log view'}'>
467 <table width='95%' cellspacing='0'>
468 <tr><td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'log view'}</b></td></tr>
469 <tr><td colspan='3' align='left'><br /></td></tr>
470 <tr><td align='left'><select name='LOG' style="width: 500px">
471 END
472 ;
473 foreach my $log (@Logs) {chomp $log;print"<option value='$log'>$log</option>";}
474 print <<END
475
476 </select></td><td align='left'><input type='hidden' name='ACTION' value='showlog' /><input type='image' alt='view Log' title='view log' src='/images/format-justify-fill.png' /></td></tr>
477 </table>
478 </form>
479 END
480 ;
481 if ($tripwiresettings{'ACTION'} eq 'showlog')
482 {
483 $Log = qx(/usr/local/bin/tripwirectrl tripwirelog $tripwiresettings{'LOG'});
484 $Log=~s/--cfgfile \/var\/ipfire\/tripwire\/tw.cfg --polfile \/var\/ipfire\/tripwire\/tw.pol//g;
485 print <<END
486 <table width='95%' cellspacing='0'>
487 <tr><td><br /></td></tr>
488 <tr><td><pre>$Log</pre></td></tr>
489 <tr><td><br /></td></tr>
490 <tr><td align='center'>$tripwiresettings{'LOG'}</td></tr>
491 </table>
492 END
493 ;
494
495 }
496
497 &Header::closebox();
498
499 ############################################################################################################################
500 ####################################################### Tripwire Cronjob ##################################################
501 #
502 #&Header::openbox('100%', 'center', $Lang::tr{'tripwire cronjob'});
503 #print <<END
504 #<br />
505 #<table width='95%' cellspacing='0'>
506 #<tr><td colspan='3' align='left'><br /></td></tr>
507 #END
508 #;
509 #foreach my $cronjob (@cronjobs) {chomp $cronjob;my $time=$cronjob; $time=~s/\/etc\/fcron.daily\/tripwire//g;print"<form method='post' action='$ENV{'SCRIPT_NAME'}'><tr><td align='left' colspan='2'>$cronjob at $time daily</td><td><input type='hidden' name='ACTION' value='deletecron' /><input type='hidden' name='CRON' value='$time' /><input type='image' alt='delete cron' title='delete cron' src='/images/user-trash.png' /></td></tr></form>";}
510 #print <<END
511 #</table>
512 #<br />
513 #<table width='10%' cellspacing='0'>
514 #<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
515 # <input type='hidden' name='ACTION' value='addcron'/>
516 # <input type='image' alt='$Lang::tr{'add cron'}' title='$Lang::tr{'add cron'}' src='/images/appointment-new.png' /></form></td>
517 #<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
518 # <input type='hidden' name='ACTION' value='croncaption' />
519 # <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
520 #</table>
521 #END
522 #;
523
524 #if ($tripwiresettings{'ACTION'} eq 'croncaption')
525 #{
526 #print <<END
527 #<br />
528 #<table width='95%' cellspacing='0'>
529 #<tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
530 #<tr><td align='right' width='33%'><img src='/images/appointment-new.png' /></td><td align='left'>$Lang::tr{'add cron'}</td></tr>
531 #<tr><td align='right' width='33%'><img src='/images/user-trash.png' /></td><td align='left'>$Lang::tr{'delete cron'}</td></tr>
532 #</table>
533 #END
534 #;
535 #}
536 #
537 #&Header::closebox();
538
539 &Header::closebigbox();
540 &Header::closepage();