Den Installer ordentlich abgespeckt.

restartsyslogd entfernt.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@773 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-08-17 09:01:02 +00:00
parent a358af8c7c
commit 61e3d21873
12 changed files with 14 additions and 437 deletions

View File

@@ -17,7 +17,6 @@ usr/local/bin/qosctrl
usr/local/bin/rebuildhosts usr/local/bin/rebuildhosts
usr/local/bin/redctrl usr/local/bin/redctrl
usr/local/bin/restartssh usr/local/bin/restartssh
usr/local/bin/restartsyslogd
usr/local/bin/restartwireless usr/local/bin/restartwireless
#usr/local/bin/sambactrl #usr/local/bin/sambactrl
usr/local/bin/setaliases usr/local/bin/setaliases

View File

@@ -28,7 +28,6 @@
* Net-Server-0.93 * Net-Server-0.93
* Net_SSLeay.pm-1.25 * Net_SSLeay.pm-1.25
* Python-2.4.3 * Python-2.4.3
* SnortSnarf-050314.1
* Text-Tabs+Wrap-2005.0824 * Text-Tabs+Wrap-2005.0824
* URI-1.35 * URI-1.35
* Unix-Syslog-0.100 * Unix-Syslog-0.100
@@ -52,7 +51,6 @@
* bwm-ng-0.6 * bwm-ng-0.6
* bzip2-1.0.3 * bzip2-1.0.3
* calamaris-2.59 * calamaris-2.59
* capi4k-utils-2005-07-18
* ccache-2.4 * ccache-2.4
* cdrtools-2.01 * cdrtools-2.01
* cftp-0.12 * cftp-0.12
@@ -77,11 +75,6 @@
* ethtool-3 * ethtool-3
* expat-2.0.0 * expat-2.0.0
* ez-ipupdate-3.0.11b8 * 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 * fcron-3.0.1
* fetchmail-6.3.4 * fetchmail-6.3.4
* file-4.17 * file-4.17

View File

@@ -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) install: $(OBJS)
$(LINK) $(OBJS) -o $@ $(LIBS) $(LINK) $(OBJS) -o $@ $(LIBS)

View File

@@ -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';
}

View File

@@ -26,14 +26,6 @@ struct devparams
char options[STRING_SIZE]; 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 */ /* nic.c */
int networkmenu(struct keyvalue *ethernetkv); int networkmenu(struct keyvalue *ethernetkv);
@@ -45,14 +37,5 @@ int write_disk_configs(struct devparams *dp);
int write_lang_configs( char *lang); int write_lang_configs( char *lang);
int write_ethernet_configs(struct keyvalue *ethernetkv); 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 */ /* unattended.c */
int unattended_setup(struct keyvalue *unattendedkv); int unattended_setup(struct keyvalue *unattendedkv);

View File

@@ -142,29 +142,23 @@ int main(int argc, char *argv[])
{ {
fprintf(flog, "Couldn't open commandline: /proc/cmdline\n"); fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
} else { } 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); 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 // check if we have to make an unattended install
if (strstr (line, "unattended") != NULL) { if (strstr (line, "unattended") != NULL) {
unattended = 1; unattended = 1;
} }
// Loading the cdrom-filesystem and ext2 mysystem("/sbin/modprobe iso9660"); // CDROM
mysystem("/sbin/modprobe iso9660"); mysystem("/sbin/modprobe ext2"); // Boot patition
mysystem("/sbin/modprobe ext2"); mysystem("/sbin/modprobe vfat"); // USB key
// Loading the via_rhine driver because it isn't detected correctly (sometimes)
mysystem("/sbin/modprobe via-rhine");
} }
if (unattended) { if (unattended) {
@@ -535,9 +529,6 @@ int main(int argc, char *argv[])
errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]); errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
goto EXIT; goto EXIT;
} }
/* Save USB controller type to modules.conf */
write_usb_modules_conf();
/* Save language und local settings */ /* Save language und local settings */
write_lang_configs(shortlangname); write_lang_configs(shortlangname);

View File

@@ -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 <alanh@fairlite.demon.co.uk>
*
* $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;
}

View File

@@ -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 <mark@wormgoor.com>
*
*/
#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;
}

View File

@@ -18,9 +18,6 @@ int handlehostname(void);
/* domainname.c */ /* domainname.c */
int handledomainname(void); int handledomainname(void);
/* isdn.c */
int handleisdn(void);
/* networking.c */ /* networking.c */
int handlenetworking(void); int handlenetworking(void);

View File

@@ -8,7 +8,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \
squidctrl restartssh ipfirereboot setaliases \ squidctrl restartssh ipfirereboot setaliases \
ipsecctrl timectrl dhcpctrl snortctrl \ ipsecctrl timectrl dhcpctrl snortctrl \
applejuicectrl rebuildhosts backupctrl \ applejuicectrl rebuildhosts backupctrl \
restartsyslogd logwatch openvpnctrl outgoingfwctrl \ logwatch openvpnctrl outgoingfwctrl \
restartwireless getipstat qosctrl launch-ether-wake \ restartwireless getipstat qosctrl launch-ether-wake \
redctrl extrahdctrl sambactrl upnpctrl tripwirectrl \ redctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
smartctrl clamavctrl pakfire mpfirectrl 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 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 $@ $(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 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 $@ $(COMPILE) -I../install+setup/libsmooth/ restartwireless.c setuid.o ../install+setup/libsmooth/varval.o -o $@

View File

@@ -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 <rkerr@go.to>
*
* $Id: restartsyslogd.c,v 1.2.2.3 2004/12/14 17:56:37 gespinasse Exp $
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#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;
}

View File

@@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
# #
# $Id: httpscert,v 1.1.2.2 2005/12/15 21:59:57 eoberlander Exp $
# new : generate new certificate # new : generate new certificate
# read: read issuer in certificate and verify if it is the same as hostname # read: read issuer in certificate and verify if it is the same as hostname