mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-12 04:05:53 +02:00
Alle Restartskripte umbenannt in CTRL Skripte
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@812 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -16,8 +16,6 @@ usr/local/bin/pakfire
|
||||
usr/local/bin/qosctrl
|
||||
usr/local/bin/rebuildhosts
|
||||
usr/local/bin/redctrl
|
||||
usr/local/bin/restartssh
|
||||
usr/local/bin/restartwireless
|
||||
#usr/local/bin/sambactrl
|
||||
usr/local/bin/setdmzholes
|
||||
usr/local/bin/setportfw
|
||||
@@ -25,7 +23,10 @@ usr/local/bin/setxtaccess
|
||||
usr/local/bin/smartctrl
|
||||
usr/local/bin/snortctrl
|
||||
usr/local/bin/squidctrl
|
||||
usr/local/bin/sshctrls
|
||||
usr/local/bin/syslogdctrl
|
||||
usr/local/bin/timectrl
|
||||
#usr/local/bin/tripwirectrl
|
||||
usr/local/bin/upnpctrl
|
||||
usr/local/bin/restartsyslogd
|
||||
usr/local/bin/wirelessctrl
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ elsif ( $cgiparams{'ACTION'} eq "restore" )
|
||||
print UPLOADFILE;
|
||||
}
|
||||
close UPLOADFILE;
|
||||
system("/usr/local/bin/backupctrl restore");
|
||||
system("/usr/local/bin/backupctrl restore >/dev/null");
|
||||
}
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($logsettings{'ACTION'} eq $Lang::tr{'save'})
|
||||
unless ($errormessage)
|
||||
{
|
||||
&General::writehash("${General::swroot}/logging/settings", \%logsettings);
|
||||
system('/usr/local/bin/restartsyslogd') == 0
|
||||
system('/usr/local/bin/syslogdctrl') == 0
|
||||
or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,15 +64,15 @@ if ( (($remotesettings{'ACTION'} eq $Lang::tr{'save'}) || ($remotesettings{'ACTI
|
||||
&General::log($Lang::tr{'ssh1 disabled'});
|
||||
}
|
||||
if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} ){
|
||||
system('/usr/local/bin/restartssh','tempstart15') == 0
|
||||
system('/usr/local/bin/sshctrl','tempstart15') == 0
|
||||
or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
|
||||
}
|
||||
elsif ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ){
|
||||
system('/usr/local/bin/restartssh','tempstart30') == 0
|
||||
system('/usr/local/bin/sshctrl','tempstart30') == 0
|
||||
or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
|
||||
}
|
||||
else {
|
||||
system('/usr/local/bin/restartssh') == 0
|
||||
system('/usr/local/bin/sshctrl') == 0
|
||||
or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ ADDERROR:
|
||||
close(FILE);
|
||||
undef %cgiparams;
|
||||
&General::log($Lang::tr{'wireless config added'});
|
||||
system('/usr/local/bin/restartwireless');
|
||||
system('/usr/local/bin/wirelessctrl');
|
||||
}
|
||||
ADDEXIT:
|
||||
}
|
||||
@@ -148,7 +148,7 @@ if ($cgiparams{'ACTION'} eq 'edit')
|
||||
}
|
||||
}
|
||||
&General::log($Lang::tr{'wireless config changed'});
|
||||
system('/usr/local/bin/restartwireless');
|
||||
system('/usr/local/bin/wirelessctrl');
|
||||
}
|
||||
|
||||
if ($cgiparams{'ACTION'} eq 'remove' || $cgiparams{'ACTION'} eq 'toggle')
|
||||
@@ -169,7 +169,7 @@ if ($cgiparams{'ACTION'} eq 'remove' || $cgiparams{'ACTION'} eq 'toggle')
|
||||
}
|
||||
close(FILE);
|
||||
&General::log($Lang::tr{'wireless config changed'});
|
||||
system('/usr/local/bin/restartwireless');
|
||||
system('/usr/local/bin/wirelessctrl');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ init_networking() {
|
||||
|
||||
if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
|
||||
boot_mesg "Setting up wireless firewall rules"
|
||||
/usr/local/bin/restartwireless; evaluate_retval
|
||||
/usr/local/bin/wirelessctrl; evaluate_retval
|
||||
fi
|
||||
|
||||
/etc/rc.d/init.d/dnsmasq start
|
||||
|
||||
@@ -5,12 +5,12 @@ COMPILE=$(CC) $(CFLAGS)
|
||||
|
||||
PROGS = iowrap
|
||||
SUID_PROGS = setdmzholes setportfw setxtaccess \
|
||||
squidctrl restartssh ipfirereboot \
|
||||
squidctrl sshctrl ipfirereboot \
|
||||
ipsecctrl timectrl dhcpctrl snortctrl \
|
||||
applejuicectrl rebuildhosts backupctrl \
|
||||
logwatch openvpnctrl outgoingfwctrl \
|
||||
restartwireless getipstat qosctrl launch-ether-wake \
|
||||
redctrl restartsyslogd extrahdctrl sambactrl upnpctrl tripwirectrl \
|
||||
wirelessctrl getipstat qosctrl launch-ether-wake \
|
||||
redctrl syslogdctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
|
||||
smartctrl clamavctrl pakfire mpfirectrl
|
||||
|
||||
install : all
|
||||
@@ -88,8 +88,8 @@ applejuicectrl: applejuicectrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
dhcpctrl: dhcpctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ dhcpctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
restartssh: restartssh.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ restartssh.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
sshctrl: sshctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ sshctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
squidctrl: squidctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ squidctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
@@ -97,8 +97,8 @@ squidctrl: squidctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
snortctrl: snortctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ snortctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
restartwireless: restartwireless.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ restartwireless.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
wirelessctrl: wirelessctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ wirelessctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
ipsecctrl: ipsecctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ ipsecctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
@@ -115,5 +115,5 @@ mpfirectrl: mpfirectrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
backupctrl: backupctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ backupctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
restartsyslogd: restartsyslogd.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ restartsyslogd.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
syslogdctrl: syslogdctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ syslogdctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SmoothWall helper program - restartssh
|
||||
/* SmoothWall helper program - sshctrl
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
@@ -7,7 +7,7 @@
|
||||
* Simple program intended to be installed setuid(0) that can be used for
|
||||
* restarting SSHd.
|
||||
*
|
||||
* $Id: restartssh.c,v 1.3 2003/12/11 10:57:34 riddles Exp $
|
||||
* $Id: sshctrl.c,v 1.3 2003/12/11 10:57:34 riddles Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -25,18 +25,18 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (strcmp(argv[1], "tempstart15") == 0) {
|
||||
safe_system("/usr/local/bin/restartssh");
|
||||
safe_system("/usr/local/bin/sshctrl");
|
||||
sleep(5);
|
||||
unlink("/var/ipfire/remote/enablessh");
|
||||
safe_system("cat /var/ipfire/remote/settings | sed 's/ENABLE_SSH=on/ENABLE_SSH=off/' > /var/ipfire/remote/settings2 && mv /var/ipfire/remote/settings2 /var/ipfire/remote/settings");
|
||||
safe_system("sleep 900 && /usr/local/bin/restartssh &");
|
||||
safe_system("sleep 900 && /usr/local/bin/sshctrl &");
|
||||
}
|
||||
else if (strcmp(argv[1], "tempstart30") == 0) {
|
||||
safe_system("/usr/local/bin/restartssh");
|
||||
safe_system("/usr/local/bin/sshctrl");
|
||||
sleep(5);
|
||||
unlink("/var/ipfire/remote/enablessh");
|
||||
safe_system("cat /var/ipfire/remote/settings | sed 's/ENABLE_SSH=on/ENABLE_SSH=off/' > /var/ipfire/remote/settings2 && mv /var/ipfire/remote/settings2 /var/ipfire/remote/settings");
|
||||
safe_system("sleep 1800 && /usr/local/bin/restartssh &");
|
||||
safe_system("sleep 1800 && /usr/local/bin/sshctrl &");
|
||||
} else {
|
||||
int fd, config_fd, rc, pid;
|
||||
char buffer[STRING_SIZE], command[STRING_SIZE] = "/bin/sed -e '";
|
||||
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* By using O_CREAT with O_EXCL open() will fail if the file already exists,
|
||||
* this prevents 2 copies of restartssh both trying to edit the config file
|
||||
* this prevents 2 copies of sshctrl both trying to edit the config file
|
||||
* at once. It also prevents race conditions, but these shouldn't be
|
||||
* possible as /etc/ssh/ should only be writable by root anyhow
|
||||
*/
|
||||
@@ -1,147 +1,147 @@
|
||||
/* IPCop helper program - restartwireless
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
*
|
||||
* (c) Alan Hourihane, 2003
|
||||
*
|
||||
* $Id: restartwireless.c,v 1.2.2.5 2005/07/11 10:56:47 franck78 Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libsmooth.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
#include "setuid.h"
|
||||
|
||||
FILE *fd = NULL;
|
||||
char blue_dev[STRING_SIZE] = "";
|
||||
char command[STRING_SIZE];
|
||||
|
||||
void exithandler(void)
|
||||
{
|
||||
if(strlen(blue_dev))
|
||||
{
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG_DROP", blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG_DROP", blue_dev);
|
||||
safe_system(command);
|
||||
}
|
||||
|
||||
if (fd)
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char green_dev[STRING_SIZE] = "";
|
||||
char buffer[STRING_SIZE];
|
||||
char *index, *ipaddress, *macaddress, *enabled;
|
||||
struct keyvalue *kv = NULL;
|
||||
|
||||
if (!(initsetuid()))
|
||||
exit(1);
|
||||
|
||||
/* flush wireless iptables */
|
||||
safe_system("/sbin/iptables -F WIRELESSINPUT > /dev/null 2> /dev/null");
|
||||
safe_system("/sbin/iptables -F WIRELESSFORWARD > /dev/null 2> /dev/null");
|
||||
|
||||
memset(buffer, 0, STRING_SIZE);
|
||||
|
||||
/* Init the keyvalue structure */
|
||||
kv=initkeyvalues();
|
||||
|
||||
/* Read in the current values */
|
||||
if (!readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings"))
|
||||
{
|
||||
fprintf(stderr, "Cannot read ethernet settings\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Get the GREEN interface details */
|
||||
if(!findkey(kv, "GREEN_DEV", green_dev))
|
||||
{
|
||||
fprintf(stderr, "Cannot read GREEN_DEV\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!VALID_DEVICE(green_dev))
|
||||
{
|
||||
fprintf(stderr, "Bad GREEN_DEV: %s\n", green_dev);
|
||||
exit(1);
|
||||
}
|
||||
/* Get the BLUE interface details */
|
||||
if(!findkey(kv, "BLUE_DEV", blue_dev))
|
||||
{
|
||||
fprintf(stderr, "Cannot read BLUE_DEV\n");
|
||||
exit(1);
|
||||
}
|
||||
if (strlen(blue_dev) && !VALID_DEVICE(blue_dev))
|
||||
{
|
||||
fprintf(stderr, "Bad BLUE_DEV: %s\n", blue_dev);
|
||||
exit(1);
|
||||
}
|
||||
if(! strlen(blue_dev) > 0)
|
||||
{
|
||||
fprintf(stderr, "No BLUE interface\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* register exit handler to ensure the block rule is always present */
|
||||
atexit(exithandler);
|
||||
|
||||
if (!(fd = fopen(CONFIG_ROOT "/wireless/config", "r")))
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
while (fgets(buffer, STRING_SIZE, fd))
|
||||
{
|
||||
buffer[strlen(buffer) - 1] = 0;
|
||||
|
||||
index = strtok(buffer, ",");
|
||||
ipaddress = strtok(NULL, ",");
|
||||
macaddress = strtok(NULL, ",");
|
||||
enabled = strtok(NULL, ",");
|
||||
|
||||
if (!strncmp(enabled, "on", 2)) {
|
||||
|
||||
/* both specified, added security */
|
||||
if ((strlen(macaddress) == 17) &&
|
||||
(VALID_IP(ipaddress))) {
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -s %s -i %s -j ACCEPT", macaddress, ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -o ! %s -j ACCEPT", macaddress, ipaddress, blue_dev, green_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -j DMZHOLES", macaddress, ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
} else {
|
||||
|
||||
/* correctly formed mac address is 17 chars */
|
||||
if (strlen(macaddress) == 17) {
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -i %s -j ACCEPT", macaddress, blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -o ! %s -j ACCEPT", macaddress, blue_dev, green_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -j DMZHOLES", macaddress, blue_dev);
|
||||
safe_system(command);
|
||||
}
|
||||
|
||||
if (VALID_IP(ipaddress)) {
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -s %s -i %s -j ACCEPT", ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -o ! %s -j ACCEPT", ipaddress, blue_dev, green_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -j DMZHOLES", ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* IPCop helper program - wirelessctrl
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
*
|
||||
* (c) Alan Hourihane, 2003
|
||||
*
|
||||
* $Id: wirelessctrl.c,v 1.2.2.5 2005/07/11 10:56:47 franck78 Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libsmooth.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
#include "setuid.h"
|
||||
|
||||
FILE *fd = NULL;
|
||||
char blue_dev[STRING_SIZE] = "";
|
||||
char command[STRING_SIZE];
|
||||
|
||||
void exithandler(void)
|
||||
{
|
||||
if(strlen(blue_dev))
|
||||
{
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG_DROP", blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG_DROP", blue_dev);
|
||||
safe_system(command);
|
||||
}
|
||||
|
||||
if (fd)
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char green_dev[STRING_SIZE] = "";
|
||||
char buffer[STRING_SIZE];
|
||||
char *index, *ipaddress, *macaddress, *enabled;
|
||||
struct keyvalue *kv = NULL;
|
||||
|
||||
if (!(initsetuid()))
|
||||
exit(1);
|
||||
|
||||
/* flush wireless iptables */
|
||||
safe_system("/sbin/iptables -F WIRELESSINPUT > /dev/null 2> /dev/null");
|
||||
safe_system("/sbin/iptables -F WIRELESSFORWARD > /dev/null 2> /dev/null");
|
||||
|
||||
memset(buffer, 0, STRING_SIZE);
|
||||
|
||||
/* Init the keyvalue structure */
|
||||
kv=initkeyvalues();
|
||||
|
||||
/* Read in the current values */
|
||||
if (!readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings"))
|
||||
{
|
||||
fprintf(stderr, "Cannot read ethernet settings\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Get the GREEN interface details */
|
||||
if(!findkey(kv, "GREEN_DEV", green_dev))
|
||||
{
|
||||
fprintf(stderr, "Cannot read GREEN_DEV\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!VALID_DEVICE(green_dev))
|
||||
{
|
||||
fprintf(stderr, "Bad GREEN_DEV: %s\n", green_dev);
|
||||
exit(1);
|
||||
}
|
||||
/* Get the BLUE interface details */
|
||||
if(!findkey(kv, "BLUE_DEV", blue_dev))
|
||||
{
|
||||
fprintf(stderr, "Cannot read BLUE_DEV\n");
|
||||
exit(1);
|
||||
}
|
||||
if (strlen(blue_dev) && !VALID_DEVICE(blue_dev))
|
||||
{
|
||||
fprintf(stderr, "Bad BLUE_DEV: %s\n", blue_dev);
|
||||
exit(1);
|
||||
}
|
||||
if(! strlen(blue_dev) > 0)
|
||||
{
|
||||
fprintf(stderr, "No BLUE interface\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* register exit handler to ensure the block rule is always present */
|
||||
atexit(exithandler);
|
||||
|
||||
if (!(fd = fopen(CONFIG_ROOT "/wireless/config", "r")))
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
while (fgets(buffer, STRING_SIZE, fd))
|
||||
{
|
||||
buffer[strlen(buffer) - 1] = 0;
|
||||
|
||||
index = strtok(buffer, ",");
|
||||
ipaddress = strtok(NULL, ",");
|
||||
macaddress = strtok(NULL, ",");
|
||||
enabled = strtok(NULL, ",");
|
||||
|
||||
if (!strncmp(enabled, "on", 2)) {
|
||||
|
||||
/* both specified, added security */
|
||||
if ((strlen(macaddress) == 17) &&
|
||||
(VALID_IP(ipaddress))) {
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -s %s -i %s -j ACCEPT", macaddress, ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -o ! %s -j ACCEPT", macaddress, ipaddress, blue_dev, green_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -j DMZHOLES", macaddress, ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
} else {
|
||||
|
||||
/* correctly formed mac address is 17 chars */
|
||||
if (strlen(macaddress) == 17) {
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -i %s -j ACCEPT", macaddress, blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -o ! %s -j ACCEPT", macaddress, blue_dev, green_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -j DMZHOLES", macaddress, blue_dev);
|
||||
safe_system(command);
|
||||
}
|
||||
|
||||
if (VALID_IP(ipaddress)) {
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -s %s -i %s -j ACCEPT", ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -o ! %s -j ACCEPT", ipaddress, blue_dev, green_dev);
|
||||
safe_system(command);
|
||||
snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -j DMZHOLES", ipaddress, blue_dev);
|
||||
safe_system(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -10,9 +10,9 @@ echo -n "Output to file? (y/n): " ;read jn
|
||||
|
||||
if [ "$jn" = "y" ]; then
|
||||
echo "Creating log file $name"
|
||||
find $wo -type f | xargs grep -in "$was" > $name
|
||||
find $wo -type f | xargs grep -in "$was" 2>/dev/null | grep -v ".svn" | grep -v "ChangeLog" | grep -v "/serv/ipfire/branches/ipcop-1.4" | grep -v "/serv/ipfire/tags/beta0" > $name
|
||||
else
|
||||
find $wo -type f | xargs grep -in "$was"
|
||||
find $wo -type f | xargs grep -in "$was" 2>/dev/null | grep -v ".svn" | grep -v "ChangeLog" | grep -v "/serv/ipfire/branches/ipcop-1.4" | grep -v "/serv/ipfire/tags/beta0"
|
||||
fi
|
||||
|
||||
if [ -d $name ]; then
|
||||
|
||||
Reference in New Issue
Block a user