mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Festplattenerkennung ueberarbeitet.
Installationssystem verkleinert. Letzte Tripwirectrl. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@491 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -13,7 +13,6 @@ cron:x:104:104::/:/bin/false
|
||||
syslogd:x:105:105:/var/empty:/bin/false
|
||||
klogd:x:106:106:/var/empty:/bin/false
|
||||
postfix:x:100:100::/var/spool/postfix:/bin/false
|
||||
stunnel:x:51:51:Stunnel Daemon:/var/lib/stunnel:/bin/false
|
||||
clamav:x:109:109:Clam AntiVirus:/home/clamav:/bin/false
|
||||
rsyncd:x:48:48:rsyncd Daemon:/home/rsync:/bin/false
|
||||
amavis:x:110:110:Amavisd-new user:/var/amavis:
|
||||
|
||||
@@ -80,10 +80,10 @@ ifeq "$(LFS_PASS)" "install"
|
||||
cd $(DIR_APP) && ./configure --prefix=/opt/$(MACHINE)-uClibc \
|
||||
--with-libaal=/opt/$(MACHINE)-uClibc \
|
||||
--without-readline --disable-shared \
|
||||
--sbindir=/install/initrd/sbin \
|
||||
--libdir=/install/initrd/lib
|
||||
--sbindir=/install/initrd/sbin
|
||||
cd $(DIR_APP) && make $(MAKETUNING)
|
||||
cd $(DIR_APP) && make install
|
||||
-rm -f /install/initrd/{debugfs.,measurefs.,make_}reiser4
|
||||
else
|
||||
cd $(DIR_APP) && ./configure --prefix=/usr --sbindir=/sbin --enable-static
|
||||
cd $(DIR_APP) && make $(MAKETUNING)
|
||||
|
||||
2
lfs/udev
2
lfs/udev
@@ -82,7 +82,7 @@ ifeq "$(LFS_PASS)" "install"
|
||||
cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev
|
||||
cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev install
|
||||
rm -f /install/initrd/sbin/udev* /install/initrd/usr/sbin/udev* /install/initrd/usr/bin/udev*
|
||||
cd $(DIR_APP) && install udevstart /install/initrd/sbin
|
||||
cd $(DIR_APP) && install udevstart udevinfo /install/initrd/sbin
|
||||
cd /install/initrd/usr/share && rm -rf man
|
||||
cd /install/initrd/dev && rm -f console
|
||||
cd /install/initrd/dev && mknod -m 0600 console c 5 1
|
||||
|
||||
6
make.sh
6
make.sh
@@ -605,9 +605,9 @@ buildpackages() {
|
||||
beautify message DONE
|
||||
|
||||
# Create images for install
|
||||
#if [ ! -f $BASEDIR/ipfire-$VERSION.i586-devel.iso ]; then
|
||||
# ipfiremake cdrom ED=devel
|
||||
#fi
|
||||
if [ "$DEVEL" == "1" ]; then
|
||||
ipfiremake cdrom ED=devel
|
||||
fi
|
||||
ipfiremake cdrom ED=full
|
||||
|
||||
# Check if there is a loop device for building in virtual environments
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
/* CDROMS and harddisks. */
|
||||
struct devparams
|
||||
{
|
||||
char devnode[STRING_SIZE];
|
||||
int module;
|
||||
char devnode_disk[30]; // when single partition is addressed
|
||||
char devnode_part[30]; // when the RAID partition is addressed
|
||||
char devnode_disk_run[30]; // the same dev but after installation
|
||||
char devnode_part_run[30];
|
||||
char modulename[STRING_SIZE];
|
||||
char options[STRING_SIZE];
|
||||
};
|
||||
@@ -45,6 +47,7 @@ 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);
|
||||
|
||||
@@ -201,9 +201,8 @@ int main(int argc, char *argv[])
|
||||
fprintf(flog, "Source drive: %s\n", sourcedrive);
|
||||
fclose(handle);
|
||||
|
||||
snprintf(cdromparams.devnode, STRING_SIZE, "/dev/%s", sourcedrive);
|
||||
cdromparams.module = 0;
|
||||
fprintf(flog, "Source device: %s\n", cdromparams.devnode);
|
||||
//snprintf(cdromparams.devnode_disk, STRING_SIZE, "/dev/%s", sourcedrive);
|
||||
fprintf(flog, "Source device: %s\n", sourcedrive);
|
||||
}
|
||||
|
||||
/* Configure the network now! */
|
||||
@@ -221,71 +220,86 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/* Get device for the HD. This has to succeed. */
|
||||
if (!(hdletter = findidetype(IDE_HD)))
|
||||
{
|
||||
/* Need to clean this up at some point */
|
||||
if (!try_scsi("sda") || strstr(sourcedrive, "sda") != NULL) {
|
||||
if (!try_scsi("ida/c0d0")) {
|
||||
if (!try_scsi("cciss/c0d0")) {
|
||||
if (!try_scsi("rd/c0d0")) {
|
||||
if (!try_scsi("ataraid/d0")) {
|
||||
errorbox(ctr[TR_NO_HARDDISK]);
|
||||
goto EXIT;
|
||||
} else {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "ataraid/d0");
|
||||
}
|
||||
} else {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "rd/c0d0");
|
||||
}
|
||||
} else {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "cciss/c0d0");
|
||||
}
|
||||
} else {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "ida/c0d0");
|
||||
}
|
||||
} else {
|
||||
if (strstr(sourcedrive, "sda") != NULL) {
|
||||
// probably installing from usb stick, try sdb
|
||||
if (try_scsi("sdb")) {
|
||||
sprintf(harddrive, "sdb");
|
||||
}
|
||||
else {
|
||||
errorbox(ctr[TR_NO_HARDDISK]);
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sprintf(harddrive, "sda");
|
||||
}
|
||||
}
|
||||
scsi_disk = 1;
|
||||
} else
|
||||
// Now try to find destination device...
|
||||
if ((hdletter = findidetype(IDE_HD))) {
|
||||
sprintf(harddrive, "hd%c", hdletter);
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
|
||||
/* Need to clean this up at some point
|
||||
scsi disk is sdb/sdc when sda/sdb is used for usb-key
|
||||
if scsi-disk is sdd or more, it is not discovered
|
||||
Support only 2 usb keys, none could be unplugged */
|
||||
if (checkusb("sdb") && try_scsi("sdc")) {
|
||||
scsi_disk = 1;
|
||||
sprintf(harddrive, "sdc");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
if (checkusb("sda") && try_scsi("sdb")) {
|
||||
scsi_disk = 1;
|
||||
sprintf(harddrive, "sdb");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
if (try_scsi("sda")) {
|
||||
scsi_disk = 1;
|
||||
sprintf(harddrive, "sda");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
if (try_scsi("ida/c0d0")) {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "ida/c0d0");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
if (try_scsi("cciss/c0d0")) {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "cciss/c0d0");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
if (try_scsi("rd/c0d0")) {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "rd/c0d0");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
if (try_scsi("ataraid/d0")) {
|
||||
raid_disk = 1;
|
||||
sprintf(harddrive, "ataraid/d0");
|
||||
goto FOUND_DESTINATION;
|
||||
}
|
||||
/* nothing worked, give up */
|
||||
errorbox(ctr[TR_NO_HARDDISK]);
|
||||
goto EXIT;
|
||||
|
||||
fprintf(flog, "Destination drive: %s\n", harddrive);
|
||||
|
||||
FOUND_DESTINATION:
|
||||
/* load unattended configuration */
|
||||
if (unattended) {
|
||||
fprintf(flog, "unattended: Reading unattended.conf\n");
|
||||
|
||||
(void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
|
||||
}
|
||||
|
||||
/* Make the hdparms struct and print the contents. */
|
||||
snprintf(hdparams.devnode, STRING_SIZE, "/dev/%s", harddrive);
|
||||
hdparams.module = 0;
|
||||
|
||||
sprintf(message, ctr[TR_PREPARE_HARDDISK], hdparams.devnode);
|
||||
|
||||
/* Make the hdparms struct and print the contents.
|
||||
With USB-KEY install and SCSI disk, while installing, the disk
|
||||
is named 'sdb,sdc,...' (following keys)
|
||||
On reboot, it will become 'sda'
|
||||
To avoid many test, all names are built in the struct.
|
||||
*/
|
||||
sprintf(hdparams.devnode_disk, "/dev/%s", harddrive);
|
||||
/* Address the partition or raid partition (eg dev/sda or /dev/sdap1 */
|
||||
sprintf(hdparams.devnode_part, "/dev/%s%s", harddrive,raid_disk ? "p" : "");
|
||||
/* Now the names after the machine is booted. Only scsi is affected
|
||||
and we only install on the first scsi disk. */
|
||||
{ char tmp[30];
|
||||
strcpy(tmp, scsi_disk ? "sda" : harddrive);
|
||||
sprintf(hdparams.devnode_disk_run, "/dev/%s", tmp);
|
||||
sprintf(hdparams.devnode_part_run, "/dev/%s%s", tmp, raid_disk ? "p" : "");
|
||||
}
|
||||
|
||||
fprintf(flog, "Destination drive: %s\n", hdparams.devnode_disk);
|
||||
|
||||
sprintf(message, ctr[TR_PREPARE_HARDDISK], hdparams.devnode_disk);
|
||||
if (unattended) {
|
||||
hardyn = 1;
|
||||
}
|
||||
|
||||
while (! hardyn) {
|
||||
rc = newtWinMenu(title, message,
|
||||
50, 5, 5, 6, yesnoharddisk,
|
||||
@@ -294,7 +308,6 @@ int main(int argc, char *argv[])
|
||||
if (rc == 2)
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (rc == 2)
|
||||
goto EXIT;
|
||||
|
||||
@@ -383,7 +396,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fclose(handle);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sfdisk -L -uM %s < /tmp/partitiontable", hdparams.devnode);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sfdisk -L -uM %s < /tmp/partitiontable", hdparams.devnode_disk);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_PARTITIONING_DISK]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_PARTITION]);
|
||||
@@ -392,10 +405,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
mysystem("/sbin/udevstart");
|
||||
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %sp1", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %s1", hdparams.devnode);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %s1", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MAKING_BOOT_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM]);
|
||||
@@ -403,10 +413,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (swap_file) {
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkswap %sp2", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkswap %s2", hdparams.devnode);
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkswap %s2", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MAKING_SWAPSPACE]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MAKE_SWAPSPACE]);
|
||||
@@ -414,22 +421,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %sp3", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %s3", hdparams.devnode);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %s3", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MAKING_ROOT_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM]);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %sp4", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %s4", hdparams.devnode);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %s4", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MAKING_LOG_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM]);
|
||||
@@ -437,10 +436,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Mount harddisk. */
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %sp3 /harddisk", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %s3 /harddisk", hdparams.devnode);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %s3 /harddisk", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_ROOT_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MOUNT_ROOT_FILESYSTEM]);
|
||||
@@ -451,31 +448,21 @@ int main(int argc, char *argv[])
|
||||
mkdir("/harddisk/var", S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
mkdir("/harddisk/var/log", S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %sp1 /harddisk/boot", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %s1 /harddisk/boot", hdparams.devnode);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %s1 /harddisk/boot", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_BOOT_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MOUNT_BOOT_FILESYSTEM]);
|
||||
goto EXIT;
|
||||
}
|
||||
if (swap_file) {
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/swapon %sp2", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/swapon %s2", hdparams.devnode);
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/swapon %s2", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_SWAP_PARTITION]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MOUNT_SWAP_PARTITION]);
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %sp4 /harddisk/var", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %s4 /harddisk/var", hdparams.devnode);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/mount %s4 /harddisk/var", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_LOG_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MOUNT_LOG_FILESYSTEM]);
|
||||
@@ -487,7 +474,7 @@ int main(int argc, char *argv[])
|
||||
"/bin/wget -q -O - %s/" SNAME "-" VERSION ".tbz2 | /bin/tar -C /harddisk -xvjf -", url);
|
||||
}
|
||||
|
||||
if (installtype == CDROM_INSTALL) {
|
||||
if (installtype == CDROM_INSTALL) {
|
||||
snprintf(commandstring, STRING_SIZE,
|
||||
"/bin/tar -C /harddisk -xvjf /cdrom/" SNAME "-" VERSION ".tbz2");
|
||||
}
|
||||
@@ -532,7 +519,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Update /etc/fstab */
|
||||
replace("/harddisk/etc/fstab", "DEVICE", hdparams.devnode);
|
||||
replace("/harddisk/etc/fstab", "DEVICE", hdparams.devnode_part_run);
|
||||
|
||||
/* if we detected SCSI/USB then fixup */
|
||||
/* mysystem("/bin/probecntrl.sh");
|
||||
@@ -554,12 +541,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
} */
|
||||
|
||||
if (raid_disk)
|
||||
sprintf(string, "root=%sp3", hdparams.devnode);
|
||||
else
|
||||
sprintf(string, "root=%s3", hdparams.devnode);
|
||||
sprintf(string, "root=%s3", hdparams.devnode_part_run);
|
||||
replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string);
|
||||
replace( "/harddisk/boot/grub/grubbatch", "DEVICE", hdparams.devnode);
|
||||
replace( "/harddisk/boot/grub/grubbatch", "DEVICE", hdparams.devnode_disk);
|
||||
|
||||
/* restore permissions */
|
||||
chmod("/harddisk/boot/grub/grubbatch", S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH);
|
||||
@@ -633,10 +617,7 @@ EXIT:
|
||||
fcloseall();
|
||||
|
||||
if (swap_file) {
|
||||
if (raid_disk)
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/swapoff %sp2", hdparams.devnode);
|
||||
else
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/swapoff %s2", hdparams.devnode);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/swapoff %s2", hdparams.devnode_part);
|
||||
}
|
||||
|
||||
newtFinished();
|
||||
|
||||
@@ -23,6 +23,7 @@ try_scsi(char *disk_device)
|
||||
return 0;
|
||||
|
||||
close(fd);
|
||||
|
||||
return 1;
|
||||
// remove usb scsi
|
||||
return (checkusb(disk_device) ? 0:1);
|
||||
//return 1;
|
||||
}
|
||||
|
||||
@@ -95,3 +95,25 @@ int write_usb_modules_conf() {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \
|
||||
restartapplejuice setdate rebuildhosts \
|
||||
restartsyslogd logwatch openvpnctrl timecheckctrl \
|
||||
restartwireless getipstat qosctrl launch-ether-wake \
|
||||
redctrl extrahdctrl sambactrl upnpctrl
|
||||
redctrl extrahdctrl sambactrl upnpctrl tripwirectrl
|
||||
|
||||
install : all
|
||||
install -m 755 $(PROGS) /usr/local/bin
|
||||
@@ -54,6 +54,9 @@ upnpctrl: upnpctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
sambactrl: sambactrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ sambactrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
tripwirectrl: tripwirectrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ tripwirectrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
launch-ether-wake: launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
|
||||
@@ -25,83 +25,76 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (strcmp(argv[1], "tripwirelog")==0)
|
||||
{
|
||||
char log;
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twprint -m r --twrfile /var/ipfire/tripwire/report/%s", argv[2]);
|
||||
log=safe_system(command);
|
||||
printf(command);
|
||||
return(log);
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twprint -m r --cfgfile /var/ipfire/tripwire/tw.cfg --twrfile /var/ipfire/tripwire/report/%s", argv[2]);
|
||||
safe_system(command);
|
||||
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.cfg");
|
||||
printf(command);
|
||||
safe_system("/usr/sbin/tripwire --check --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.pol");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "updatedatabase")==0)
|
||||
{
|
||||
char file;
|
||||
file=safe_system("ls -S | tail -1");
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --update --accept-all --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.cfg --local-passphrase %s --twrfile %s", argv[2], file);
|
||||
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);
|
||||
printf(command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "keys")==0)
|
||||
{
|
||||
printf("\nGenerating Site-Key");
|
||||
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);
|
||||
printf(command);
|
||||
snprintf(command, BUFFER_SIZE-1, "rm -rf /var/ipfire/tripwire/$(HOSTNAME)-local.key && /usr/sbin/twadmin --generate-keys --local-keyfile /var/ipfire/tripwire/$(HOSTNAME)-local.key --local-passphrase %s && chmod 640 /var/ipfire/tripwire/$(HOSTNAME)-local.key", argv[3]);
|
||||
printf("\nGenerating Local-Key");
|
||||
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);
|
||||
printf(command);
|
||||
printf("\nGenerating Config File");
|
||||
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);
|
||||
printf(command);
|
||||
printf("\nGenerating Policy File");
|
||||
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);
|
||||
printf(command);
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init --cfgfile /var/ipfire/tripwire/tw.cfg --polfile /var/ipfire/tripwire/tw.cfg --site-passphrase %s", argv[2]);
|
||||
printf("\nInitialising - This may take a while depending on your Policy");
|
||||
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);
|
||||
printf(command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "generatepolicy")==0)
|
||||
{
|
||||
printf("\nGenerating Policy File");
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twadmin --generate-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(command);
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init -c /var/ipfire/tripwire/tw.cfg -p /var/ipfire/tripwire/tw.cfg --site-passphrase %s", argv[2]);
|
||||
printf("\nInitialising - This may take a while depending on your Policy");
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init -c /var/ipfire/tripwire/tw.cfg -p /var/ipfire/tripwire/tw.cfg --local-passphrase %s", argv[3]);
|
||||
safe_system(command);
|
||||
printf(command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "resetpolicy")==0)
|
||||
{
|
||||
printf("\nGenerating Policy File");
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/twadmin --generate-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);
|
||||
printf(command);
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init -c /var/ipfire/tripwire/tw.cfg -p /var/ipfire/tripwire/tw.cfg --site-passphrase %s", argv[2]);
|
||||
printf("\nInitialising - This may take a while depending on your Policy");
|
||||
snprintf(command, BUFFER_SIZE-1, "/usr/sbin/tripwire --init -c /var/ipfire/tripwire/tw.cfg -p /var/ipfire/tripwire/tw.cfg --local-passphrase %s", argv[3]);
|
||||
safe_system(command);
|
||||
printf(command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "readconfig")==0)
|
||||
{
|
||||
safe_system("/bin/chown nobody:nobody /var/ipfire/tripwire/twcfg.txt");
|
||||
printf(command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "lockconfig")==0)
|
||||
{
|
||||
safe_system("/bin/chown root:root /var/ipfire/tripwire/twcfg.txt");
|
||||
printf(command);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user