]>
Commit | Line | Data |
---|---|---|
92004c61 | 1 | #!/usr/bin/perl |
70df8302 MT |
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 | ############################################################################### | |
92004c61 CS |
21 | |
22 | use strict; | |
23 | # enable only the following on debugging purpose | |
cb5e9c6c CS |
24 | #use warnings; |
25 | #use CGI::Carp 'fatalsToBrowser'; | |
92004c61 CS |
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 = ""; | |
91a08eac CS |
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`; | |
92004c61 CS |
39 | my $Log =$Lang::tr{'no log selected'}; |
40 | ||
f2fdd0c1 CS |
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 | ||
92004c61 CS |
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'; | |
71dfc4b7 | 52 | $tripwiresettings{'REPORTFILE'} = '/var/ipfire/tripwire/report/$(DATE).twr'; |
92004c61 | 53 | $tripwiresettings{'SITEKEYFILE'} = '/var/ipfire/tripwire/site.key'; |
71dfc4b7 | 54 | $tripwiresettings{'LOCALKEYFILE'} = '/var/ipfire/tripwire/local.key'; |
92004c61 CS |
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'; | |
71dfc4b7 CS |
66 | $tripwiresettings{'SITEKEY'} = 'ipfire'; |
67 | $tripwiresettings{'LOCALKEY'} = 'ipfire'; | |
92004c61 CS |
68 | $tripwiresettings{'ACTION'} = ''; |
69 | ||
71dfc4b7 CS |
70 | &General::readhash("${General::swroot}/tripwire/settings", \%tripwiresettings); |
71 | ||
92004c61 CS |
72 | ############################################################################################################################ |
73 | ######################################################### Tripwire HTML Part ############################################### | |
74 | ||
75 | &Header::showhttpheaders(); | |
88932936 | 76 | |
92004c61 | 77 | &Header::getcgihash(\%tripwiresettings); |
88932936 | 78 | &Header::openpage('Tripwire', 1,); |
92004c61 CS |
79 | &Header::openbigbox('100%', 'left', '', $errormessage); |
80 | ||
81 | ############################################################################################################################ | |
82 | ############################################### Tripwire Config Datei erstellen ############################################ | |
83 | ||
84 | if ($tripwiresettings{'ACTION'} eq $Lang::tr{'save'}) | |
85 | { | |
91a08eac | 86 | system("/usr/local/bin/tripwirectrl readconfig >/dev/null 2>&1"); |
71dfc4b7 | 87 | open (FILE, ">${General::swroot}/tripwire/twcfg.txt") or die "Can't save tripwire config: $!"; |
92004c61 CS |
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); | |
91a08eac | 115 | system("/usr/local/bin/tripwirectrl lockconfig >/dev/null 2>&1"); |
92004c61 CS |
116 | } |
117 | ||
118 | ############################################################################################################################ | |
119 | Content-type: text/html ]>