Wie immer Samba und Tripwirek>
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Fri, 13 Apr 2007 19:57:32 +0000 (19:57 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Fri, 13 Apr 2007 19:57:32 +0000 (19:57 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@499 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

doc/language_issues.de
doc/language_issues.en
html/cgi-bin/samba.cgi
html/cgi-bin/tripwire.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
src/misc-progs/sambactrl.c
src/misc-progs/tripwirectrl.c

index 4d198dd..1e8cd91 100644 (file)
@@ -273,6 +273,7 @@ WARNING: translation string unused: too long 80 char max
 WARNING: translation string unused: traffic on
 WARNING: translation string unused: transfer limits
 WARNING: translation string unused: transparent on
+WARNING: translation string unused: tripwire cronjob
 WARNING: translation string unused: umount
 WARNING: translation string unused: umount removable media before to unplug
 WARNING: translation string unused: unencrypted
@@ -304,6 +305,7 @@ WARNING: translation string unused: written sectors
 WARNING: translation string unused: xtaccess bad transfert
 WARNING: translation string unused: year
 WARNING: untranslated string: IPFires hostname
+WARNING: untranslated string: add cronjob
 WARNING: untranslated string: allmsg
 WARNING: untranslated string: alt proxy
 WARNING: untranslated string: dial profile
@@ -334,6 +336,7 @@ WARNING: untranslated string: trafficred
 WARNING: untranslated string: traffics
 WARNING: untranslated string: trafficsum
 WARNING: untranslated string: trafficto
+WARNING: untranslated string: tripwire cronjobs
 WARNING: untranslated string: up
 WARNING: untranslated string: urlfilter background image
 WARNING: untranslated string: urlfilter log
index 9fab328..f8b34ec 100644 (file)
@@ -279,6 +279,7 @@ WARNING: translation string unused: to install an update
 WARNING: translation string unused: traffic on
 WARNING: translation string unused: transfer limits
 WARNING: translation string unused: transparent on
+WARNING: translation string unused: tripwire cronjob
 WARNING: translation string unused: unencrypted
 WARNING: translation string unused: update transcript
 WARNING: translation string unused: updates
@@ -308,6 +309,7 @@ WARNING: translation string unused: written sectors
 WARNING: translation string unused: year
 WARNING: translation string unused: yearly firewallhits
 WARNING: untranslated string: IPFires hostname
+WARNING: untranslated string: add cronjob
 WARNING: untranslated string: alt proxy
 WARNING: untranslated string: down
 WARNING: untranslated string: firewall logs ip
@@ -322,6 +324,7 @@ WARNING: untranslated string: red
 WARNING: untranslated string: remove x509
 WARNING: untranslated string: settingsc
 WARNING: untranslated string: smbrestart
+WARNING: untranslated string: tripwire cronjobs
 WARNING: untranslated string: up
 WARNING: untranslated string: urlfilter background image
 WARNING: untranslated string: urlfilter log
index 089cd38..b49c0bc 100644 (file)
@@ -85,6 +85,7 @@ $sambasettings{'OTHERINTERFACES'} = '127.0.0.1';
 $sambasettings{'GUESTACCOUNT'} = 'samba';
 $sambasettings{'MAPTOGUEST'} = 'Never';
 $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
+$sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE';
 ### Values that have to be initialized
 $sambasettings{'ACTION'} = '';
 my $LOGLINES = '50';
@@ -143,6 +144,7 @@ if ($sambasettings{'ACTION'} eq 'globalresetyes')
        $sambasettings{'LOCALMASTER'} = 'off';
        $sambasettings{'DOMAINMASTER'} = 'off';
        $sambasettings{'PREFERREDMASTER'} = 'off';
+       $sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE';
        $PDCOPTIONS = `cat ${General::swroot}/samba/pdc`;
        system("/usr/local/bin/sambactrl smbreload");
        }
@@ -423,7 +425,7 @@ null passwords = yes
 
 bind interfaces only = true
 interfaces = $sambasettings{'INTERFACES'}
-socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE
+socket options = $sambasettings{'SOCKETOPTIONS'}
 remote announce = $sambasettings{'REMOTEANNOUNCE'}
 
 username level = 1
@@ -601,6 +603,7 @@ print <<END
 <tr><td align='left'><br /></td><td /></tr>
 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'network options'}</b></td></tr>
 <tr><td align='left' width='40%'>$Lang::tr{'os level'}</td><td align='left'><input type='text' name='OSLEVEL' value='$sambasettings{'OSLEVEL'}' size="30" /></td></tr>
+<tr><td align='left' width='40%'>$Lang::tr{'socket options'}</td><td align='left'><input type='text' name='SOCKETOPTIONS' value='$sambasettings{'SOCKETOPTIONS'}' size="30" /></td></tr>
 <tr><td align='left' width='40%'>$Lang::tr{'remote announce'}</td><td align='left'><input type='text' name='REMOTEANNOUNCE' value='$sambasettings{'REMOTEANNOUNCE'}' size="30" /></td></tr>
 END
 ;
@@ -960,8 +963,11 @@ print <<END
                                                                                                <input type='hidden' name='ACTION' value='sharesreset' />
                                                                                                <input type='image' alt='$Lang::tr{'reset'}' src='/images/reload.gif' />
                                                                                                </form></td>
-               <td align='center'><a target="popup" onClick="window.open ('', 'popup', 'width=580,height=360,scrollbars=no, toolbar=no,status=no, resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')"href="sambahlp.cgi"><form method='post' action='$ENV{'SCRIPT_NAME'}'><img border="0" src="/images/help-browser.png"></a>
-</td></tr>
+               <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                                               <input type='hidden' name='ACTION' value='sharecaption' />
+                                                                                               <input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' />
+                                                                                               </form></td>
+</tr>
 </table>
 END
 ;
@@ -990,10 +996,9 @@ if ($sambasettings{'ACTION'} eq 'shareadd' || $sambasettings{'ACTION'} eq 'optio
        <table width='95%' cellspacing='0'>
        <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'add share'}</b></td></tr>
        <tr><td colspan='2' align='center'></td></tr>
-       <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}<form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                                                                                                                                                                                                                                                                       <input type='hidden' name='ACTION' value='optioncaption' />
-                                                                                                                                                                                                                                                                                       <input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' />
-                                                                                                                                                                                                                                                                                       </form></td></tr>
+       <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}
+ <a href="sambahlp.cgi" target="popup" onClick="window.open ('', 'popup', 'width=580,height=360,scrollbars=no, toolbar=no,status=no, resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')"><img border="0" src="/images/help-browser.png"></a>
+       </td></tr>
        <form method='post' action='$ENV{'SCRIPT_NAME'}'><tr><td colspan='2' align='center'><textarea name="SHAREOPTION" cols="50" rows="15" Wrap="off">$defaultoption</textarea></td></tr>
        </table>
        <br />
@@ -1046,8 +1051,6 @@ END
 ;
        }
 
-
-
 &Header::closebox();
 
 ############################################################################################################################
index aa87806..3b00921 100755 (executable)
@@ -22,6 +22,7 @@ my $message = "";
 my $errormessage = "";
 my @Logs = qx(ls -r /var/ipfire/tripwire/report/);
 my $file = `ls -tr /var/ipfire/tripwire/report/ | tail -1`;
+my @cronjobs = `ls /etc/fcron.daily/tripwire*`;
 my $Log =$Lang::tr{'no log selected'};
 
 ############################################################################################################################
@@ -54,8 +55,9 @@ $tripwiresettings{'ACTION'} = '';
 ######################################################### Tripwire HTML Part ###############################################
 
 &Header::showhttpheaders();
+
 &Header::getcgihash(\%tripwiresettings);
-&Header::openpage('Tripwire', 1, '');
+&Header::openpage('Tripwire', 1,);
 &Header::openbigbox('100%', 'left', '', $errormessage);
 
 ############################################################################################################################
@@ -63,7 +65,7 @@ $tripwiresettings{'ACTION'} = '';
 
 if ($tripwiresettings{'ACTION'} eq $Lang::tr{'save'})
 {
-system("/usr/local/bin/tripwirectrl readconfig");
+system("/usr/local/bin/tripwirectrl readconfig  >& /dev/null");
 open (FILE, ">${General::swroot}/tripwire/twcfg.txt") or die "Can't save tripwire config: $!";
 flock (FILE, 2);
 
@@ -92,12 +94,32 @@ END
 close FILE;
 
 &General::writehash("${General::swroot}/tripwire/settings", \%tripwiresettings);
-system("/usr/local/bin/tripwirectrl lockconfig");
+system("/usr/local/bin/tripwirectrl lockconfig  >& /dev/null");
 }
 
 ############################################################################################################################
 ################################################## Sicherheitsabfrage für CGI ##############################################
 
+if ($tripwiresettings{'ACTION'} eq 'addcron')
+       {
+       print <<END
+       <br />
+       <table width='95%' cellspacing='0'>
+       <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'add cron'}</b>
+       <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+       <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>
+       <tr><td align='right' width='50%'>
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
+                                       <input type='hidden' name='ACTION' value='addcronyes' /></form></td>
+                       <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
+                                       <input type='hidden' name='ACTION' value='cancel' /></form></td>
+       </tr>
+       </table>
+END
+;
+}
+
 if ($tripwiresettings{'ACTION'} eq 'globalreset')
        {
        print <<END
@@ -106,10 +128,10 @@ if ($tripwiresettings{'ACTION'} eq 'globalreset')
        <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'resetglobals'}</b>
        <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'defaultwarning'}<br /><br /></font></td></tr>
        <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                        $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
                                        <input type='hidden' name='ACTION' value='globalresetyes' /></form></td>
                        <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                       <input type='image' alt='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'} 
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
                                        <input type='hidden' name='ACTION' value='cancel' /></form></td>
        </tr>
        </table>
@@ -125,12 +147,12 @@ if ($tripwiresettings{'ACTION'} eq 'generatepolicypw')
        <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'generatepolicy'}</b>
        <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningpolicy'}<br /><br /></font></td></tr>
        <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>
-       <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" /></td></tr>
+       <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>
        <tr><td align='right' width='50%'>
-                                        $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
                                        <input type='hidden' name='ACTION' value='generatepolicyyes' /></form></td>
                        <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                       <input type='image' alt='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'} 
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
                                        <input type='hidden' name='ACTION' value='cancel' /></form></td>
        </tr>
        </table>
@@ -146,12 +168,12 @@ if ($tripwiresettings{'ACTION'} eq 'policyresetpw')
        <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'resetpolicy'}</b>
        <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningpolicy'}<br /><br /></font></td></tr>
        <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>
-       <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" /></td></tr>
+       <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>
        <tr><td align='right' width='50%'>
-                                        $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
                                        <input type='hidden' name='ACTION' value='resetpolicyyes' /></form></td>
                        <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                       <input type='image' alt='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'} 
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
                                        <input type='hidden' name='ACTION' value='cancel' /></form></td>
        </tr>
        </table>
@@ -166,12 +188,12 @@ if ($tripwiresettings{'ACTION'} eq 'updatedatabasepw')
        <table width='95%' cellspacing='0'>
        <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'updatedatabase'}</b>
        <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningdatabase'}<br /><br /></font></td></tr>
-       <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" /></td></tr>
+       <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>
        <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                        $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
                                        <input type='hidden' name='ACTION' value='updatedatabaseyes' /></form></td>
                        <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                       <input type='image' alt='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'} 
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
                                        <input type='hidden' name='ACTION' value='cancel' /></form></td>
        </tr>
        </table>
@@ -186,10 +208,10 @@ if ($tripwiresettings{'ACTION'} eq 'keyreset')
        <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'keyreset'}</b>
        <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningkeys'}<br /><br /></font></td></tr>
        <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                        $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
                                        <input type='hidden' name='ACTION' value='keyresetyes' /></form></td>
                        <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                       <input type='image' alt='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'} 
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
                                        <input type='hidden' name='ACTION' value='cancel' /></form></td>
        </tr>
        </table>
@@ -205,10 +227,10 @@ if ($tripwiresettings{'ACTION'} eq 'generatekeys')
        <tr><td bgcolor='${Header::table1colour}' colspan='2' align='center'><b>$Lang::tr{'generatekeys'}</b>
        <tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningkeys'}<br /><br /></font></td></tr>
        <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                        $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
+                                        $Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
                                        <input type='hidden' name='ACTION' value='generatekeysyes' /></form></td>
                        <td align='left'  width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                       <input type='image' alt='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'} 
+                                       <input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'} 
                                        <input type='hidden' name='ACTION' value='cancel' /></form></td>
        </tr>
        </table>
@@ -221,6 +243,7 @@ END
 
 if ($tripwiresettings{'ACTION'} eq 'globalresetyes')
 {
+&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>";
 $tripwiresettings{'ROOT'} = '/usr/sbin';
 $tripwiresettings{'POLFILE'} = '/var/ipfire/tripwire/tw.pol';
 $tripwiresettings{'DBFILE'} = '/var/ipfire/tripwire/$(HOSTNAME).twd';
@@ -241,7 +264,7 @@ $tripwiresettings{'MAILPROGRAM'} = '/usr/sbin/sendmail -oi -t';
 $tripwiresettings{'SITEKEY'} = 'ipfire';
 $tripwiresettings{'LOCALKEY'} = 'ipfire';
 $tripwiresettings{'ACTION'} = '';
-system("/usr/local/bin/tripwirectrl readconfig");
+system("/usr/local/bin/tripwirectrl readconfig  >& /dev/null");
 open (FILE, ">${General::swroot}/tripwire/twcfg.txt") or die "Can't save tripwire config: $!";
 flock (FILE, 2);
 print FILE <<END
@@ -268,15 +291,16 @@ END
 ;
 close FILE;
 &General::writehash("${General::swroot}/tripwire/settings", \%tripwiresettings);
-system("/usr/local/bin/tripwirectrl lockconfig");
-system("/usr/local/bin/tripwirectrl keys ipfire ipfire");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';
+system("/usr/local/bin/tripwirectrl lockconfig  >& /dev/null");
+system("/usr/local/bin/tripwirectrl keys ipfire ipfire  >& /dev/null");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';
 }
-if ($tripwiresettings{'ACTION'} eq 'generatekeysyes'){system("/usr/local/bin/tripwirectrl keys $tripwiresettings{'SITEKEY'} $tripwiresettings{'LOCALKEY'}");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
-if ($tripwiresettings{'ACTION'} eq 'keyresetyes'){system("/usr/local/bin/tripwirectrl keys ipfire ipfire");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
-if ($tripwiresettings{'ACTION'} eq 'resetpolicyyes'){system("/usr/local/bin/tripwirectrl resetpolicy tripwiresettings{'SITEKEY'} $tripwiresettings{'LOCALKEY'}");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
-if ($tripwiresettings{'ACTION'} eq 'generatepolicyyes'){system("/usr/local/bin/tripwirectrl generatepolicy $tripwiresettings{'SITEKEY'} $tripwiresettings{'LOCALKEY'}");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
-if ($tripwiresettings{'ACTION'} eq 'updatedatabaseyes'){system("/usr/local/bin/tripwirectrl updatedatabase $tripwiresettings{'LOCALKEY'} /var/ipfire/tripwire/report/$file");$tripwiresettings{'LOCALKEY'} = 'ipfire';}
-if ($tripwiresettings{'ACTION'} eq 'generatereport'){system("/usr/local/bin/tripwirectrl generatereport");}
+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");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
+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");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
+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");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
+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");$tripwiresettings{'SITEKEY'} = 'ipfire';$tripwiresettings{'LOCALKEY'} = 'ipfire';}
+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");$tripwiresettings{'LOCALKEY'} = 'ipfire';}
+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");}
+if ($tripwiresettings{'ACTION'} eq 'addcronyes'){system("/usr/local/bin/tripwirectrl addcron $tripwiresettings{'HOUR'} $tripwiresettings{'MINUTE'} >& /dev/null");}
 
 ############################################################################################################################
 ##################################################### Tripwire globale Optionen ############################################
@@ -369,6 +393,7 @@ END
 ;
 
 }
+
 &Header::closebox();
 
 ############################################################################################################################
@@ -455,5 +480,46 @@ END
 
 &Header::closebox();
 
+############################################################################################################################
+####################################################### Tripwire Cronjob ##################################################
+
+&Header::openbox('100%', 'center', $Lang::tr{'tripwire cronjobs'});
+print <<END
+<hr />
+<br />
+<table width='95%' cellspacing='0'>
+<tr><td colspan='3'  align='left'><br /></td></tr>
+END
+;
+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='$cronjob' /><input type='image' alt='delete cronjob' src='/images/user-trash.png' /></td></tr></form>";}
+print <<END
+</table>
+<br />
+<table width='10%' cellspacing='0'>
+<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                                               <input type='hidden' name='ACTION' value='addcron'/>
+                                                                                               <input type='image' alt='$Lang::tr{'add cronjob'}' src='/images/appointment-new.png' /></form></td>
+<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                               <input type='hidden' name='ACTION' value='croncaption' />
+                                                                               <input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
+</table>
+END
+;
+
+if ($tripwiresettings{'ACTION'} eq 'croncaption')
+{
+print <<END
+<br />
+<table width='95%' cellspacing='0'>
+<tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
+<tr><td align='right' width='33%'><img src='/images/appointment-new.png' /></td><td align='left'>$Lang::tr{'add cron'}</td></tr>
+<tr><td align='right' width='33%'><img src='/images/user-trash.png' /></td><td align='left'>$Lang::tr{'delete cron'}</td></tr>
+</table>
+END
+;
+}
+
+&Header::closebox();
+
 &Header::closebigbox();
 &Header::closepage();
\ No newline at end of file
index 2990b55..d8c52b4 100644 (file)
@@ -44,6 +44,7 @@
 'add' => 'Hinzufügen',
 'add a host' => 'Host hinzufügen:',
 'add a new rule' => 'Neue Regel hinzufügen:',
+'add cron' => 'Cronjob hinzufügen',
 'add device' => 'Gerät hinzufügen',
 'add network' => 'Netzwerk hinzufügen',
 'add new alias' => 'Neue Alias-Adresse hinzufügen:',
 'default services' => 'Standard Dienste',
 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.',
 'delete' => 'Löschen',
+'delete cron' => 'Cronjob löschen',
 'delete pc' => 'PC löschen',
 'delete share' => 'Freigabe löschen',
 'delete user' => 'Benutzer löschen',
 'o-no' => 'Inaktiv',
 'o-yes' => 'Aktiv',
 'october' => 'Oktober',
+'ok' => 'OK',
 'older' => 'Älter',
 'online help en' => 'Online-Hilfe (auf Deutsch)',
 'only digits allowed in holdoff field' => 'Im Holdoff-Feld sind nur Ziffern erlaubt',
 'smtphost' => 'Smtp Host',
 'smtpport' => 'Smtp Port',
 'snort hits' => 'Gesamtanzahl der aktivierten Intrusion-Regeln für',
+'socket options' => 'Socket Options',
 'sort ascending' => 'Sortiere aufsteigend',
 'sort descending' => 'Sortiere absteigend',
 'sound' => 'Klang',
 'traffic shaping settings' => 'Einstellungen der Datenflußkontrolle',
 'transfer limits' => 'Transferbeschränkungen',
 'transparent on' => 'Transparent auf',
+'tripwire cronjob' => 'Tripwire Cronjob',
 'tripwire functions' => 'Tripwire Funktionen',
 'tripwire reports' => 'Tripwire Reports',
+'tripwireoperating' => 'Der Prozess wurde gestartet. Dies kann einige Minuten in Anspruch nehmen, bitte haben Sie Geduld, das Fenster wird sich automatisch aktualisieren sobald der Vorgang beendet ist.',
 'tripwirewarningdatabase' => 'ACHTUNG - Ihre Datenbank wird auf den Stand des letzten Reports gesetzt, bitte versichern sie sich, dass keine unautorisiertend Änderungen vorgenommen wurden. Hierfür wird der Local-Key benötigt.',
 'tripwirewarningkeys' => 'ACHTUNG - Sie löschen hiermit ihre bestehenden Schlüssel, ihre Konfiguration und Datenbank und legen Alles neu an.',
-'tripwirewarningpolicy' => 'ACHTUNG - Ihr Policy wird neu erzeugt, anschließen wird die Datenbank neu initialisiert. Hierfür wird der Site-Key benötigt.',
+'tripwirewarningpolicy' => 'ACHTUNG - Ihr Policy wird neu erzeugt, anschließen wird die Datenbank neu initialisiert. Hierfür wird der Site-Key und Local-Key benötigt.',
 'tuesday' => 'Dienstag',
 'type' => 'Typ',
 'umount' => 'Abmelden',
index d06bf6b..3df237e 100644 (file)
@@ -44,6 +44,7 @@
 'add' => 'Add',
 'add a host' => 'Add a host:',
 'add a new rule' => 'Add a new rule:',
+'add cron' => 'add cronjob',
 'add device' => 'Add device',
 'add network' => 'Add network',
 'add new alias' => 'Add a new alias:',
 'default services' => 'Default services',
 'defaultwarning' => 'WARNING - Your settings will be lost and replaced by the default ones.',
 'delete' => 'Delete',
+'delete cron' => 'delete cronjob',
 'delete pc' => 'delete workstation',
 'delete share' => 'delete share',
 'delete user' => 'delete User',
 'o-no' => 'Inactiv',
 'o-yes' => 'Activ',
 'october' => 'October',
+'ok' => 'OK',
 'older' => 'Older',
 'online help en' => 'Online Help (in English)',
 'only digits allowed in holdoff field' => 'Only digits allowed in holdoff field',
 'smtphost' => 'Smtp Host',
 'smtpport' => 'Smtp Port',
 'snort hits' => 'Total of number of Intrusion rules activated for',
+'socket options' => 'Socket Options',
 'sort ascending' => 'Sort Ascending',
 'sort descending' => 'Sort Descending',
 'sound' => 'Sound',
 'trafficto' => 'To',
 'transfer limits' => 'Transfer limits',
 'transparent on' => 'Transparent on',
+'tripwire cronjob' => 'tripwire cronjob',
 'tripwire functions' => 'tripwire functions',
 'tripwire reports' => 'tripwire reports',
+'tripwireoperating' => 'The process was started. This may take serverall minutes, please wait the window will automaticly refresh after the process has finished.',
 'tripwirewarningdatabase' => 'WARNING - Your Database will be updated with the data of the last report. Please ensure that no unauthorized changes are reported. Therefor the Local-Key is needed.',
 'tripwirewarningkeys' => 'WARNING - This will erase your current keys, config, and database and generate them new.',
-'tripwirewarningpolicy' => 'WARNING - Your policy will be rebuild, after that your database will be reinitalised. Therefor the Site-Key ist neeeded.',
+'tripwirewarningpolicy' => 'WARNING - Your policy will be rebuild, after that your database will be reinitalised. Therefor the Site-Key and the Local-Ley are neeeded.',
 'tuesday' => 'Tuesday',
 'type' => 'type',
 'unable to alter profiles while red is active' => 'Unable to alter profiles while RED is active.',
index 315a8c2..a6e1f7c 100644 (file)
@@ -13,162 +13,183 @@ char command[BUFFER_SIZE];
 int main(int argc, char *argv[])
 {
 
-        if (!(initsetuid()))
-                exit(1);
-
-        // Check what command is asked
-        if (argc==1)
-        {
-            fprintf (stderr, "Missing smbctrl command!\n");
-            return 1;
-        }
-
-        if (strcmp(argv[1], "smbuserdisable")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -d %s", argv[2]);
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbuserenable")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -e %s", argv[2]);
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbuserdelete")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -x %s", argv[2]);
-            safe_system(command);
-            snprintf(command, BUFFER_SIZE-1, "/usr/sbin/userdel %s", argv[2]);
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbsafeconf")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbsafeconfcups")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbsafeconfpdc")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbsafeconfpdccups")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbglobalreset")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/default.global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
-            safe_system("/bin/cat /var/ipfire/samba/default.settings > /var/ipfire/samba/settings");
-            safe_system("/bin/cat /var/ipfire/samba/default.global > /var/ipfire/samba/global");
-            safe_system("/bin/cat /var/ipfire/samba/default.pdc > /var/ipfire/samba/pdc");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbsharesreset")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/default.shares > /var/ipfire/samba/smb.conf");
-            safe_system("/bin/cat /var/ipfire/samba/default.shares > /var/ipfire/samba/shares");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbprinterreset")==0)
-        {
-            safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/default.printer > /var/ipfire/samba/smb.conf");
-            safe_system("/bin/cat /var/ipfire/samba/default.printer > /var/ipfire/samba/printer");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbstop")==0)
-        {
-            safe_system("/etc/rc.d/init.d/samba stop");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbstart")==0)
-        {
-            safe_system("/etc/rc.d/init.d/samba start");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbrestart")==0)
-        {
-            safe_system("/etc/rc.d/init.d/samba restart");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbreload")==0)
-        {
-            safe_system("/etc/rc.d/init.d/samba reload");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbstatus")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbstatus");
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbuseradd")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambauser");
-            safe_system(command);
-            snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba User' -m -g %s -p %s -s %s %s", argv[4], argv[3], argv[5], argv[2]);
-            safe_system(command);
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s", argv[3], argv[3], argv[2]);
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbpcadd")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambawks");
-            safe_system(command);
-            snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba Workstation' -g %s -s %s %s", argv[3], argv[4], argv[2]);
-            safe_system(command);
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -a -m %s", argv[2]);
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "smbchangepw")==0)
-        {
-            snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s", argv[3], argv[3], argv[2]);
-            safe_system(command);
-            return 0;
-        }
-
-        if (strcmp(argv[1], "readsmbpasswd")==0)
-        {
-            safe_system("/bin/chown root:nobody /var/ipfire/samba/private");
-            safe_system("/bin/chown root:nobody /var/ipfire/samba/private/smbpasswd");
-            safe_system("/bin/chmod 640 /var/ipfire/samba/private/smbpasswd");
-            safe_system("/bin/chmod 650 /var/ipfire/samba/private");
-            return 0;
-        }
-
-        if (strcmp(argv[1], "locksmbpasswd")==0)
-        {
-            safe_system("/bin/chown root:root /var/ipfire/samba/private");
-            safe_system("/bin/chown root:root /var/ipfire/samba/private/smbpasswd");
-            safe_system("/bin/chmod 600 /var/ipfire/samba/private/smbpasswd");
-            safe_system("/bin/chmod 600 /var/ipfire/samba/private");
-            return 0;
-        }
+if (!(initsetuid()))
+exit(1);
+
+// Check what command is asked
+if (argc==1)
+{
+fprintf (stderr, "Missing smbctrl command!\n");
+return 1;
+}
+
+if (strcmp(argv[1], "smbuserdisable")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -d %s", argv[2]);
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "smbuserenable")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -e %s", argv[2]);
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "smbuserdelete")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -x %s", argv[2]);
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/userdel %s", argv[2]);
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "smbsafeconf")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
+return 0;
+}
+
+if (strcmp(argv[1], "smbsafeconfcups")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
+return 0;
+}
+
+if (strcmp(argv[1], "smbsafeconfpdc")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
+return 0;
+}
+
+if (strcmp(argv[1], "smbsafeconfpdccups")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
+return 0;
+}
+
+if (strcmp(argv[1], "smbglobalreset")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/default.global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/default.settings > /var/ipfire/samba/settings");
+safe_system("/bin/cat /var/ipfire/samba/default.global > /var/ipfire/samba/global");
+safe_system("/bin/cat /var/ipfire/samba/default.pdc > /var/ipfire/samba/pdc");
+return 0;
+}
+
+if (strcmp(argv[1], "smbsharesreset")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/default.shares > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/default.shares > /var/ipfire/samba/shares");
+return 0;
+}
+
+if (strcmp(argv[1], "smbprinterreset")==0)
+{
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/default.printer > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/default.printer > /var/ipfire/samba/printer");
+return 0;
+}
+
+if (strcmp(argv[1], "smbstop")==0)
+{
+safe_system("/etc/rc.d/init.d/samba stop");
+return 0;
+}
+
+if (strcmp(argv[1], "smbstart")==0)
+{
+safe_system("/etc/rc.d/init.d/samba start");
+return 0;
+}
+
+if (strcmp(argv[1], "smbrestart")==0)
+{
+safe_system("/etc/rc.d/init.d/samba restart");
+return 0;
+}
+
+if (strcmp(argv[1], "smbreload")==0)
+{
+safe_system("/etc/rc.d/init.d/samba reload");
+return 0;
+}
+
+if (strcmp(argv[1], "smbstatus")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbstatus");
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "smbuseradd")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambauser");
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba User' -m -g %s -p %s -s %s %s", argv[4], argv[3], argv[5], argv[2]);
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s", argv[3], argv[3], argv[2]);
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "smbpcadd")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambawks");
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba Workstation' -g %s -s %s %s", argv[3], argv[4], argv[2]);
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -a -m %s", argv[2]);
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "smbchangepw")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s", argv[3], argv[3], argv[2]);
+safe_system(command);
+return 0;
+}
+
+if (strcmp(argv[1], "readsmbpasswd")==0)
+{
+safe_system("/bin/chown root:nobody /var/ipfire/samba/private");
+safe_system("/bin/chown root:nobody /var/ipfire/samba/private/smbpasswd");
+safe_system("/bin/chmod 640 /var/ipfire/samba/private/smbpasswd");
+safe_system("/bin/chmod 650 /var/ipfire/samba/private");
+return 0;
+}
+
+if (strcmp(argv[1], "locksmbpasswd")==0)
+{
+safe_system("/bin/chown root:root /var/ipfire/samba/private");
+safe_system("/bin/chown root:root /var/ipfire/samba/private/smbpasswd");
+safe_system("/bin/chmod 600 /var/ipfire/samba/private/smbpasswd");
+safe_system("/bin/chmod 600 /var/ipfire/samba/private");
+return 0;
+}
+if (strcmp(argv[1], "enable")==0)
+{
+safe_system("touch /var/ipfire/samba/enable");
+safe_system("/etc/rc.d/init.d/samba start");
+safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc2.d/S50samba");
+safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc2.d/K50samba");
+safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/S50samba");
+safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/K50samba");
+return 0;
+}
+
+if (strcmp(argv[1], "disable")==0)
+{
+safe_system("unlink /var/ipfire/samba/enable");
+safe_system("/etc/rc.d/init.d/samba stop");
+safe_system("unlink /etc/rc.d/rc2.d/S50samba");
+safe_system("unlink /etc/rc.d/rc2.d/K50samba");
+safe_system("unlink /etc/rc.d/rc3.d/S50samba");
+safe_system("unlink /etc/rc.d/rc3.d/K50samba");
+return 0;
+}
 return 0;
 }
\ No newline at end of file
index 7ab3da7..f414d5a 100644 (file)
@@ -32,7 +32,7 @@ return 0;
 
 if (strcmp(argv[1], "generatereport")==0)
 {
-safe_system("/usr/sbin/tripwire --check --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol  >/dev/null 2>&1");
+safe_system("/usr/sbin/tripwire --check --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol");
 return 0;
 }
 
@@ -45,42 +45,40 @@ return 0;
 
 if (strcmp(argv[1], "updatedatabase")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --update --accept-all --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase %s --twrfile %s  >/dev/null 2>&1", argv[2], argv[3]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --update --accept-all --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase %s --twrfile %s", argv[2], argv[3]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "keys")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/site.key && /usr/sbin/twadmin --generate-keys --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s >/dev/null 2>&1 && chmod 640 /var/ipfire/tripwire/site.key", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/site.key && /usr/sbin/twadmin --generate-keys --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s && chmod 640 /var/ipfire/tripwire/site.key", argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/local.key && /usr/sbin/twadmin --generate-keys --local-keyfile /var/ipfire/tripwire/local.key --local-passphrase %s >/dev/null 2>&1 && chmod 640 /var/ipfire/tripwire/local.key", argv[3]);
+snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/local.key && /usr/sbin/twadmin --generate-keys --local-keyfile /var/ipfire/tripwire/local.key --local-passphrase %s && chmod 640 /var/ipfire/tripwire/local.key", argv[3]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/tw.cfg && /usr/sbin/twadmin --create-cfgfile --cfgfile /var/ipfire/tripwire/tw.cfg --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s /var/ipfire/tripwire/twcfg.txt >/dev/null 2>&1 && chmod 640 /var/ipfire/tripwire/tw.cfg", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/tw.cfg && /usr/sbin/twadmin --create-cfgfile --cfgfile /var/ipfire/tripwire/tw.cfg --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s /var/ipfire/tripwire/twcfg.txt && chmod 640 /var/ipfire/tripwire/tw.cfg", argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/tw.pol && /usr/sbin/twadmin --create-polfile --cfgfile /var/ipfire/tripwire/tw.cfg --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s /var/ipfire/tripwire/twpol.txt >/dev/null 2>&1 && chmod 640 /var/ipfire/tripwire/tw.pol", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/tw.pol && /usr/sbin/twadmin --create-polfile --cfgfile /var/ipfire/tripwire/tw.cfg --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s /var/ipfire/tripwire/twpol.txt && chmod 640 /var/ipfire/tripwire/tw.pol", argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase %s  >/dev/null 2>&1", argv[3]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase %s", argv[3]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "generatepolicy")==0)
 {
-printf("Generating Policy File<br />");
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twadmin --create-polfile --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s --polfile /var/ipfire/tripwire/tw.pol --cfgfile /var/ipfire/tripwire/tw.cfg /var/ipfire/tripwire/twpol.txt  >/dev/null 2>&1", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twadmin --create-polfile --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s --polfile /var/ipfire/tripwire/tw.pol --cfgfile /var/ipfire/tripwire/tw.cfg /var/ipfire/tripwire/twpol.txt, argv[2]);
 safe_system(command);
-printf("Initialising - This may take a while depending on your Policy<br />");
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.cfg --local-passphrase %s  >/dev/null 2>&1", argv[3]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase %s", argv[3]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "resetpolicy")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twadmin --create-polfile --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s --polfile /var/ipfire/tripwire/tw.pol --cfgfile /var/ipfire/tripwire/tw.cfg /var/ipfire/tripwire/twpol.default  >/dev/null 2>&1", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twadmin --create-polfile --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase %s --polfile /var/ipfire/tripwire/tw.pol --cfgfile /var/ipfire/tripwire/tw.cfg /var/ipfire/tripwire/twpol.default", argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.cfg --local-passphrase %s  >/dev/null 2>&1", argv[3]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase %s", argv[3]);
 safe_system(command);
 return 0;
 }
@@ -96,5 +94,49 @@ if (strcmp(argv[1], "lockconfig")==0)
 safe_system("/bin/chown root:root /var/ipfire/tripwire/twcfg.txt");
 return 0;
 }
+
+if (strcmp(argv[1], "enable")==0)
+{
+safe_system("touch /var/ipfire/tripwire/enable");
+safe_system("rm -rf /var/ipfire/tripwire/site.key && /usr/sbin/twadmin --generate-keys --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase ipfire && chmod 640 /var/ipfire/tripwire/site.key");
+safe_system("rm -rf /var/ipfire/tripwire/local.key && /usr/sbin/twadmin --generate-keys --local-keyfile /var/ipfire/tripwire/local.key --local-passphrase ipfire && chmod 640 /var/ipfire/tripwire/local.key");
+safe_system("rm -rf /var/ipfire/tripwire/tw.cfg && /usr/sbin/twadmin --create-cfgfile --cfgfile /var/ipfire/tripwire/tw.cfg --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase ipfire /var/ipfire/tripwire/twcfg.txt && chmod 640 /var/ipfire/tripwire/tw.cfg");
+safe_system("rm -rf /var/ipfire/tripwire/tw.pol && /usr/sbin/twadmin --create-polfile --cfgfile /var/ipfire/tripwire/tw.cfg --site-keyfile /var/ipfire/tripwire/site.key --site-passphrase ipfire /var/ipfire/tripwire/twpol.txt && chmod 640 /var/ipfire/tripwire/tw.pol");
+safe_system("/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol --local-passphrase ipfire");
+safe_system("cat /usr/sbin/tripwire --check --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol > /etc/fcron.daily/tripwire0600");
+safe_system("chmod 755 /etc/fcron.daily/tripwire0600");
+safe_system("touch -t 01010600 /etc/fcron.daily/tripwire0600");
+return 0;
+}
+
+if (strcmp(argv[1], "disable")==0)
+{
+safe_system("unlink /var/ipfire/tripwire/enable");
+safe_system("unlink /etc/fcron.daily/tripwire*");
+safe_system("rm -rf /var/ipfire/tripwire/site.key");
+safe_system("rm -rf /var/ipfire/tripwire/local.key");
+safe_system("rm -rf /var/ipfire/tripwire/tw.cfg*");
+safe_system("rm -rf /var/ipfire/tripwire/tw.pol*");
+safe_system("rm -rf /var/ipfire/tripwire/*.twd*");
+safe_system("rm -rf /var/ipfire/tripwire/report/*");
+return 0;
+}
+
+if (strcmp(argv[1], "addcron")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "cat /usr/sbin/tripwire --check --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol > /etc/fcron.daily/tripwire%s%s", argv[2], argv[3]);
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "chmod 755 /etc/fcron.daily/tripwire%s%s", argv[2], argv[3]);
+safe_system(command);
+snprintf(command, BUFFER_SIZE-1, "touch -t 0101%s%s /etc/fcron.daily/tripwire%s%s", argv[2], argv[3], argv[2], argv[3]);
+safe_system(command);
+return 0;
+}
+if (strcmp(argv[1], "disablecron")==0)
+{
+snprintf(command, BUFFER_SIZE-1, "unlink /etc/fcron.daily/tripwire%s", argv[2]);
+safe_system(command);
+return 0;
+}
 return 0;
 }
\ No newline at end of file