From 61e3d218735ab5432d129d559431c06567f500aa Mon Sep 17 00:00:00 2001 From: ms Date: Fri, 17 Aug 2007 09:01:02 +0000 Subject: [PATCH] Den Installer ordentlich abgespeckt. restartsyslogd entfernt. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@773 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/rootfiles/common/misc-progs | 1 - doc/packages-list.txt | 7 -- src/install+setup/install/Makefile | 2 +- src/install+setup/install/ide.c | 68 ----------- src/install+setup/install/install.h | 17 --- src/install+setup/install/main.c | 33 ++---- src/install+setup/install/scsi.c | 29 ----- src/install+setup/install/usb.c | 118 -------------------- src/install+setup/setup/setup.h | 3 - src/misc-progs/Makefile | 5 +- src/misc-progs/restartsyslogd.c | 167 ---------------------------- src/scripts/httpscert | 1 - 12 files changed, 14 insertions(+), 437 deletions(-) delete mode 100644 src/install+setup/install/ide.c delete mode 100644 src/install+setup/install/scsi.c delete mode 100644 src/install+setup/install/usb.c delete mode 100644 src/misc-progs/restartsyslogd.c diff --git a/config/rootfiles/common/misc-progs b/config/rootfiles/common/misc-progs index 91085966b..419920c04 100644 --- a/config/rootfiles/common/misc-progs +++ b/config/rootfiles/common/misc-progs @@ -17,7 +17,6 @@ usr/local/bin/qosctrl usr/local/bin/rebuildhosts usr/local/bin/redctrl usr/local/bin/restartssh -usr/local/bin/restartsyslogd usr/local/bin/restartwireless #usr/local/bin/sambactrl usr/local/bin/setaliases diff --git a/doc/packages-list.txt b/doc/packages-list.txt index ca7aea70a..a90f58711 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -28,7 +28,6 @@ * Net-Server-0.93 * Net_SSLeay.pm-1.25 * Python-2.4.3 -* SnortSnarf-050314.1 * Text-Tabs+Wrap-2005.0824 * URI-1.35 * Unix-Syslog-0.100 @@ -52,7 +51,6 @@ * bwm-ng-0.6 * bzip2-1.0.3 * calamaris-2.59 -* capi4k-utils-2005-07-18 * ccache-2.4 * cdrtools-2.01 * cftp-0.12 @@ -77,11 +75,6 @@ * ethtool-3 * expat-2.0.0 * ez-ipupdate-3.0.11b8 -* fcdsl-suse93-3.11-07 -* fcdsl2-suse93-3.11-07 -* fcdslsl-suse93-3.11-07 -* fcdslslusb-suse93-3.11-05 -* fcdslusb-suse93-3.11-07 * fcron-3.0.1 * fetchmail-6.3.4 * file-4.17 diff --git a/src/install+setup/install/Makefile b/src/install+setup/install/Makefile index 6f3a66fbd..9fddb4f70 100644 --- a/src/install+setup/install/Makefile +++ b/src/install+setup/install/Makefile @@ -23,7 +23,7 @@ clean : ###### -OBJS=main.o ide.o nic.o net.o config.o ../libsmooth/libsmooth.o usb.o scsi.o unattended.o +OBJS=main.o nic.o net.o config.o ../libsmooth/libsmooth.o unattended.o install: $(OBJS) $(LINK) $(OBJS) -o $@ $(LIBS) diff --git a/src/install+setup/install/ide.c b/src/install+setup/install/ide.c deleted file mode 100644 index 795e69dca..000000000 --- a/src/install+setup/install/ide.c +++ /dev/null @@ -1,68 +0,0 @@ -/* SmoothWall install program. - * - * This program is distributed under the terms of the GNU General Public - * Licence. See the file COPYING for details. - * - * (c) Lawrence Manning, 2001 - * Contains some functs for scanning /proc for ide info on CDROMS and - * harddisks. - * - */ - -#include "install.h" - -int initialize_ide() { - mysystem("/sbin/modprobe ide-generic"); - mysystem("/sbin/modprobe generic"); - mysystem("/sbin/modprobe ide-cd"); - mysystem("/sbin/modprobe ide-disk"); - - return 0; -} - -/* checkide(). Scans the named drive letter and returns the IDE_??? type. */ -int checkide(char letter) -{ - FILE *f = NULL; - char filename[STRING_SIZE]; - char buffer[STRING_SIZE]; - - sprintf(filename, "/proc/ide/hd%c/media", letter); - - if (!(f = fopen(filename, "r"))) - return IDE_EMPTY; - - if (!(fgets(buffer, STRING_SIZE, f))) - { - printf("Couldn't read from %s\n", filename); - fclose(f); - return IDE_EMPTY; - } - - fclose(f); - - stripnl(buffer); - - if (strcmp(buffer, "cdrom") == 0) - return IDE_CDROM; - else if (strcmp(buffer, "disk") == 0) - return IDE_HD; - else - return IDE_UNKNOWN; -} - -/* findidetype(). Finds the first ide deveice of the given IDE_?? type. */ -char findidetype(int type) -{ - char letter; - - for (letter = 'a'; letter <= 'z'; letter++) - { - if ((checkide(letter)) == type) - { - return letter; - } - } - return '\0'; -} - diff --git a/src/install+setup/install/install.h b/src/install+setup/install/install.h index be62c8b36..14df0531a 100644 --- a/src/install+setup/install/install.h +++ b/src/install+setup/install/install.h @@ -26,14 +26,6 @@ struct devparams char options[STRING_SIZE]; }; -/* ide.c */ -int initialize_ide(); -int checkide(char letter); -char findidetype(int type); - -/* cdrom.c */ -int ejectcdrom(char *dev); - /* nic.c */ int networkmenu(struct keyvalue *ethernetkv); @@ -45,14 +37,5 @@ int write_disk_configs(struct devparams *dp); int write_lang_configs( char *lang); int write_ethernet_configs(struct keyvalue *ethernetkv); -/* usb.c */ -int initialize_usb(); -int write_usb_modules_conf(); -int checkusb (char *partition); - -/* scsi.c */ -int try_scsi(char *dev); -int get_boot(char *dev); - /* unattended.c */ int unattended_setup(struct keyvalue *unattendedkv); diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index 6732c8aac..c8c14bbcc 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -142,29 +142,23 @@ int main(int argc, char *argv[]) { fprintf(flog, "Couldn't open commandline: /proc/cmdline\n"); } else { + mysystem("/sbin/modprobe ide-generic"); + mysystem("/sbin/modprobe generic"); + mysystem("/sbin/modprobe ide-cd"); + mysystem("/sbin/modprobe ide-disk"); + mysystem("/sbin/modprobe sd_mod"); + mysystem("/sbin/modprobe sr_mod"); + mysystem("/sbin/modprobe usb-storage"); + fgets(line, STRING_SIZE, cmdfile); - if (strstr (line, "noide") == NULL) { - fprintf(flog, "Initializing IDE controllers.\n"); - initialize_ide(); - } else { - fprintf(flog, "Skipping IDE detection.\n"); - } - if (strstr (line, "nousb") == NULL) { - fprintf(flog, "Initializing USB controllers.\n"); - initialize_usb(); - } else { - fprintf(flog, "Skipping USB detection.\n"); - } + // check if we have to make an unattended install if (strstr (line, "unattended") != NULL) { unattended = 1; } - // Loading the cdrom-filesystem and ext2 - mysystem("/sbin/modprobe iso9660"); - mysystem("/sbin/modprobe ext2"); - - // Loading the via_rhine driver because it isn't detected correctly (sometimes) - mysystem("/sbin/modprobe via-rhine"); + mysystem("/sbin/modprobe iso9660"); // CDROM + mysystem("/sbin/modprobe ext2"); // Boot patition + mysystem("/sbin/modprobe vfat"); // USB key } if (unattended) { @@ -535,9 +529,6 @@ int main(int argc, char *argv[]) errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]); goto EXIT; } - - /* Save USB controller type to modules.conf */ - write_usb_modules_conf(); /* Save language und local settings */ write_lang_configs(shortlangname); diff --git a/src/install+setup/install/scsi.c b/src/install+setup/install/scsi.c deleted file mode 100644 index b9c2fe097..000000000 --- a/src/install+setup/install/scsi.c +++ /dev/null @@ -1,29 +0,0 @@ -/* IPCop install program. - * - * This program is distributed under the terms of the GNU General Public - * Licence. See the file COPYING for details. - * - * (c) Alan Hourihane, 2003 - * - * $Id: scsi.c - * - */ - -#include "install.h" - -int -try_scsi(char *disk_device) -{ - int fd; - char dev[10]; - - sprintf(dev, "/dev/%s", disk_device); - - if ((fd = open(dev, O_RDONLY)) < 0) - return 0; - - close(fd); - // remove usb scsi - return (checkusb(disk_device) ? 0:1); - //return 1; -} diff --git a/src/install+setup/install/usb.c b/src/install+setup/install/usb.c deleted file mode 100644 index 57ba56f50..000000000 --- a/src/install+setup/install/usb.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This file is part of the IPCop Firewall. - * - * IPCop is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * IPCop is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with IPCop; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Copyright 2002: Mark Wormgoor - * - */ - -#include "install.h" - -int usbuhci = 0; -int usbohci = 0; -int ehcihcd = 0; - -int initialize_usb() { - mysystem("/sbin/modprobe sd_mod"); - mysystem("/sbin/modprobe sr_mod"); - mysystem("/sbin/modprobe usb-storage"); - mysystem("/sbin/modprobe vfat"); - - if (ehcihcd) { - mysystem("/sbin/rmmod ehci-hcd"); - ehcihcd = 0; - } - if (usbohci) { - mysystem("/sbin/rmmod ohci-hcd"); - usbohci = 0; - } - if (usbuhci) { - mysystem("/sbin/rmmod uhci-hcd"); - usbuhci = 0; - } - - if (mysystem("/sbin/modprobe ehci-hcd") == 0) - ehcihcd = 1; - if (mysystem("/sbin/modprobe ohci-hcd") == 0) - usbohci = 1; - if (mysystem("/sbin/modprobe uhci-hcd") == 0) - usbuhci = 1; - - mysystem("/sbin/modprobe usbhid"); - return 0; -} - -int write_usb_modules_conf() { - int index; - FILE *handle; - - if (!(handle = fopen("/harddisk/etc/modules.conf", "a"))) - return 0; - - index = 0; - -#if 0 /* we don't do this yet, because one of the drivers has a problem - * with it */ - if (ehcihcd) { - if (index) - fprintf(handle,"alias usb-controller%d ehci-hcd\n",index); - else - fprintf(handle,"alias usb-controller ehci-hcd\n"); - index++; - } -#endif - - if (usbohci) { - if (index) - fprintf(handle,"alias usb-controller%d ohci-hcd\n",index); - else - fprintf(handle,"alias usb-controller ohci-hcd\n"); - index++; - } - - if (usbuhci) { - if (index) - fprintf(handle,"alias usb-controller%d uhci-hcd\n",index); - else - fprintf(handle,"alias usb-controller uhci-hcd\n"); - index++; - } - fclose(handle); - - return 0; -} - -/* Scans the named partitions and returns true if USB-removable. */ -int checkusb(char *device) -{ - FILE *f = NULL; - char filename[STRING_SIZE]; - char command[STRING_SIZE]; - char buffer[STRING_SIZE]; - int found = 0; - - sprintf(command, "udevinfo -a -p /sys/block/%s | grep BUS | sort| uniq >/tmp/usbscan 2>/dev/null", device); - system(command); - - f = fopen("/tmp/usbscan", "r"); - while (fgets(buffer, STRING_SIZE, f)) { - if (strstr(buffer,"usb")) found=1; - } - fclose(f); - - if (found) return 0; - else return 1; -} diff --git a/src/install+setup/setup/setup.h b/src/install+setup/setup/setup.h index 064ebff88..f1b9129ed 100644 --- a/src/install+setup/setup/setup.h +++ b/src/install+setup/setup/setup.h @@ -18,9 +18,6 @@ int handlehostname(void); /* domainname.c */ int handledomainname(void); -/* isdn.c */ -int handleisdn(void); - /* networking.c */ int handlenetworking(void); diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile index c7eb052c0..01889fe5a 100644 --- a/src/misc-progs/Makefile +++ b/src/misc-progs/Makefile @@ -8,7 +8,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \ squidctrl restartssh ipfirereboot setaliases \ ipsecctrl timectrl dhcpctrl snortctrl \ applejuicectrl rebuildhosts backupctrl \ - restartsyslogd logwatch openvpnctrl outgoingfwctrl \ + logwatch openvpnctrl outgoingfwctrl \ restartwireless getipstat qosctrl launch-ether-wake \ redctrl extrahdctrl sambactrl upnpctrl tripwirectrl \ smartctrl clamavctrl pakfire mpfirectrl @@ -106,9 +106,6 @@ 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 $@ -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 $@ - 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 $@ diff --git a/src/misc-progs/restartsyslogd.c b/src/misc-progs/restartsyslogd.c deleted file mode 100644 index ee36f0483..000000000 --- a/src/misc-progs/restartsyslogd.c +++ /dev/null @@ -1,167 +0,0 @@ -/* This file is part of the IPCop Firewall. - * - * This program is distributed under the terms of the GNU General Public - * Licence. See the file COPYING for details. - * - * Copyright (C) 2003-07-12 Robert Kerr - * - * $Id: restartsyslogd.c,v 1.2.2.3 2004/12/14 17:56:37 gespinasse Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "libsmooth.h" -#include "setuid.h" - -#define ERR_ANY 1 -#define ERR_SETTINGS 2 /* error in settings file */ -#define ERR_ETC 3 /* error with /etc permissions */ -#define ERR_CONFIG 4 /* error updated sshd_config */ -#define ERR_SYSLOG 5 /* error restarting syslogd */ - -int main(void) -{ - char buffer[STRING_SIZE], hostname[STRING_SIZE]; - int config_fd,rc,fd,pid; - struct stat st; - struct keyvalue *kv = NULL; - memset(buffer, 0, STRING_SIZE); - memset(hostname, 0, STRING_SIZE); - - if (!(initsetuid())) - exit(1); - - - /* Read in and verify config */ - kv=initkeyvalues(); - - if (!readkeyvalues(kv, CONFIG_ROOT "/logging/settings")) - { - fprintf(stderr, "Cannot read syslog settings\n"); - exit(ERR_SETTINGS); - } - - if (!findkey(kv, "ENABLE_REMOTELOG", buffer)) - { - fprintf(stderr, "Cannot read ENABLE_REMOTELOG\n"); - exit(ERR_SETTINGS); - } - - if (!findkey(kv, "REMOTELOG_ADDR", hostname)) - { - fprintf(stderr, "Cannot read REMOTELOG_ADDR\n"); - exit(ERR_SETTINGS); - } - - if (strspn(hostname, VALID_FQDN) != strlen(hostname)) - { - fprintf(stderr, "Bad REMOTELOG_ADDR: %s\n", hostname); - exit(ERR_SETTINGS); - } - - freekeyvalues(kv); - - - /* If anyone other than root can write to /etc this would be totally - * insecure - same if anyone other than root owns /etc, as they could - * change the file mode to give themselves or anyone else write access. */ - if(lstat("/etc",&st)) - { - perror("Unable to stat /etc"); - exit(ERR_ETC); - } - if(!S_ISDIR(st.st_mode)) - { - fprintf(stderr,"/etc is not a directory?!\n"); - exit(ERR_ETC); - } - if ( st.st_uid != 0 || st.st_mode & S_IWOTH || - ((st.st_gid != 0) && (st.st_mode & S_IWGRP)) ) - { - fprintf(stderr,"/etc is owned/writable by non-root users\n"); - exit(ERR_ETC); - } - - /* O_CREAT with O_EXCL will make open() fail if the file already exists - - * mostly to prevent 2 copies running at once */ - if ((config_fd = open( "/etc/syslog.conf.new", O_WRONLY|O_CREAT|O_EXCL, 0644 )) == -1 ) - { - perror("Unable to open new config file"); - exit(ERR_CONFIG); - } - - if (!strcmp(buffer,"on")) - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@\\).\\+$/\\1%s/' /etc/syslog.conf >&%d", hostname, config_fd ); - else - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@.\\+\\)$/#\\1/' /etc/syslog.conf >&%d", config_fd ); - - /* if the return code isn't 0 failsafe */ - if ((rc = unpriv_system(buffer,99,99)) != 0) - { - fprintf(stderr, "sed returned bad exit code: %d\n", rc); - close(config_fd); - unlink("/etc/syslog.conf.new"); - exit(ERR_CONFIG); - } - close(config_fd); - if (rename("/etc/syslog.conf.new","/etc/syslog.conf") == -1) - { - perror("Unable to replace old config file"); - unlink("/etc/syslog.conf.new"); - exit(ERR_CONFIG); - } - - - /* Get syslogd to read the new config file */ - if ((fd = open("/var/run/syslogd.pid", O_RDONLY)) == -1) - { - if(errno == ENOENT) - { - /* pid file doesn't exists.. restart syslog */ - if((rc = safe_system("/usr/sbin/syslogd -m 0")) == 0 ) - return 0; - else - { - fprintf(stderr, - "Unable to restart syslogd - returned exit code %d\n", rc); - exit(ERR_SYSLOG); - } - } else { - /* Something odd is going on, failsafe */ - perror("Unable to open pid file"); - exit(ERR_SYSLOG); - } - } - - memset(buffer, 0, STRING_SIZE); - if (read(fd, buffer, STRING_SIZE - 1) == -1) - { - close(fd); - perror("Couldn't read from pid file"); - exit(ERR_SYSLOG); - } - close(fd); - /* strtol does sanity checks that atoi doesn't do */ - errno = 0; - pid = (int)strtol(buffer, (char **)NULL, 10); - if (errno || pid <= 1) - { - fprintf(stderr, "Bad pid value\n"); - exit(ERR_SYSLOG); - } - if (kill(pid, SIGHUP) == -1) - { - fprintf(stderr, "Unable to send SIGHUP\n"); - exit(ERR_SYSLOG); - } - - return 0; -} diff --git a/src/scripts/httpscert b/src/scripts/httpscert index 2c5a92829..fb2d64bac 100644 --- a/src/scripts/httpscert +++ b/src/scripts/httpscert @@ -1,6 +1,5 @@ #!/bin/sh # -# $Id: httpscert,v 1.1.2.2 2005/12/15 21:59:57 eoberlander Exp $ # new : generate new certificate # read: read issuer in certificate and verify if it is the same as hostname -- 2.39.2