summaryrefslogtreecommitdiffstats
path: root/docs/README
blob: 71b23c84d289dd7abc6a972e70c74ee1e88eee27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
-rw-r--r--perl-install/network/adsl.pm336
-rw-r--r--perl-install/network/adsl_consts.pm979
-rw-r--r--perl-install/network/dhcpd.pm50
-rw-r--r--perl-install/network/drakfirewall.pm283
-rw-r--r--perl-install/network/ethernet.pm162
-rw-r--r--perl-install/network/ifw.pm141
-rw-r--r--perl-install/network/ipsec.pm781
-rw-r--r--perl-install/network/isdn.pm193
-rw-r--r--perl-install/network/isdn_consts.pm460
-rw-r--r--perl-install/network/modem.pm223
-rw-r--r--perl-install/network/monitor.pm83
-rw-r--r--perl-install/network/ndiswrapper.pm108
-rw-r--r--perl-install/network/netconnect.pm1461
-rw-r--r--perl-install/network/network.pm627
-rw-r--r--perl-install/network/nfs.pm68
-rw-r--r--perl-install/network/pxe.pm286
-rw-r--r--perl-install/network/shorewall.pm172
-rw-r--r--perl-install/network/smb.pm217
-rw-r--r--perl-install/network/smbnfs.pm45
-rw-r--r--perl-inWell here is a little description of what DrakX needs to work in comparison to the standard newt install. ******************************************************************************** * CVS ************************************************************************** ******************************************************************************** Like all good free software, DrakX is in CVS :) You can access it at http://www.linux-mandrake.com/cgi-bin/cvsweb.cgi/gi or via export CVS_RSH=ssh export CVSROOT=:ext:anoncvs@cvs.mandrakesoft.com:/cooker cvs checkout gi (enter password 'cvs') This is only read-only access. If you want more, tell me (pixel@mandrakesoft.com) Alas, all is not in CVS as a lot of things are binary files. For the other things, take cooker-contrib others/src/gi.tar.bz2 Please note that redoing *all* the stuff is not for the faint of heart. I myself sometimes wonder what the whole make does :-% Instead, changing some .pm files is quite easy (nice interpreted language) ******************************************************************************** * Making your custom install *************************************************** ******************************************************************************** If you have your own rpms you want to add, or make your own updated cdrom, you just have to issue: % gendistrib --noclean --distrib <DIRS> Where <DIRS> is the root of all the media that the install will see: (1) network or 1-cdrom installs DIRS == the root directory of the Distribution (2) multi-cdrom install DIRS == the root directories of all the media that the install will see ``gendistrib'' will scan, from the DIRS you provide, for some Mandrake/RPMS* directories containing some RPM packages. For multi-cd, please use Mandrake/RPMS, Mandrake/RPMS2, etc. For one CD or a network/hd volume, please use Mandrake/RPMS. Optionnally, you can modify ``Mandrake/base/rpmsrate''; this file manages the relative importance of the files, and thus their installation or not. Also, mdkinst_stage2.gz must be remade if you modify files in Mandrake/mdkinst. See below for information about these files. ******************************************************************************** * FILES ************************************************************************ ******************************************************************************** First here are the different things needed : Mandrake/base/hdlists description of the available install media Mandrake/base/hdlist*.cz table of rpm's headers, referred by ``hdlists'' ! Need to be remade when Mandrake/RPMS changes (with ``gendistrib'') ! Mandrake/base/depslist for each packages, tell which package it depends on. Also contains the size for some (obscure) bloody reasons. ! Need to be remade when Mandrake/RPMS changes ! (with ``misc/gendepslist2 -o Mandrake/base/depslist Mandrake/base/hdlist.cz2'') Mandrake/base/depslist.ordered more compact depslist with closure done, internally indexed Mandrake/base/compss obsoletes comps. It store packages in different categories, generated from the %{GROUP} field Mandrake/base/rpmsrate ranks and classify packages, so that the installer will know which ones to install (see beginning of perl-install/pkgs.pm for more) Mandrake/mdkinst live system used on certain installs. See ``Ramdisk or not'' below for more. Mandrake/base/mdkinst_stage2.gz for the ramdisk. live sytem in ext2 filesystem gzipped. generated from Mandrake/mdkinst tree using misc/make_mdkinst_stage2 See ``Ramdisk or not'' below for more. images/*.img boot images to use with DrakX. Use: - cdrom for cdrom install - network for ftp/nfs install (non-pcmcia devices) - hd for hard-disk install - pcmcia for pcmcia install (see ``PCMCIA install'' below for more) the following modules have been removed from: network.img: acenic sk98lin de4x5 cdrom.img and hd.img: BusLogic seagate fdomain g_NCR5380 dc395x_trm tmscsim hd.img: dpt_i2o eata eata_pio eata_dma cdrom.img: aztcd gscd isp16 mcd mcdx optcd cm206 sjcd pcmcia.img: apa1480_cb they are now in "other.img", if you think one of those modules is used a lot, tell me, i may find some room to put it back on the main floppies. ******************************************************************************** * logs ************************************************************************* ******************************************************************************** During install, a lot of interesting stuff can be found in different places: in consoles and in files. To switch to console 2 for example, do Ctrl-Alt-F2 from the X install. - alt-F1: the stdout of the install. Not very interesting stuff - alt-F2: simple shell. Quite a lot of commands are available but as they are written in perl (for space), they do not handle the very same options as normal. After install, you can do ``chroot /mnt'' to see your system just like after rebooting. ``rpm -qa'' works for example. - alt-F3: a lot of interesting things. Be carefull, some ``ERROR'' messages are not interesting. - alt-F4: kernel's place. aka the output of dmesg. - alt-F7: the graphical install lives there - command "bug" puts on floppy lots of interesting stuff. - /tmp/ddebug.log: same (or nearly the same) as alt-F3 - /tmp/syslog: same as alt-F4 - /mnt/root/ddebug.log: at the end of each step, DrakX tries to backup /tmp/ddebug.log to /mnt/root. Available only after mounting of /. - /mnt/root/install.log: the log of the installation (or upgrade) of the rpms (just like rpm's /mnt/tmp/(install|upgrade).log) - /mnt/root/auto_inst.cfg.pl: a kickstart file generated at the end of each step. Can be used in 2 ways: kickstart install or ``defcfg'' install. Hopefully you know about kickstart. ``defcfg'' is a way to customize the default values in install. For example, French can be the default language with a qwerty keyboard, the auto-partitionning partitions can be changed, the default user class can be set to developer (!)... ******************************************************************************** * po translation files ********************************************************* ******************************************************************************** DrakX uses .po files for its translation. A script takes the different strings out of the .pm files. It generates the DrakX.pot file which contains all the english strings to translate. To add a new language, you just have to add it to lang.pm (if it's not there already) and put the .po in the perl-install/po directory (see ``Ramdisk or not'' to know if you have to regenerate the mdkinst_stage2.gz) ******************************************************************************** * PCMCIA install *************************************************************** ******************************************************************************** If the media you use to install is a pcmcia device, use the pcmcia boot disk. ******************************************************************************** * Ramdisk or not *************************************************************** ******************************************************************************** The DrakX install is much bigger than the newt one. So the ramdisk which was used is getting big, and costs a lot in memory (eg: the mdkinst_stage2 is 14MB - 23/09/99) (update! now size is 21MB - 24/01/01) | | newt | DrakX |-------+---------+---------------------------------------------------------- | nfs | live | live | ftp | ramdisk | ramdisk | http | ramdisk | ramdisk | hd | ramdisk | live if Mandrake/mdkinst/usr/bin/runinstall2 is a link, | | | ramdisk otherwise | cdrom | ramdisk | live if memory < 52MB, ramdisk otherwise Where ramdisk is needed, if detected memory is below the limit allowed for ramdisk (maintained in file gi/mdk-stage1/config-stage1.h; currently 52 Mb), a failure dialog will be printed explaining that there is not enough memory to perform the installation. When i say live, it means that the stage1 will *mount* the Mandrake/mdkinst and use it that way. The ramdisk is used in place of the live in some cases. This ramdisk is filled with mdkinst_stage2.gz For cdrom install, the ramdisk is used to speed up things (access time is quite high on cdrom drives) For pcmcia, it depends on the type of install. ******************************************************************************** * modules ********************************************************************** ******************************************************************************** Modules can be found in at least 2 places: - in /modules/modules.mar - in /lib/modules.cz<KERNEL_VERSION_RELEASE> /modules/modules.mar is used in mdk-stage1. It contains only modules interesting for one kind of install. For example in an hd install, it contains scsi modules. For a network install, it contains network card modules. (To create, extract or view files in a ``mar'' archive, please use gi/mdk-stage1/mar/mar; this is basically an archive format meant to be minimalistic) /lib/modules.cz<KERNEL_VERSION_RELEASE> contains all modules, it is used in stage2. To install a module, use modprobe which is in /usr/bin. It's a perl wrapper around /usr/bin/insmod. It uses the dependencies found in /modules/modules.dep (stage1). /usr/bin/insmod is a wrapper around /usr/bin/insmod_. It just extracts the module out of /lib/modules.cz in /tmp. Then it calls insmod_. /usr/bin/insmod_ is the real prog (which you usually find in /sbin/). You need to give it the complete path. ******************************************************************************** * Making screenshots *********************************************************** ******************************************************************************** On a test machine, make a network install, switch to console (ctrl-alt-F2), enter: % xhost+ then, on another computer: % DISPLAY=test_machine:0 xwd -root | convert - screenshot.png ******************************************************************************** * Adding a new step to DrakX *************************************************** ******************************************************************************** Say we want to add a question for setting "alawindows" option. We put it pretty early in the install, let's say after "Select Installation Class". 1. in install2.pm add selectAlawindows => [ __("A la windows or not"), 0, 1, '' ], after selectInstallClass => [ __("Select installation class"), 1, 1, '' ], the 0, 1, '' means not "redoable", "skip on error", "don't hide" 2. add your function selectAlawindows in install2.pm sub selectAlawindows { $o->selectAlawindows } 3. add your function selectAlawindows in install_steps_interactive.pm sub selectAlawindows { my ($o) = @_; $o->{alawindows} = $o->ask_yesorno('', _("Throw everything away as windobe does?"), 1); } 4. add your function selectAlawindows in install_steps.pm (not needed in that case, except for auto_install) sub selectAlawindows {} ******************************************************************************** * Miscellaneous **************************************************************** ******************************************************************************** > o Media access methods: nfs, ftp, http, hd, cdrom > o Stages: init, stage1, stage2 > - What exactly each stage does init loads stage1 stage1 loads stage2, on various medium type stage2 is too big to fit on a floppy, that's why stage1 exists > - How each stage relates to the various media access methods stage1 knows only how to access to the media is compiled for. It contains only the kernel modules needed for that media. For eg, the nfs/ftp/http stage1 doesn't contain scsi modules nor ide. > - How one stage terminates and another begins. i.e., How does > stage1 find, mount, and launch stage2? /sbin/init just starts /sbin/stage1 /sbin/stage1 takes care of mounting stage2 (in ramdisk if necessary) then it runs /usr/bin/runinstall2 > o Text and Graphic mode installers > - Architectural overview of each have a look at gi/install.fig ******************************************************************************** * OEM ************************************************************************** ******************************************************************************** > I am a system OEM in Bangalore,India selling systems bundled with > Mandrake Linux. The problem is that with every system I sell, I need to > install & configure the system which takes HOURS!. Can I do a diskcopy > instead? > > Please Help. This is a major bottleneck for me. many solutions: - make an install on drive hdb, then either 1. dd if=/dev/hdb of=/dev/hdc 2. dd if=/dev/hdb of=/dev/hdc count=1 ; kernel_reread /dev/hdc ; mke2fs /dev/hdc1 ; mount /dev/hdb1 /source ; mount /dev/hdc1 /dest ; cp -a /source /dest - try the oem feature 3. - burn a cd out of *latest* cooker - boot on it telling "oem" to syslinux !! it will destroy every data on the harddrive !! - you now have a very automated install matrix (duplicate it with "dd if=/dev/hdb of=/dev/hdc bs=1M count=730") put the harddrive in the oem box, the user will now have an *very* automated install, just asking the root password and user password. 4. (just like 3. without burning a cd, doing the first part by hand) have a look at the /etc/oem script on the rescue and do it by hand... cu Pixel. comments: 1. maybe copy unnecessary things -> take too long solution -> use bs=8k count=xxxx 2. kernel_reread can be found on the new rescue, source is also at end of this mail. This solution works with one partition. Can be easily enhanced to many primary partitions... For extended partitions, more complicated, but not much :) 3. has just been added in latest cooker. It may still have some pb. The main current limitation is IDE only, though it can be fixed easily for special cases. -------------------------------------------------------------------------------- #include <stdio.h> #include <sys/mount.h> #include <fcntl.h> void die(char *msg) { perror(msg); exit(1); } void kernel_read(char *dev) { int fd; if ((fd = open(dev, O_RDONLY)) == -1) die("can't open device"); ioctl(fd, BLKRRPART, 0); close(fd); } int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, "usage: kernel_read_part <hard drive device>\n"); exit(1); } kernel_read(argv[1]); }
class='del'>- pptp => [ qw(pptp-linux) ],
- capi => [ qw(isdn4k-utils) ], #- capi4linux service
- );
- $in->do_pkgs->install(@{$packages{$adsl_type}});
-
- my $pty_option =
- exists $modems{$adsl_device}{server}{$adsl_type} ? "pty $modems{$adsl_device}{server}{$adsl_type}" :
- exists $generic{$adsl_type}{server} ? "pty $generic{$adsl_type}{server}" :
- "";
- my $plugin = exists $modems{$adsl_device}{plugin}{$adsl_type} && "plugin $modems{$adsl_device}{plugin}{$adsl_type}";
- my $noipdefault = $adsl_type eq 'pptp' ? '' : 'noipdefault';
- my $ppp_options =
- exists $modems{$adsl_device}{ppp_options} ? $modems{$adsl_device}{ppp_options} :
- exists $generic{$adsl_type}{ppp_options} ? $generic{$adsl_type}{ppp_options} :
- "";
- output("$::prefix/etc/ppp/peers/ppp0",
-qq(lock
-persist
-noauth
-usepeerdns
-defaultroute
-$noipdefault
-$ppp_options
-kdebug 1
-nopcomp
-noccp
-novj
-holdoff 4
-maxfail 25
-$pty_option
-$plugin
-user "$net->{adsl}{login}"
-));
-
- network::tools::write_secret_backend($net->{adsl}{login}, $net->{adsl}{passwd});
-
- my $ethernet_device = $net->{adsl}{ethernet_device};
- if ($ethernet_device =~ /^eth/) {
- $net->{ifcfg}{$ethernet_device} = {
- DEVICE => $ethernet_device,
- BOOTPROTO => 'none',
- NETMASK => '255.255.255.0',
- NETWORK => '10.0.0.0',
- BROADCAST => '10.0.0.255',
- MII_NOT_SUPPORTED => 'yes',
- ONBOOT => 'yes',
- };
- }
- }
-
- #- FIXME: ppp0 and ippp0 are hardcoded
- my $metric = network::tools::get_default_metric("adsl"); #- FIXME, do not override if already set
- put_in_hash($net->{ifcfg}{ppp0} ||= {}, {
- DEVICE => 'ppp0',
- TYPE => 'ADSL',
- METRIC => $metric,
- }) unless member($adsl_type, qw(static dhcp));
- #- don't overwrite ONBOOT setting, it may have been handled earlier in netconnect
- $net->{ifcfg}{ppp0}{ONBOOT} ||= 'yes';
-
- #- remove file used with sagem for dhcp/static connections
- unlink("$::prefix/etc/sysconfig/network-scripts/ifcfg-sagem");
-
- #- set vpi, vci and encapsulation parameters for sagem
- $adsl_device eq 'sagem' and sagem_set_parameters($net);
-
- #- set aliases
- if (exists $modems{$adsl_device}{aliases}) {
- $modules_conf->set_alias($_->[0], $_->[1]) foreach @{$modems{$adsl_device}{aliases}};
- $::isStandalone and $modules_conf->write;
- }
- #- remove the "speedtch off" alias that was written by Mandrakelinux 10.0
- $adsl_device eq 'speedtouch' and $modules_conf->remove_alias('speedtch');
-
- if ($adsl_type eq "capi") {
- require network::isdn;
- network::isdn::setup_capi_conf($in, $net->{adsl}{capi_card});
- services::disable('isdn4linux');
- services::enable('capi4linux');
-
- #- install and run drdsl for dsl connections, once capi driver is loaded
- $in->do_pkgs->ensure_is_installed_if_available("drdsl", "/usr/sbin/drdsl");
- run_program::rooted($::prefix, "/usr/sbin/drdsl");
- }
-
- #- load modules and run modem-specific start programs
- #- useful during install, or in case the packages have been installed after the device has been plugged
- my @modules = (@{$modems{$adsl_device}{modules}}, map { $_->[1] } @{$modems{$adsl_device}{aliases}});
- @modules or @modules = qw(ppp_synctty ppp_async ppp_generic n_hdlc); #- required for pppoe/pptp connections
- #- pppoa connections need the pppoatm module
- #- pppd should run "modprobe pppoatm", but it will fail during install
- push @modules, 'pppoatm' if $adsl_type eq 'pppoa';
- foreach (@modules) {
- eval { modules::load($_) } or log::l("failed to load $_ module: $@");
- }
- $modems{$adsl_device}{start} and run_program::rooted($::prefix, $modems{$adsl_device}{start});
-}
-
-1;
diff --git a/perl-install/network/adsl_consts.pm b/perl-install/network/adsl_consts.pm
deleted file mode 100644
index c3cc03b1c..000000000
--- a/perl-install/network/adsl_consts.pm
+++ /dev/null
@@ -1,979 +0,0 @@
-package network::adsl_consts; # $Id$
-
-# This should probably be splitted out into ldetect-lst as some provider db
-
-use vars qw(@ISA @EXPORT);
-use common;
-use utf8;
-
-@ISA = qw(Exporter);
-@EXPORT = qw(@adsl_data);
-
-# Originally from :
-# http://www.eagle-usb.org/article.php3?id_article=23
-# http://www.sagem.com/web-modems/download/support-fast1000-fr.htm
-# http://perso.wanadoo.fr/michel-m/protocolesfai.htm
-
-our %adsl_data = (
- ## format chosen is the following :
- # country|provider => { VPI, VCI_hexa, ... } all parameters
- # country is automagically translated into LANG with N function
- # provider is kept "as-is", not translated
- # provider_id is used by eagleconfig to identify an ISP (I use ISO_3166-1)
- # see http://en.wikipedia.org/wiki/ISO_3166-1
- # url_tech : technical URL providing info about ISP
- # vpi : virtual path identifier
- # vci : virtual channel identifier (in hexa below !!)
- # Encapsulation:
- # 1=PPPoE LLC, 2=PPPoE VCmux (never used ?)
- # 3=RFC1483/2684 Routed IP LLC,
- # 4=RFC1483/2684 Routed IP (IPoA VCmux)
- # 5 RFC2364 PPPoA LLC,
- # 6 RFC2364 PPPoA VCmux
- # see http://faq.eagle-usb.org/wakka.php?wiki=AdslDescription
- # dns are provided for when !usepeerdns in peers config file
- # dnsServer2 dnsServer3 : main DNS
- # dnsServers_text : string with any valid DNS (when more than 2)
- # DOMAINNAME2 : used for search key in /etc/resolv.conf
- # method : PPPoA, pppoe, static or dhcp
- # methods_all : all methods for connection with this ISP (when more than 1)
- # modem : model of modem provided by ISP or tested with ISP
- # please forward updates to http://forum.eagle-usb.org
- # try to order alphabetically by country (in English) / ISP (local language)
-
- N("Algeria") . "|Wanadoo" =>
- {
- provider_id => 'DZ01',
- vpi => 0,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- dnsServer2 => '82.101.136.29',
- dnsServer3 => '82.101.136.206',
- },
-
- N("Argentina") . "|Speedy" =>
- {
- provider_id => 'AR01',
- vpi => 1,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- dnsServer2 => '200.51.254.238',
- dnsServer3 => '200.51.209.22',
- },
-
- N("Austria") . "|Any" =>
- {
- provider_id => 'AT00',
- vpi => 8,
- vci => 30,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Austria") . "|AON" =>
- {
- provider_id => 'AT01',
- vpi => 1,
- vci => 20,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Austria") . "|Telstra" =>
- {
- provider_id => 'AT02',
- vpi => 8,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Belgium") . "|ADSL Office" =>
- {
- provider_id => 'BE04',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("Belgium") . "|Tiscali BE" =>
- {
- provider_id => 'BE01',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- method => 'pppoa',
- dnsServer2 => '212.35.2.1',
- dnsServer3 => '212.35.2.2',
- DOMAINNAME2 => 'tiscali.be',
- },
-
- N("Belgium") . "|Belgacom" =>
- {
- provider_id => 'BE03',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Belgium") . "|Turboline" =>
- {
- provider_id => 'BE02',
- vpi => 8,
- vci => 23,
- Encapsulation => 5,
- method => 'pppoa',
- },
-
- N("Brazil") . "|Speedy/Telefonica" =>
- {
- provider_id => 'BR01',
- vpi => 8,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- dnsServer2 => '200.204.0.10',
- dnsServer3 => '200.204.0.138',
- },
-
- N("Brazil") . "|Velox/Telemar" =>
- {
- provider_id => 'BR02',
- vpi => 0,
- vci => 21,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Brazil") . "|Turbo/Brasil Telecom" =>
- {
- provider_id => 'BR03',
- vpi => 0,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Brazil") . "|Rio Grande do Sul (RS)" =>
- {
- provider_id => 'BR04',
- vpi => 1,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Bulgaria") . "|BTK ISDN" =>
- {
- provider_id => 'BG02',
- vpi => 1,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Bulgaria") . "|BTK POTS" =>
- {
- provider_id => 'BG01',
- vpi => 0,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Beijing" =>
- {
- provider_id => 'CN01',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Changchun" =>
- {
- provider_id => 'CN02',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Harbin" =>
- {
- provider_id => 'CN03',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Jilin" =>
- {
- provider_id => 'CN04',
- vpi => 0,
- vci => 27,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Lanzhou" =>
- {
- provider_id => 'CN05',
- vpi => 0,
- vci => 20,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Tianjin" =>
- {
- provider_id => 'CN06',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Xi'an" =>
- {
- provider_id => 'CN07',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Chongqing" =>
- {
- provider_id => 'CN08',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Fujian" =>
- {
- provider_id => 'CN09',
- vpi => 0,
- vci => 0xc8,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Guangxi" =>
- {
- provider_id => 'CN10',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Guangzhou" =>
- {
- provider_id => 'CN11',
- vpi => 8,
- vci => 20,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Hangzhou" =>
- {
- provider_id => 'CN12',
- vpi => 0,
- vci => 20,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Netcom|Hunan" =>
- {
- provider_id => 'CN13',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Nanjing" =>
- {
- provider_id => 'CN14',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Shanghai" =>
- {
- provider_id => 'CN15',
- vpi => 8,
- vci => 51,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Shenzhen" =>
- {
- provider_id => 'CN16',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Urumqi" =>
- {
- provider_id => 'CN17',
- vpi => 0,
- vci => 20,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Wuhan" =>
- {
- provider_id => 'CN18',
- vpi => 0,
- vci => 20,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Yunnan" =>
- {
- provider_id => 'CN19',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("China") . "|China Telecom|Zhuhai" =>
- {
- provider_id => 'CN20',
- vpi => 0,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("Czech Republic") . "|Cesky Telecom" =>
- {
- provider_id => 'CZ01',
- url_tech => 'http://www.telecom.cz/domacnosti/internet/pristupove_sluzby/broadband/vse_o_kz_a_moznostech_instalace.php',
- vpi => 8,
- vci => 48,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Denmark") . "|Any" =>
- {
- provider_id => 'DK01',
- vpi => 0,
- vci => 65,
- method => 'pppoe',
- Encapsulation => 3,
- },
-
- N("Finland") . "|Sonera" =>
- {
- provider_id => 'FI01',
- vpi => 0,
- vci => 64,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("France") . "|Free non dégroupé 512/128 & 1024/128" =>
- {
- provider_id => 'FR01',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '213.228.0.23',
- dnsServer3 => '212.27.32.176',
- method => 'pppoa',
- DOMAINNAME2 => 'free.fr',
- },
-
- N("France") . "|Free dégroupé 1024/256 (mini)" =>
- {
- provider_id => 'FR04',
- vpi => 8,
- vci => 24,
- Encapsulation => 4,
- dnsServer2 => '213.228.0.23',
- dnsServer3 => '212.27.32.176',
- method => 'dhcp',
- DOMAINNAME2 => 'free.fr',
- },
-
- N("France") . "|n9uf tel9com 512 & dégroupé 1024" =>
- {
- provider_id => 'FR05',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '212.30.93.108',
- dnsServer3 => '212.203.124.146',
- method => 'pppoa',
- },
-
- N("France") . "|Cegetel non dégroupé 512 IP/ADSL et dégroupé" =>
- {
- provider_id => 'FR08',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '212.94.174.85',
- dnsServer3 => '212.94.174.86',
- method => 'pppoa',
- },
-
- N("France") . "|Club-Internet" =>
- {
- provider_id => 'FR06',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '194.117.200.10',
- dnsServer3 => '194.117.200.15',
- method => 'pppoa',
- DOMAINNAME2 => 'club-internet.fr',
- },
-
- N("France") . "|Wanadoo" =>
- {
- provider_id => 'FR09',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '80.10.246.2',
- dnsServer3 => '80.10.246.129',
- method => 'pppoa',
- DOMAINNAME2 => 'wanadoo.fr',
- },
-
- N("France") . "|Télé2" =>
- {
- provider_id => 'FR02',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '212.151.136.242',
- dnsServer3 => '130.244.127.162',
- method => 'pppoa',
- },
-
- N("France") . "|Tiscali.fr 128k" =>
- {
- provider_id => 'FR03',
- vpi => 8,
- vci => 23,
- Encapsulation => 5,
- dnsServer2 => '213.36.80.1',
- dnsServer3 => '213.36.80.2',
- method => 'pppoa',
- },
-
- N("France") . "|Tiscali.fr 512k" =>
- {
- provider_id => 'FR07',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '213.36.80.1',
- dnsServer3 => '213.36.80.2',
- method => 'pppoa',
- },
-
- N("Germany") . "|Deutsche Telekom (DT)" =>
- {
- provider_id => 'DE01',
- vpi => 1,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Germany") . "|1&1" =>
- {
- provider_id => 'DE02',
- vpi => 1,
- vci => 20,
- Encapsulation => 1,
- dnsServer2 => '195.20.224.234',
- dnsServer3 => '194.25.2.129',
- method => 'pppoe',
- },
-
- N("Greece") . "|Any" =>
- {
- provider_id => 'GR01',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Hungary") . "|Matav" =>
- {
- provider_id => 'HU01',
- vpi => 1,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Ireland") . "|Any" =>
- {
- provider_id => 'IE01',
- vpi => 8,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Israel") . "|Bezeq" =>
- {
- provider_id => 'IL01',
- vpi => 8,
- vci => 30,
- Encapsulation => 6,
- dnsServer2 => '192.115.106.10',
- dnsServer3 => '192.115.106.11',
- method => 'pppoa',
- },
-
- N("Italy") . "|Libero.it" =>
- {
- provider_id => 'IT04',
- url_tech => 'http://internet.libero.it/assistenza/adsl/installazione_ass.phtml',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '193.70.192.25',
- dnsServer3 => '193.70.152.25',
- method => 'pppoa',
- },
-
- N("Italy") . "|Telecom Italia" =>
- {
- provider_id => 'IT01',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '195.20.224.234',
- dnsServer3 => '194.25.2.129',
- method => 'pppoa',
- },
-
- N("Italy") . "|Telecom Italia/Office Users (ADSL Smart X)" =>
- {
- provider_id => 'IT02',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'static',
- },
-
- N("Italy") . "|Tiscali.it, Alice" =>
- {
- provider_id => 'IT03',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '195.20.224.234',
- dnsServer3 => '194.25.2.129',
- method => 'pppoa',
- },
-
- N("Lithuania") . "|Lietuvos Telekomas" =>
- {
- provider_id => 'LT01',
- vpi => 8,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Morocco") . "|Maroc Telecom" =>
- {
- provider_id => 'MA01',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '212.217.0.1',
- dnsServer3 => '212.217.0.12',
- method => 'pppoa',
- },
-
- N("Netherlands") . "|KPN" =>
- {
- provider_id => 'NL01',
- vpi => 8,
- vci => 30,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Netherlands") . "|Eager Telecom" =>
- {
- provider_id => 'NL02',
- vpi => 0,
- vci => 21,
- Encapsulation => 3,
- method => 'dhcp',
- },
-
- N("Netherlands") . "|Tiscali" =>
- {
- provider_id => 'NL03',
- vpi => 0,
- vci => 22,
- Encapsulation => 3,
- method => 'dhcp',
- },
-
- N("Netherlands") . "|Versatel" =>
- {
- provider_id => 'NL04',
- vpi => 0,
- vci => 20,
- Encapsulation => 3,
- method => 'dhcp',
- },
-
- N("Norway") . "|Bluecom" =>
- {
- method => 'dhcp',
- },
-
- N("Norway") . "|Firstmile" =>
- {
- method => 'dhcp',
- },
-
- N("Norway") . "|NextGenTel" =>
- {
- method => 'dhcp',
- },
-
- N("Norway") . "|SSC" =>
- {
- method => 'dhcp',
- },
-
- N("Norway") . "|Tele2" =>
- {
- method => 'dhcp',
- },
-
- N("Norway") . "|Telenor ADSL" =>
- {
- method => 'PPPoE',
- },
-
- N("Norway") . "|Tiscali" =>
- {
- vpi => 8,
- vci => 35,
- method => 'dhcp',
- },
-
- N("Poland") . "|Telekomunikacja Polska (TPSA/neostrada)" =>
- {
- provider_id => 'PL01',
- vpi => 0,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '194.204.152.34',
- dnsServer3 => '217.98.63.164',
- method => 'pppoa',
- },
-
- N("Poland") . "|Netia neostrada" =>
- {
- provider_id => 'PL02',
- url_tech => 'http://www.netia.pl/?o=d&s=210',
- vpi => 8,
- vci => 23,
- Encapsulation => 1,
- dnsServer2 => '195.114.181.130',
- dnsServer3 => '195.114.161.61',
- method => 'pppoe',
- },
-
- N("Portugal") . "|PT" =>
- {
- provider_id => 'PT01',
- vpi => 0,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Russia") . "|MTU-Intel" =>
- {
- provider_id => 'RU01',
- url_tech => 'http://stream.ru/s-requirements',
- vpi => 1,
- vci => 50,
- Encapsulation => 1,
- dnsServer2 => '212.188.4.10',
- dnsServer3 => '195.34.32.116',
- method => 'pppoe',
- },
-
- N("Senegal") . "|Sonatel Multimedia Sentoo" =>
- {
- provider_id => 'SN01',
- vpi => 0,
- vci => 35,
- Encapsulation => 6,
- method => 'pppoa',
- DOMAINNAME2 => 'sentoo.sn',
- },
-
- N("Slovenia") . "|SiOL" =>
- {
- provider_id => 'SL01',
- vpi => 1,
- vci => 20,
- method => 'pppoe',
- Encapsulation => 1,
- dnsServer2 => '193.189.160.11',
- dnsServer3 => '193.189.160.12',
- DOMAINNAME2 => 'siol.net',
- },
-
- N("Spain") . "|Telefónica IP dinámica" =>
- {
- provider_id => 'ES01',
- vpi => 8,
- vci => 20,
- Encapsulation => 1,
- dnsServer2 => '80.58.32.33',
- dnsServer3 => '80.58.0.97',
- method => 'pppoe',
- },
-
- N("Spain") . "|Telefónica ip fija" =>
- {
- provider_id => 'ES02',
- vpi => 8,
- vci => 20,
- Encapsulation => 3,
- method => 'static',
- dnsServer2 => '80.58.32.33',
- dnsServer3 => '80.58.0.97',
- },
-
- N("Spain") . "|Wanadoo/Eresmas Retevision" =>
- {
- provider_id => 'ES03',
- vpi => 8,
- vci => 23,
- Encapsulation => 6,
- dnsServer2 => '80.58.0.33',
- dnsServer3 => '80.58.32.97',
- method => 'pppoa',
- },
-
- N("Spain") . "|Wanadoo PPPoE" =>
- {
- provider_id => 'ES04',
- vpi => 8,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Spain") . "|Wanadoo ip fija" =>
- {
- provider_id => 'ES05',
- vpi => 8,
- vci => 20,
- Encapsulation => 3,
- method => 'static',
- },
-
- N("Spain") . "|Tiscali" =>
- {
- provider_id => 'ES06',
- vpi => 1,
- vci => 20,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Spain") . "|Arrakis" =>
- {
- provider_id => 'ES07',
- vpi => 0,
- vci => 23,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Spain") . "|Auna" =>
- {
- provider_id => 'ES08',
- vpi => 0,
- vci => 23,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Spain") . "|Communitel" =>
- {
- provider_id => 'ES09',
- vpi => 0,
- vci => 21,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Spain") . "|Euskatel" =>
- {
- provider_id => 'ES10',
- vpi => 8,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Spain") . "|Uni2" =>
- {
- provider_id => 'ES11',
- vpi => 1,
- vci => 21,
- Encapsulation => 6,
- method => 'pppoa',
- },
-
- N("Spain") . "|Ya.com PPPoE" =>
- {
- provider_id => 'ES12',
- vpi => 8,
- vci => 20,
- Encapsulation => 1,
- method => 'pppoe',
- },
-
- N("Spain") . "|Ya.com static" =>
- {
- provider_id => 'ES13',
- vpi => 8,
- vci => 20,
- Encapsulation => 3,
- method => 'static',
- },
-
- N("Sweden") . "|Telia" =>
- {
- provider_id => 'SE01',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("Switzerland") . "|Any" =>
- {
- provider_id => 'CH01',
- vpi => 8,
- vci => 23,
- Encapsulation => 3,
- method => 'pppoe',
- },
-
- N("Switzerland") . "|BlueWin / Swisscom" =>
- {
- provider_id => 'CH02',
- vpi => 8,
- vci => 23,
- Encapsulation => 5,
- dnsServer2 => '195.186.4.108',
- dnsServer3 => '195.186.4.109',
- method => 'pppoa',
- },
-
- N("Switzerland") . "|Tiscali.ch" =>
- {
- provider_id => 'CH03',
- vpi => 8,
- vci => 23,
- Encapsulation => 1,
- method => 'pppoa',
- },
-
- N("Thailand") . "|Asianet" =>
- {
- provider_id => 'TH01',
- vpi => 0,
- vci => 64,
- Encapsulation => 1,
- dnsServer2 => '203.144.225.242',
- dnsServer3 => '203.144.225.72',
- method => 'pppoe',
- },
-
- N("Tunisia") . "|Planet.tn" =>
- {
- provider_id => 'TH01',
- url_tech => 'http://www.planet.tn/',
- vpi => 0,
- vci => 23,
- Encapsulation => 5,
- dnsServer2 => '193.95.93.77',
- dnsServer3 => '193.95.66.10',
- method => 'pppoe',
- },
-
- N("United Arab Emirates") . "|Etisalat" =>
- {
- provider_id => 'AE01',
- vpi => 0,
- vci => 32,
- Encapsulation => 5,
- dnsServer2 => '213.42.20.20',
- dnsServer3 => '195.229.241.222',
- method => 'pppoa',
- },
-
- N("United Kingdom") . "|Tiscali UK " =>
- {
- provider_id => 'UK01',
- vpi => 0,
- vci => 26,
- Encapsulation => 6,
- dnsServer2 => '212.74.112.66',
- dnsServer3 => '212.74.112.67',
- method => 'pppoa',
- },
-
- N("United Kingdom") . "|British Telecom " =>
- {
- provider_id => 'UK02',
- vpi => 0,
- vci => 26,
- Encapsulation => 6,
- dnsServer2 => '194.74.65.69',
- dnsServer3 => '194.72.9.38',
- method => 'pppoa',
- },
-
- );
-
-
-1;
diff --git a/perl-install/network/dhcpd.pm b/perl-install/network/dhcpd.pm
deleted file mode 100644
index 8cf30d5fc..000000000
--- a/perl-install/network/dhcpd.pm
+++ /dev/null
@@ -1,50 +0,0 @@
-package network::dhcpd;
-
-use strict;
-use common;
-
-my $sysconf_dhcpd = "$::prefix/etc/sysconfig/dhcpd";
-my $dhcpd_conf_file = "$::prefix/etc/dhcpd.conf";
-my $update_dhcp = "/usr/sbin/update_dhcp.pl";
-
-sub read_dhcpd_conf {
- my ($o_file) = @_;
- my $s = cat_($o_file || $dhcpd_conf_file);
- { option_routers => [ $s =~ /^\s*option routers\s+(\S+);/mg ],
- subnet_mask => [ if_($s =~ /^\s*option subnet-mask\s+(.*);/mg, split(' ', $1)) ],
- domain_name => [ if_($s =~ /^\s*option domain-name\s+"(.*)";/mg, split(' ', $1)) ],
- domain_name_servers => [ if_($s =~ /^\s*option domain-name-servers\s+(.*);/m, split(' ', $1)) ],
- dynamic_bootp => [ if_($s =~ /^\s*range dynamic-bootp\s+\S+\.(\d+)\s+\S+\.(\d+)\s*;/m, split(' ', $1)) ],
- default_lease_time => [ if_($s =~ /^\s*default-lease-time\s+(.*);/m, split(' ', $1)) ],
- max_lease_time => [ if_($s =~ /^\s*max-lease-time\s+(.*);/m, split(' ', $1)) ] };
-}
-
-sub write_dhcpd_conf {
- my ($dhcpd_conf, $device) = @_;
-
- my ($lan) = $dhcpd_conf->{option_routers}[0] =~ /^(.*)\.\d+$/;
- log::explanations("Configuring a DHCP server on $lan.0");
-
- renamef($dhcpd_conf_file, "$dhcpd_conf_file.old");
- output($dhcpd_conf_file, qq(subnet $lan.0 netmask $dhcpd_conf->{subnet_mask}[0] {
- # default gateway
- option routers $dhcpd_conf->{option_routers}[0];
- option subnet-mask $dhcpd_conf->{subnet_mask}[0];
-
- option domain-name "$dhcpd_conf->{domain_name}[0]";
- option domain-name-servers $dhcpd_conf->{domain_name_servers}[0];
-
- range dynamic-bootp $lan.$dhcpd_conf->{dynamic_bootp}[0] $lan.$dhcpd_conf->{dynamic_bootp}[1];
- default-lease-time $dhcpd_conf->{default_lease_time}[0];
- max-lease-time $dhcpd_conf->{max_lease_time}[0];
-}
-));
-
- #- put the interface for the dhcp server in the sysconfig-dhcp config, for the /etc/init.d script of dhcpd
- log::explanations("Update network interfaces list for dhcpd server");
- substInFile { s/^INTERFACES\n//; $_ .= qq(INTERFACES="$device"\n) if eof } $sysconf_dhcpd if !$::testing;
- run_program::rooted($::prefix, $update_dhcp);
-}
-
-
-1;
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm
deleted file mode 100644
index e67da229b..000000000
--- a/perl-install/network/drakfirewall.pm
+++ /dev/null
@@ -1,283 +0,0 @@
-package network::drakfirewall; # $Id$
-
-use strict;
-use diagnostics;
-
-use network::shorewall;
-use common;
-
-my @all_servers =
-(
- {
- name => N_("Web Server"),
- pkg => 'apache apache-mod_perl boa',
- ports => '80/tcp 443/tcp',
- },
- {
- name => N_("Domain Name Server"),
- pkg => 'bind',
- ports => '53/tcp 53/udp',
- },
- {
- name => N_("SSH server"),
- pkg => 'openssh-server',
- ports => '22/tcp',
- },
- {
- name => N_("FTP server"),
- pkg => 'ftp-server-krb5 wu-ftpd proftpd pure-ftpd',
- ports => '20/tcp 21/tcp',
- },
- {
- name => N_("Mail Server"),
- pkg => 'sendmail postfix qmail',
- ports => '25/tcp',
- },
- {
- name => N_("POP and IMAP Server"),
- pkg => 'imap courier-imap-pop',
- ports => '109/tcp 110/tcp 143/tcp',
- },
- {
- name => N_("Telnet server"),
- pkg => 'telnet-server-krb5',
- ports => '23/tcp',
- hide => 1,
- },
- {
- name => N_("Windows Files Sharing (SMB)"),
- pkg => 'samba-server',
- ports => '137/tcp 137/udp 138/tcp 138/udp 139/tcp 139/udp 445/tcp 445/udp 1024:1100/tcp 1024:1100/udp',
- hide => 1,
- },
- {
- name => N_("CUPS server"),
- pkg => 'cups',
- ports => '631/tcp 631/udp',
- hide => 1,
- },
- {
- name => N_("Echo request (ping)"),
- ports => '8/icmp',
- force_default_selection => 0,
- },
- {
- name => N_("BitTorrent"),
- ports => '6881:6999/tcp',
- hide => 1,
- pkg => 'bittorrent bittorrent-shadowsclient',
- },
-);
-
-my @ifw_rules = (
- {
- name => N_("Port scan detection"),
- ifw_rule => 'psd',
- },
-);
-
-sub port2server {
- my ($port) = @_;
- find {
- any { $port eq $_ } split(' ', $_->{ports});
- } @all_servers;
-}
-
-sub check_ports_syntax {
- my ($ports) = @_;
- foreach (split ' ', $ports) {
- my ($nb, $range, $nb2) = m!^(\d+)(:(\d+))?/(tcp|udp|icmp)$! or return $_;
- foreach my $port ($nb, if_($range, $nb2)) {
- 1 <= $port && $port <= 65535 or return $_;
- }
- $nb < $nb2 or return $_ if $range;
- }
- '';
-}
-
-sub to_ports {
- my ($servers, $unlisted) = @_;
- join(' ', (map { $_->{ports} } @$servers), if_($unlisted, $unlisted));
-}
-
-sub from_ports {
- my ($ports) = @_;
-
- my @l;
- my @unlisted;
- foreach (split ' ', $ports) {
- if (my $s = port2server($_)) {
- push @l, $s;
- } else {
- push @unlisted, $_;
- }
- }
- [ uniq(@l) ], join(' ', @unlisted);
-}
-
-sub default_from_pkgs {
- my ($do_pkgs) = @_;
- my @pkgs = $do_pkgs->are_installed(map { split ' ', $_->{pkg} } @all_servers);
- [ grep {
- my $s = $_;
- exists $s->{force_default_selection} ?
- $s->{force_default_selection} :
- any { member($_, @pkgs) } split(' ', $s->{pkg});
- } @all_servers ];
-}
-
-sub default_ports {
- my ($do_pkgs) = @_;
- to_ports(default_from_pkgs($do_pkgs), '');
-}
-
-sub get_ports() {
- my $shorewall = network::shorewall::read() or return;
- $shorewall->{ports};
-}
-
-sub set_ports {
- my ($do_pkgs, $disabled, $ports, $o_in) = @_;
-
- my $shorewall = network::shorewall::read($o_in) or return;
-
- if (!$disabled || -x "$::prefix/sbin/shorewall") {
- $do_pkgs->ensure_binary_is_installed('shorewall', 'shorewall', $::isInstall) or return;
-
- $shorewall->{disabled} = $disabled;
- $shorewall->{ports} = $ports;
- log::l($disabled ? "disabling shorewall" : "configuring shorewall to allow ports: $ports");
- network::shorewall::write($shorewall);
- }
-}
-
-sub get_conf {
- my ($in, $disabled, $o_ports) = @_;
-
- my $possible_servers = default_from_pkgs($in->do_pkgs);
- $_->{hide} = 0 foreach @$possible_servers;
-
- if ($o_ports) {
- $disabled, from_ports($o_ports);
- } elsif (my $shorewall = network::shorewall::read()) {
- $shorewall->{disabled}, from_ports($shorewall->{ports});
- } else {
- $in->ask_okcancel('', N("drakfirewall configurator
-
-This configures a personal firewall for this Mandriva Linux machine.
-For a powerful and dedicated firewall solution, please look to the
-specialized Mandriva Security Firewall distribution."), 1) or return;
-
- $in->ask_okcancel('', N("drakfirewall configurator
-
-Make sure you have configured your Network/Internet access with
-drakconnect before going any further."), 1) or return;
-
- $disabled, $possible_servers, '';
- }
-}
-
-sub choose_allowed_services {
- my ($in, $disabled, $servers, $unlisted) = @_;
-
- $_->{on} = 0 foreach @all_servers;
- $_->{on} = 1 foreach @$servers;
- my @l = grep { $_->{on} || !$_->{hide} } @all_servers;
-
- $in->ask_from_({
- messages => N("Which services would you like to allow the Internet to connect to?"),
- title => N("Firewall"),
- icon => 'banner-security',
- advanced_messages => N("You can enter miscellaneous ports.
-Valid examples are: 139/tcp 139/udp 600:610/tcp 600:610/udp.
-Have a look at /etc/services for information."),
- callbacks => {
- complete => sub {
- if (my $invalid_port = check_ports_syntax($unlisted)) {
- $in->ask_warn('', N("Invalid port given: %s.
-The proper format is \"port/tcp\" or \"port/udp\",
-where port is between 1 and 65535.
-
-You can also give a range of ports (eg: 24300:24350/udp)", $invalid_port));
- return 1;
- }
- },
- } },
- [
- { text => N("Everything (no firewall)"), val => \$disabled, type => 'bool' },
- (map { { text => translate($_->{name}), val => \$_->{on}, type => 'bool', disabled => sub { $disabled } } } @l),
- { label => N("Other ports"), val => \$unlisted, advanced => 1, disabled => sub { $disabled } }
- ]) or return;
-
- $disabled, [ grep { $_->{on} } @l ], $unlisted;
-}
-
-sub set_ifw {
- my ($do_pkgs, $enabled, $rules, $ports) = @_;
- if ($enabled) {
- $do_pkgs->ensure_is_installed('mandi-ifw', '/etc/ifw/start', $::isInstall) or return;
-
- my $ports_by_proto = network::shorewall::ports_by_proto($ports);
- output_with_perm("$::prefix/etc/ifw/rules", 0644, map { "$_\n" } (
- (map { "source /etc/ifw/rules.d/$_" } @$rules),
- map {
- my $proto = $_;
- map {
- my $multiport = /:/ && " -m multiport";
- "iptables -A Ifw -m state --state NEW -p $proto$multiport --dport $_ -j IFWLOG --log-prefix NEW\n";
- } @{$ports_by_proto->{$proto}};
- } keys %$ports_by_proto,
- ));
- }
-
- my $set_in_file = sub {
- my ($file, @list) = @_;
- substInFile {
- foreach my $l (@list) { s|^$l\n|| }
- $_ .= join("\n", @list) . "\n" if eof && $enabled;
- } "$::prefix/etc/shorewall/$file";
- };
- $set_in_file->('start', "INCLUDE /etc/ifw/start", "INCLUDE /etc/ifw/rules", "iptables -I INPUT 2 -j Ifw");
- $set_in_file->('stop', "iptables -D INPUT -j Ifw", "INCLUDE /etc/ifw/stop");
-}
-
-sub choose_watched_services {
- my ($in, $servers, $unlisted) = @_;
-
- my @l = (@ifw_rules, @$servers, map { { ports => $_ } } split(' ', $unlisted));
- my $enabled = 1;
- $_->{ifw} = 1 foreach @l;
-
- $in->ask_from_({
- messages =>
- N("Interactive Firewall") . "\n\n" .
- N("You can be warned when someone accesses to a service or tries to intrude into your computer.
-Please select which network activity should be watched."),
- title => N("Interactive Firewall"),
- },
- [
- { text => N("Use Interactive Firewall"), val => \$enabled, type => 'bool' },
- map { {
- text => (exists $_->{name} ? translate($_->{name}) : $_->{ports}),
- val => \$_->{ifw},
- type => 'bool', disabled => sub { !$enabled },
- } } @l,
- ]) or return;
- my ($rules, $ports) = partition { exists $_->{ifw_rule} } grep { $_->{ifw} } @l;
- set_ifw($in->do_pkgs, $enabled, [ map { $_->{ifw_rule} } @$rules ], to_ports($ports));
-}
-
-sub main {
- my ($in, $disabled) = @_;
-
- ($disabled, my $servers, my $unlisted) = get_conf($in, $disabled) or return;
-
- ($disabled, $servers, $unlisted) = choose_allowed_services($in, $disabled, $servers, $unlisted) or return;
-
- choose_watched_services($in, $servers, $unlisted) unless $disabled;
-
- my $ports = to_ports($servers, $unlisted);
- set_ports($in->do_pkgs, $disabled, $ports, $in) or return;
-
- ($disabled, $ports);
-}
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
deleted file mode 100644
index c97f45f1c..000000000
--- a/perl-install/network/ethernet.pm
+++ /dev/null
@@ -1,162 +0,0 @@
-package network::ethernet; # $Id$
-
-use c;
-use detect_devices;
-use common;
-use run_program;
-
-our @dhcp_clients = qw(dhclient dhcpcd pump dhcpxd);
-
-sub install_dhcp_client {
- my ($in, $client) = @_;
- my %packages = (
- "dhclient" => "dhcp-client",
- );
- #- use default dhcp client if none is provided
- $client ||= $dhcp_clients[0];
- $client = $packages{$client} if exists $packages{$client};
- $in->do_pkgs->install($client);
-}
-
-sub mapIntfToDevice {
- my ($interface) = @_;
- my $hw_addr = c::getHwIDs($interface);
- return {} if $hw_addr =~ /^usb/;
- my ($bus, $slot, $func) = map { hex($_) } ($hw_addr =~ /([0-9a-f]+):([0-9a-f]+)\.([0-9a-f]+)/);
- $hw_addr && (every { defined $_ } $bus, $slot, $func) ?
- grep { $_->{pci_bus} == $bus && $_->{pci_device} == $slot && $_->{pci_function} == $func } detect_devices::probeall() : {};
-}
-
-
-# return list of [ intf_name, module, device_description ] tuples such as:
-# [ "eth0", "3c59x", "3Com Corporation|3c905C-TX [Fast Etherlink]" ]
-#
-# this function try several method in order to get interface's driver and description in order to support both:
-# - hotplug managed devices (USB, firewire)
-# - special interfaces (IP aliasing, VLAN)
-sub get_eth_cards {
- my ($modules_conf) = @_;
- my @all_cards = detect_devices::getNet();
-
- my @devs = detect_devices::pcmcia_probe();
- my $saved_driver;
- # compute device description and return (interface, driver, description) tuples:
- return map {
- my $interface = $_;
- my $description;
- # 1) get interface's driver through ETHTOOL ioctl:
- my ($a, $detected_through_ethtool);
- $a = c::getNetDriver($interface);
- if ($a) {
- $detected_through_ethtool = 1;
- } else {
- # 2) get interface's driver through module aliases:
- $a = $modules_conf->get_alias($interface);
- }
-
- # workaround buggy drivers that returns a bogus driver name for the GDRVINFO command of the ETHTOOL ioctl:
- my %fixes = (
- "p80211_prism2_cs" => 'prism2_cs',
- "p80211_prism2_pci" => 'prism2_pci',
- "p80211_prism2_usb" => 'prism2_usb',
- "ip1394" => "eth1394",
- "DL2K" => "dl2k",
- "orinoco" => undef, #- should be orinoco_{cs,nortel,pci,plx,tmd}
- "hostap" => undef, #- should be hostap_{cs,pci,plx}
- );
- if (exists $fixes{$a}) {
- $a = $fixes{$a};
- $a or undef $detected_through_ethtool;
- }
-
- # 3) try to match a PCMCIA device for device description:
- if (my $b = find { $_->{device} eq $interface } @devs) { # PCMCIA case
- $a = $b->{driver};
- $description = $b->{description};
- } else {
- # 4) try to lookup a device by hardware address for device description:
- # maybe should have we try sysfs first for robustness?
- ($description) = (mapIntfToDevice($interface))[0]->{description};
- }
- # 5) try to match a device through sysfs for driver & device description:
- # (eg: ipw2100 driver for intel centrino do not support ETHTOOL)
- if (!$description || !$a) {
- my $dev_path = "/sys/class/net/$interface/device";
- my $drv = readlink("$dev_path/driver");
- if ($drv && $drv =~ s!.*/!!) {
- $a = $drv unless $detected_through_ethtool;
- my $sysfs_fields = detect_devices::get_sysfs_device_id_map($dev_path);
- my %l = map { $_ => hex(chomp_(cat_("$dev_path/" . $sysfs_fields->{$_}))) } keys %$sysfs_fields;
- my @cards = grep { my $dev = $_; every { $dev->{$_} eq $l{$_} } keys %l } detect_devices::probeall();
- $description ||= $cards[0]{description} if @cards == 1;
- } elsif (!$a && -e "/sys/class/net/$interface/wireless") {
- # probably a rt2400/rt2500 device (PCI or PCMCIA CardBus) or zd1201 (USB)
- # these broken drivers don't create the "device" link
- # try to see if rt2400/rt2500/zd1201 is loaded, and assume current wireless device uses it
- # FIXME: remove this code as soon as the drivers are fixed
- $a = find { -e "/sys/bus/pci/drivers/$_" } qw(rt2400 rt2500);
- $a ||= find { -e "/sys/bus/usb/drivers/$_" } qw(zd1201);
- }
- }
- # 6) try to match a device by driver for device description:
- # (eg: madwifi, ndiswrapper, ...)
- if (!$description) {
- my @cards = grep { $_->{driver} eq ($a || $saved_driver) } detect_devices::probeall();
- $description = $cards[0]{description} if @cards == 1;
- }
- $a and $saved_driver = $a; # handle multiple cards managed by the same driver
- [ $interface, $saved_driver, if_($description, $description) ];
- } @all_cards;
-}
-
-sub get_eth_cards_names {
- my (@all_cards) = @_;
- map { $_->[0] => join(': ', $_->[0], $_->[2]) } @all_cards;
-}
-
-#- returns (link_type, mac_address)
-sub get_eth_card_mac_address {
- my ($intf) = @_;
- #- don't look for 6 bytes addresses only because of various non-standard MAC addresses
- `$::prefix/sbin/ip -o link show $intf 2>/dev/null` =~ m|.*link/(\S+)\s((?:[0-9a-f]{2}:?)+)\s|;
-}
-
-#- write interfaces MAC address in iftab
-sub update_iftab() {
- #- skip aliases interfaces
- foreach my $intf (grep { !/:\d+$/ } detect_devices::getNet()) {
- my ($link_type, $mac_address) = get_eth_card_mac_address($intf) or next;
- #- do not write zeroed MAC addresses in iftab, it confuses ifrename
- $mac_address =~ /^[0:]+$/ and next;
- # ifrename supports alsa IEEE1394, EUI64 and IRDA
- member($link_type, 'ether', 'ieee1394', 'irda', '[27]') or next;
- substInFile {
- s/^$intf\s+.*\n//;
- s/^.*\s+$mac_address\n//;
- $_ .= qq($intf mac $mac_address\n) if eof;
- } "$::prefix/etc/iftab";
- }
-}
-
-# automatic net aliases configuration
-sub configure_eth_aliases {
- my ($modules_conf) = @_;
- my @pcmcia_interfaces = map { $_->{device} } detect_devices::pcmcia_probe();
- foreach my $card (get_eth_cards($modules_conf)) {
- if (member($card->[0], @pcmcia_interfaces)) {
- #- do not write aliases for pcmcia cards, or cardmgr will not be loaded
- $modules_conf->remove_alias($card->[0]);
- } else {
- $modules_conf->set_alias($card->[0], $card->[1]);
- }
- }
- $::isStandalone and $modules_conf->write;
- update_iftab();
-}
-
-sub is_ifplugd_blacklisted {
- my ($module) = @_;
- member($module, qw(forcedeth via-velocity));
-}
-
-1;
diff --git a/perl-install/network/ifw.pm b/perl-install/network/ifw.pm
deleted file mode 100644
index 40ff0ac6d..000000000
--- a/perl-install/network/ifw.pm
+++ /dev/null
@@ -1,141 +0,0 @@
-package network::ifw;
-
-use Socket;
-use common;
-
-our @ISA = qw(dbus_object);
-
-sub new {
- my ($type, $bus, $filter) = @_;
-
- my $con = $bus->{connection};
- $con->add_filter($filter);
- $con->add_match("type='signal',interface='com.mandriva.monitoring.ifw'");
-
- require dbus_object;
- my $o = dbus_object::new($type,
- $bus,
- "com.mandriva.monitoring",
- "/com/mandriva/monitoring/ifw",
- "com.mandriva.monitoring.ifw");
- dbus_object::set_gtk2_watch($o);
- $o;
-}
-
-sub set_blacklist_verdict {
- my ($o, $seq, $blacklist) = @_;
- $o->call_method('SetBlacklistVerdict', Net::DBus::dbus_uint32($seq), Net::DBus::dbus_uint32($blacklist));
-}
-
-sub unblacklist {
- my ($o, $addr) = @_;
- $o->call_method('UnBlacklist', Net::DBus::dbus_uint32($addr));
-}
-
-sub whitelist {
- my ($o, $addr) = @_;
- $o->call_method('Whitelist', Net::DBus::dbus_uint32($addr));
-}
-
-sub unwhitelist {
- my ($o, $addr) = @_;
- $o->call_method('UnWhitelist', Net::DBus::dbus_uint32($addr));
-}
-
-sub get_interactive {
- my ($o) = @_;
- $o->call_method('GetMode');
-}
-
-sub set_interactive {
- my ($o, $mode) = @_;
- $o->call_method('SetMode', Net::DBus::dbus_uint32($mode));
-}
-
-sub get_reports {
- my ($o, $o_include_processed) = @_;
- $o->call_method('GetReports', Net::DBus::dbus_uint32(to_bool($o_include_processed)));
-}
-
-sub get_blacklist {
- my ($o) = @_;
- $o->call_method('GetBlacklist');
-}
-
-sub get_whitelist {
- my ($o) = @_;
- $o->call_method('GetWhitelist');
-}
-
-sub clear_processed_reports {
- my ($o) = @_;
- $o->call_method('ClearProcessedReports');
-}
-
-sub send_alert_ack {
- my ($o) = @_;
- $o->call_method('SendAlertAck');
-}
-
-sub send_manage_request {
- my ($o) = @_;
- $o->call_method('SendManageRequest');
-}
-
-sub format_date {
- my ($timestamp) = @_;
- require c;
- c::strftime("%c", localtime($timestamp));
-}
-
-sub get_service {
- my ($port) = @_;
- getservbyport($port, undef) || $port;
-}
-
-sub get_protocol {
- my ($protocol) = @_;
- getprotobynumber($protocol) || $protocol;
-}
-
-sub get_ip_address {
- my ($addr) = @_;
- inet_ntoa(pack('L', $addr));
-}
-
-sub resolve_address {
- my ($ip_addr) = @_;
- #- try to resolve address, timeout after 2 seconds
- my $hostname;
- eval {
- local $SIG{ALRM} = sub { die "ALARM" };
- alarm 2;
- $hostname = gethostbyaddr(inet_aton($ip_addr), AF_INET);
- alarm 0;
- };
- $hostname || $ip_addr;
-}
-
-sub attack_to_hash {
- my ($args) = @_;
- my $attack = { mapn { $_[0] => $_[1] } [ 'timestamp', 'indev', 'prefix', 'sensor', 'protocol', 'addr', 'port', 'icmp_type', 'seq', 'processed' ], $args };
- $attack->{port} = unpack('S', pack('n', $attack->{port}));
- $attack->{date} = format_date($attack->{timestamp});
- $attack->{ip_addr} = get_ip_address($attack->{addr});
- $attack->{hostname} = resolve_address($attack->{ip_addr});
- $attack->{protocol} = get_protocol($attack->{protocol});
- $attack->{service} = get_service($attack->{port});
- $attack->{type} =
- $attack->{prefix} eq 'SCAN' ? N("Port scanning")
- : $attack->{prefix} eq 'SERV' ? N("Service attack")
- : $attack->{prefix} eq 'PASS' ? N("Password cracking")
- : N(qq("%s" attack), $attack->{prefix});
- $attack->{msg} =
- $attack->{prefix} eq "SCAN" ? N("A port scanning attack has been attempted by %s.", $attack->{hostname})
- : $attack->{prefix} eq "SERV" ? N("The %s service has been attacked by %s.", $attack->{service}, $attack->{hostname})
- : $attack->{prefix} eq "PASS" ? N("A password cracking attack has been attempted by %s.", $attack->{hostname})
- : N(qq(A "%s" attack has been attempted by %s), $attack->{prefix}, $attack->{hostname});
- $attack;
-}
-
-1;
diff --git a/perl-install/network/ipsec.pm b/perl-install/network/ipsec.pm
deleted file mode 100644
index c0ca7689e..000000000
--- a/perl-install/network/ipsec.pm
+++ /dev/null
@@ -1,781 +0,0 @@
-package network::ipsec;
-
-
-
-use detect_devices;
-use run_program;
-use common;
-use log;
-
-#- debugg functions ----------
-sub recreate_ipsec_conf {
- my ($ipsec, $kernel_version) = @_;
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- print "$ipsec->{$key1}\n" if ! $ipsec->{$key1}{1};
- foreach my $key2 (ikeys %{$ipsec->{$key1}}) {
- if ($ipsec->{$key1}{$key2}[0] =~ m/^#/) {
- print "\t$ipsec->{$key1}{$key2}[0]\n";
- } elsif ($ipsec->{$key1}{$key2}[0] =~ m/(conn|config|version)/) {
- print "$ipsec->{$key1}{$key2}[0] $ipsec->{$key1}{$key2}[1]\n";
- } else {
- print "\t$ipsec->{$key1}{$key2}[0]=$ipsec->{$key1}{$key2}[1]\n";
- }
- }
- }
- } else {
- #- kernel 2.6 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (! $ipsec->{$key1}{command}) {
- print "$ipsec->{$key1}\n";
- } else {
- print $ipsec->{$key1}{command} . " " .
- $ipsec->{$key1}{src_range} . " " .
- $ipsec->{$key1}{dst_range} . " " .
- $ipsec->{$key1}{upperspec} . " " .
- $ipsec->{$key1}{flag} . " " .
- $ipsec->{$key1}{direction} . " " .
- $ipsec->{$key1}{ipsec} . "\n\t" .
- $ipsec->{$key1}{protocol} . "/" .
- $ipsec->{$key1}{mode} . "/" .
- $ipsec->{$key1}{src_dest} . "/" .
- $ipsec->{$key1}{level} . ";\n";
- }
- }
- }
-}
-
-sub recreate_racoon_conf {
- my ($racoon) = @_;
- my $in_a_section = "n";
- my $in_a_proposal_section = "n";
- foreach my $key1 (ikeys %$racoon) {
- if ($in_a_proposal_section eq "y") {
- print "\t}\n}\n$racoon->{$key1}\n" if ! $racoon->{$key1}{1};
- } elsif ($in_a_section eq "y") {
- print "}\n$racoon->{$key1}\n" if ! $racoon->{$key1}{1};
- } else {
- print "$racoon->{$key1}\n" if ! $racoon->{$key1}{1};
- }
- $in_a_section = "n";
- $in_a_proposal_section = "n";
- foreach my $key2 (ikeys %{$racoon->{$key1}}) {
- if ($racoon->{$key1}{$key2}[0] =~ /^path/) {
- print "$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1] $racoon->{$key1}{$key2}[2];\n";
- } elsif ($racoon->{$key1}{$key2}[0] =~ /^remote/) {
- $in_a_section = "y";
- $in_a_proposal_section = "n";
- print "$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1] {\n";
- } elsif ($racoon->{$key1}{$key2}[0] =~ /^sainfo/) {
- $in_a_section = "y";
- $in_a_proposal_section = "n";
- if ($racoon->{$key1}{$key2}[2] && $racoon->{$key1}{$key2}[5]) {
- print "$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1] $racoon->{$key1}{$key2}[2] $racoon->{$key1}{$key2}[3] $racoon->{$key1}{$key2}[4] $racoon->{$key1}{$key2}[5] $racoon->{$key1}{$key2}[6] {\n";
- } else {
- print "$racoon->{$key1}{$key2}[0] anonymous {\n";
- }
- } elsif ($racoon->{$key1}{$key2}[0] =~ /^proposal /) {
- $in_a_proposal_section = "y";
- print "\t$racoon->{$key1}{$key2}[0] {\n";
- } elsif ($in_a_section eq "y" && $racoon->{$key1}{$key2}[0] =~ /^certificate_type/) {
- print "\t$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1] $racoon->{$key1}{$key2}[2] $racoon->{$key1}{$key2}[3];\n";
- } elsif ($in_a_section eq "y" && $racoon->{$key1}{$key2}[0] =~ /^#/) {
- print "\t$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1]\n";
- } elsif ($in_a_section eq "y") {
- print "\t$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1];\n";
- } elsif ($in_a_proposal_section eq "y" && $racoon->{$key1}{$key2}[0] =~ /^#/) {
- print "\t\t$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1]\n";
- } elsif ($in_a_proposal_section eq "y") {
- print "\t\t$racoon->{$key1}{$key2}[0] $racoon->{$key1}{$key2}[1];\n";
- }
- }
- }
-
-print "}\n";
-}
-
-sub recreate_ipsec_conf1_k24 {
- my ($ipsec) = @_;
- foreach my $key1 (ikeys %$ipsec) {
- print "$key1-->$ipsec->{$key1}\n" if ! $ipsec->{$key1}{1};
- foreach my $key2 (ikeys %{$ipsec->{$key1}}) {
- if ($ipsec->{$key1}{$key2}[0] =~ m/^#/) {
- print "\t$key2-->$ipsec->{$key1}{$key2}[0]\n";
- } elsif ($ipsec->{$key1}{$key2}[0] =~ m/(conn|config|version)/) {
- print "$key1-->$key2-->$ipsec->{$key1}{$key2}[0] $ipsec->{$key1}{$key2}[1]\n";
- } else {
- print "\t$key2-->$ipsec->{$key1}{$key2}[0]=$ipsec->{$key1}{$key2}[1]\n";
- }
- }
- }
-}
-#- end of debug functions --------
-
-sub sys { system(@_) == 0 or log::l("[drakvpn] Warning, sys failed for $_[0]") }
-
-sub start_daemons () {
- return if $::testing;
- log::explanations("Starting daemons");
- if (-e "/etc/rc.d/init.d/ipsec") {
- system("/etc/rc.d/init.d/ipsec status >/dev/null") == 0 and sys("/etc/rc.d/init.d/ipsec stop");
- sys("/etc/rc.d/init.d/$_ start >/dev/null"), sys("/sbin/chkconfig --level 345 $_ on") foreach 'ipsec';
- } else {
-
- }
- sys("/etc/rc.d/init.d/$_ start >/dev/null"), sys("/sbin/chkconfig --level 345 $_ on") foreach 'shorewall';
-}
-
-sub stop_daemons () {
- return if $::testing;
- log::explanations("Stopping daemons");
- if (-e "/etc/rc.d/init.d/ipsec") {
- foreach (qw(ipsec)) {
- system("/etc/rc.d/init.d/$_ status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/$_ stop");
- }
- sys("/sbin/chkconfig --level 345 $_ off") && -e "/etc/rc.d/init.d/$_" foreach 'ipsec';
- }
- system("/etc/rc.d/init.d/shorewall status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/shorewall stop >/dev/null");
-
-}
-
-sub set_config_file {
- my ($file, @l) = @_;
-
- my $done;
- substInFile {
- if (!$done && (/^#LAST LINE/ || eof)) {
- $_ = join('', map { join("\t", @$_) . "\n" } @l) . $_;
- $done = 1;
- } else {
- $_ = '' if /^[^#]/;
- }
- } "$::prefix/$file";
-}
-
-sub get_config_file {
- my ($file) = @_;
- map { [ split ' ' ] } grep { !/^#/ } cat_("$::prefix/$file");
-}
-
-
-#-------------------------------------------------------------------
-#---------------------- configure racoon_conf -----------------------
-#-------------------------------------------------------------------
-
-sub read_racoon_conf {
- my ($racoon_conf) = @_;
- my %conf;
- my $nb = 0; #total number
- my $i = 0; #nb within a section
- my $in_a_section = "n";
- my @line1;
- my $line = "";
- local $_;
- open(my $LIST, "< $racoon_conf");
- while (<$LIST>) {
- chomp($_);
- $line = $_;
- $in_a_section = "n" if $line =~ /}/ && $line !~ /^#/;
- $line =~ s/^\s+|\s*;|\s*{//g if $line !~ /^#/;
- $line =~ /(.*)#(.*)/ if $line !~ /^#/; #- define before and after comment
-# print "--line-->$line\n";
- my $data_part = $1;
- my $comment_part = "#" . $2;
- if ($data_part) {
- $data_part =~ s/,//g;
-# print "@@".$data_part."->".$comment_part."\n";
- @line1 = split /\s+/,$data_part;
- @line1 = (@line1, $comment_part) if $comment_part;
- } else {
- @line1 = split /\s+/,$line;
- }
- if (!$line && $in_a_section eq "n") {
- $nb++;
- put_in_hash(\%conf, { $nb => $line });
- $in_a_section = "n";
- } elsif (!$line && $in_a_section eq "y") {
- put_in_hash($conf{$nb} ||= {}, { $i => [ '' ] });
- $i++;
- } elsif ($line =~ /^path/) {
- $i=1;
- $nb++;
- put_in_hash($conf{$nb} ||= {}, { $i => [@line1] });
- $in_a_section = "n";
- $i++;
- } elsif ($line =~ /^#|^{|^}/) {
- if ($in_a_section eq "y") {
- put_in_hash($conf{$nb} ||= {}, { $i => [$line] });
- $i++;
- } else {
- $nb++;
- put_in_hash(\%conf, { $nb => $line });
- $in_a_section = "n";
- }
- } elsif ($line =~ /^sainfo|^remote|^listen|^timer|^padding/ && $in_a_section eq "n") {
- $i=1;
- $nb++;
- put_in_hash($conf{$nb} ||= {}, { $i => [@line1] });
- $in_a_section = "y";
- $i++;
- } elsif ($line eq "proposal" && $in_a_section eq "y") {
- $i=1;
- $nb++;
- put_in_hash($conf{$nb} ||= {}, { $i => [@line1] });
- $in_a_section = "y";
- $i++;
- } else {
- put_in_hash($conf{$nb} ||= {}, { $i => [@line1] });
- $i++;
- }
- }
-
-\%conf;
-}
-
-sub display_racoon_conf {
- my ($racoon) = @_;
- my $display = "";
- my $prefix_to_simple_line = "";
- foreach my $key1 (ikeys %$racoon) {
- if (!$racoon->{$key1}{1}) {
- $display .= $prefix_to_simple_line . $racoon->{$key1} . "\n";
- $prefix_to_simple_line = "";
- } else {
- foreach my $key2 (ikeys %{$racoon->{$key1}}) {
- my $t = $racoon->{$key1}{1}[0];
- my $f = $racoon->{$key1}{$key2}[0];
- my $list_length = scalar @{$racoon->{$key1}{$key2}};
- my $line = "";
-
- if ($racoon->{$key1}{$key2}[0] eq "sainfo" && !$racoon->{$key1}{$key2}[2]) {
- $line = "sainfo anonymous";
- } else {
- for (my $i = 0; $i <= $list_length-1; $i++) {
-
- my $c = $racoon->{$key1}{$key2}[$i];
- my $n = $racoon->{$key1}{$key2}[$i+1];
-
- if ($c =~ /^path|^log|^timer|^listen|^padding|^remote|^proposal|^sainfo/) {
- $line .= "$c ";
- } elsif ($i == $list_length-2 && $n =~ /^#/) {
- $line .= "$c; ";
- } elsif ($i == $list_length-1) {
- if ($f =~ /^#|^$|^timer|^listen|^padding|^remote|^proposal\s+|^sainfo/) {
- $line .= $c;
- } elsif ($c =~ /^#/) {
- $line .= "\t$c";
- } else {
- $line .= "$c;";
- }
- } else {
- $line .= "$c ";
- }
- }
- }
-
- if ($f =~ /^timer|^listen|^padding|^remote|^sainfo/) {
- $line .= " {";
- $prefix_to_simple_line = "";
- } elsif ($f eq "proposal") {
- $line = "\t" . $line . " {";
- } elsif ($t eq "proposal") {
- $line = "\t\t" . $line if $line ne "proposal";
- $prefix_to_simple_line = "\t";
- } else {
- $line = "\t" . $line if $t !~ /^path|^log/;
- $prefix_to_simple_line = "";
- }
- $display .= "$line\n";
- }
- }
- }
-
-$display;
-
-}
-
-sub write_racoon_conf {
- my ($racoon_conf, $racoon) = @_;
- my $display = "";
- my $prefix_to_simple_line = "";
- foreach my $key1 (ikeys %$racoon) {
- if (!$racoon->{$key1}{1}) {
- $display .= $prefix_to_simple_line . $racoon->{$key1} . "\n";
- $prefix_to_simple_line = "";
- } else {
- foreach my $key2 (ikeys %{$racoon->{$key1}}) {
- my $t = $racoon->{$key1}{1}[0];
- my $f = $racoon->{$key1}{$key2}[0];
- my $list_length = scalar @{$racoon->{$key1}{$key2}};
- my $line = "";
-
- if ($racoon->{$key1}{$key2}[0] eq "sainfo" && !$racoon->{$key1}{$key2}[2]) {
- $line = "sainfo anonymous";
- } else {
- for (my $i = 0; $i <= $list_length-1; $i++) {
-
- my $c = $racoon->{$key1}{$key2}[$i];
- my $n = $racoon->{$key1}{$key2}[$i+1];
-
- if ($c =~ /^path|^log|^timer|^listen|^padding|^remote|^proposal|^sainfo/) {
- $line .= "$c ";
- } elsif ($i == $list_length-2 && $n =~ /^#/) {
- $line .= "$c; ";
- } elsif ($i == $list_length-1) {
- if ($f =~ /^#|^$|^timer|^listen|^padding|^remote|^proposal\s+|^sainfo/) {
- $line .= $c;
- } elsif ($c =~ /^#/) {
- $line .= "\t$c";
- } else {
- $line .= "$c;";
- }
- } else {
- $line .= "$c ";
- }
- }
- }
-
- if ($f =~ /^timer|^listen|^padding|^remote|^sainfo/) {
- $line .= " {";
- $prefix_to_simple_line = "";
- } elsif ($f eq "proposal") {
- $line = "\t" . $line . " {";
- } elsif ($t eq "proposal") {
- $line = "\t\t" . $line if $line ne "proposal";
- $prefix_to_simple_line = "\t";
- } else {
- $line = "\t" . $line if $t !~ /^path|^log/;
- $prefix_to_simple_line = "";
- }
- $display .= "$line\n";
- }
- }
- }
-
-open(my $ADD, "> $racoon_conf") or die "Can not open the $racoon_conf file for writing";
- print $ADD "$display\n";
-
-}
-
-sub get_section_names_racoon_conf {
- my ($racoon) = @_;
- my @section_names;
-
- foreach my $key1 (ikeys %$racoon) {
- if (!$racoon->{$key1}{1}) {
- next;
- } else {
- my $list_length = scalar @{$racoon->{$key1}{1}};
- my $section_title = "";
- my $separator = "";
- for (my $i = 0; $i <= $list_length-1; $i++) {
- my $s = $racoon->{$key1}{1}[$i];
- if ($s !~ /^#|^proposal/) {
- $section_title .= $separator . $s;
- $separator = " ";
- }
- }
- push(@section_names, $section_title) if $section_title ne "";
- }
- }
-
- @section_names;
-
-}
-
-sub add_section_racoon_conf {
- my ($new_section, $racoon) = @_;
- put_in_hash($racoon, { max(keys %$racoon) + 1 => '' });
- put_in_hash($racoon, { max(keys %$racoon) + 1 => $new_section });
- put_in_hash($racoon, { max(keys %$racoon) + 1 => '}' }) if $new_section->{1}[0] !~ /^path|^remote/;
- put_in_hash($racoon, { max(keys %$racoon) + 1 => '' }) if $new_section->{1}[0] =~ /^proposal/;
- put_in_hash($racoon, { max(keys %$racoon) + 1 => '}' }) if $new_section->{1}[0] =~ /^proposal/;
-}
-
-sub matched_section_key_number_racoon_conf {
- my ($section_name, $racoon) = @_;
- foreach my $key1 (ikeys %$racoon) {
- if (!$racoon->{$key1}{1}) {
- next;
- } else {
- my $list_length = scalar @{$racoon->{$key1}{1}};
- my $section_title = "";
- my $separator = "";
- for (my $i = 0; $i <= $list_length-1; $i++) {
- my $s = $racoon->{$key1}{1}[$i];
- if ($s !~ /^#|^proposal/) {
- $section_title .= $separator . $s;
- $separator = " ";
- }
- }
- if ($section_title eq $section_name) {
- return $key1;
- }
- }
- }
-
-}
-
-sub already_existing_section_racoon_conf {
- my ($section_name, $racoon, $racoon_conf) = @_;
- if (-e $racoon_conf) {
- foreach my $key1 (ikeys %$racoon) {
- if (!$racoon->{$key1}{1}) {
- next;
- } elsif (find {
- my $list_length = scalar @{$racoon->{$key1}{1}};
- my $section_title = "";
- my $separator = "";
- for (my $i = 0; $i <= $list_length-1; $i++) {
- my $s = $racoon->{$key1}{1}[$i];
- if ($s !~ /^#|^proposal/) {
- $section_title .= $separator . $s;
- $separator = " ";
- }
- }
-
- $section_title eq $section_name;
-
- } ikeys %{$racoon->{$key1}}) {
-
- return "already existing";
- }
- }
- }
-
-}
-
-sub remove_section_racoon_conf {
- my ($section_name, $racoon, $k) = @_;
- if ($section_name =~ /^remote/) {
-
- delete $racoon->{$k} if $k > 1 && !$racoon->{$k-1};
- my $closing_curly_bracket = 0;
- while ($closing_curly_bracket < 2) {
- print "-->$k\n";
- $closing_curly_bracket++ if $racoon->{$k} eq "}";
- delete $racoon->{$k};
- $k++;
- }
-
- } elsif ($section_name =~ /^path/) {
-
- delete $racoon->{$k};
- delete $racoon->{$k+1} if $racoon->{$k+1}{1} eq "";
-
- } else {
-
- delete $racoon->{$k};
- delete $racoon->{$k+1} if $racoon->{$k+1}{1} eq "";
- delete $racoon->{$k+2} if $racoon->{$k+2}{1} eq ""; #- remove assoc }
-
- }
-
-}
-
-#-------------------------------------------------------------------
-#---------------------- configure ipsec_conf -----------------------
-#-------------------------------------------------------------------
-
-sub read_ipsec_conf {
- my ($ipsec_conf, $kernel_version) = @_;
- my %conf;
- my $nb = 0; #total number
- my $i = 0; #nb within a connexion
- my $in_a_conn = "n";
- my $line = "";
- my @line1;
- local $_;
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- open(my $LIST, "< $ipsec_conf"); #or die "Can not open the $ipsec_conf file for reading";
- while (<$LIST>) {
- chomp($_);
- $line = $_;
- $line =~ s/^\s+//;
- if (!$line) {
- $nb++;
- put_in_hash(\%conf, { $nb => $line });
- $in_a_conn = "n";
- } elsif ($line =~ /^#/) {
- if ($in_a_conn eq "y") {
- put_in_hash($conf{$nb} ||= {}, { $i => [$line] });
- $i++;
- } else {
- $nb++;
- put_in_hash(\%conf, { $nb => $line });
- $in_a_conn = "n";
- }
- } elsif ($line =~ /^conn|^config|^version/ && $in_a_conn eq "n") {
- @line1 = split /\s+/,$line;
- $i=1;
- $nb++;
- put_in_hash($conf{$nb} ||= {}, { $i => [$line1[0], $line1[1]] });
- $in_a_conn = "y" if $line !~ /^version/;
- $i++;
- } elsif ($line =~ /^conn|^config|^version/ && $in_a_conn eq "y") {
- @line1 = split /\s+/,$line;
- $i=1;
- $nb++;
- put_in_hash($conf{$nb} ||= {}, { $i => [$line1[0], $line1[1]] });
- $i++;
- } else {
- @line1 = split /=/,$line;
- put_in_hash($conf{$nb} ||= {}, { $i => [$line1[0], $line1[1]] });
- $i++;
- }
- }
-
- } else {
- #- kernel 2.6 part -------------------------------
- my @mylist;
- my $myline = "";
- open(my $LIST, "< $ipsec_conf"); #or die "Can not open the $ipsec_conf file for reading";
- while (<$LIST>) {
- chomp($_);
- $myline = $_;
- $myline =~ s/^\s+//;
- $myline =~ s/;$//;
- if ($myline =~ /^spdadd/) {
- @mylist = split /\s+/,$myline;
- $in_a_conn = "y";
- $nb++;
- next;
- } elsif ($in_a_conn eq "y") {
- @mylist = (@mylist, split '\s+|/',$myline);
- put_in_hash(\%conf, { $nb => { command => $mylist[0],
- src_range => $mylist[1],
- dst_range => $mylist[2],
- upperspec => $mylist[3],
- flag => $mylist[4],
- direction => $mylist[5],
- ipsec => $mylist[6],
- protocol => $mylist[7],
- mode => $mylist[8],
- src_dest => $mylist[9],
- level => $mylist[10] } });
- $in_a_conn = "n";
- } else {
- $nb++;
- put_in_hash(\%conf, { $nb => $myline });
- }
- }
-
- }
-
- \%conf;
-}
-
-sub write_ipsec_conf {
- my ($ipsec_conf, $ipsec, $kernel_version) = @_;
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- open(my $ADD, "> $ipsec_conf") or die "Can not open the $ipsec_conf file for writing";
- foreach my $key1 (ikeys %$ipsec) {
- print $ADD "$ipsec->{$key1}\n" if ! $ipsec->{$key1}{1};
- foreach my $key2 (ikeys %{$ipsec->{$key1}}) {
- if ($ipsec->{$key1}{$key2}[0] =~ m/^#/) {
- print $ADD "\t$ipsec->{$key1}{$key2}[0]\n";
- } elsif ($ipsec->{$key1}{$key2}[0] =~ m/(^conn|^config|^version)/) {
- print $ADD "$ipsec->{$key1}{$key2}[0] $ipsec->{$key1}{$key2}[1]\n";
- } else {
- print $ADD "\t$ipsec->{$key1}{$key2}[0]=$ipsec->{$key1}{$key2}[1]\n" if $ipsec->{$key1}{$key2}[0] && $ipsec->{$key1}{$key2}[1];
- }
- }
- }
- } else {
- #- kernel 2.6 part -------------------------------
- my $display = "";
- foreach my $key1 (ikeys %$ipsec) {
- if (! $ipsec->{$key1}{command}) {
- $display .= "$ipsec->{$key1}\n";
- } else {
- $display .= $ipsec->{$key1}{command} . " " .
- $ipsec->{$key1}{src_range} . " " .
- $ipsec->{$key1}{dst_range} . " " .
- $ipsec->{$key1}{upperspec} . " " .
- $ipsec->{$key1}{flag} . " " .
- $ipsec->{$key1}{direction} . " " .
- $ipsec->{$key1}{ipsec} . "\n\t" .
- $ipsec->{$key1}{protocol} . "/" .
- $ipsec->{$key1}{mode} . "/" .
- $ipsec->{$key1}{src_dest} . "/" .
- $ipsec->{$key1}{level} . ";\n";
- }
- }
- open(my $ADD, "> $ipsec_conf") or die "Can not open the $ipsec_conf file for writing";
- print $ADD $display;
- }
-}
-
-sub display_ipsec_conf {
- my ($ipsec, $kernel_version) = @_;
- my $display = "";
-
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- $display .= "$ipsec->{$key1}\n" if ! $ipsec->{$key1}{1};
- foreach my $key2 (ikeys %{$ipsec->{$key1}}) {
- if ($ipsec->{$key1}{$key2}[0] =~ m/^#/) {
- $display .= "\t$ipsec->{$key1}{$key2}[0]\n";
- } elsif ($ipsec->{$key1}{$key2}[0] =~ m/(^conn|^config|^version)/) {
- $display .= "$ipsec->{$key1}{$key2}[0] $ipsec->{$key1}{$key2}[1]\n";
- } else {
- $display .= "\t$ipsec->{$key1}{$key2}[0]=$ipsec->{$key1}{$key2}[1]\n";
- }
- }
- }
-
- } else {
- #- kernel 2.6 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (! $ipsec->{$key1}{command}) {
- $display .= "$ipsec->{$key1}\n";
- } else {
- $display .= $ipsec->{$key1}{command} . " " .
- $ipsec->{$key1}{src_range} . " " .
- $ipsec->{$key1}{dst_range} . " " .
- $ipsec->{$key1}{upperspec} . " " .
- $ipsec->{$key1}{flag} . " " .
- $ipsec->{$key1}{direction} . " " .
- $ipsec->{$key1}{ipsec} . "\n\t" .
- $ipsec->{$key1}{protocol} . "/" .
- $ipsec->{$key1}{mode} . "/" .
- $ipsec->{$key1}{src_dest} . "/" .
- $ipsec->{$key1}{level} . ";\n";
- }
- }
-
- }
-
- $display;
-
-}
-
-sub get_section_names_ipsec_conf {
- my ($ipsec, $kernel_version) = @_;
- my @section_names;
-
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- foreach my $key2 (ikeys %{$ipsec->{$key1}}) {
- if ($ipsec->{$key1}{$key2}[0] =~ m/(^conn|^config|^version)/) {
- push(@section_names, "$ipsec->{$key1}{$key2}[0] $ipsec->{$key1}{$key2}[1]");
- }
- }
- }
-
- } else {
- #- kernel 2.6 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if ($ipsec->{$key1}{command} =~ m/(^spdadd)/) {
- push(@section_names, "$ipsec->{$key1}{src_range} $ipsec->{$key1}{dst_range}");
- }
- }
- }
-
- @section_names;
-
-}
-
-sub remove_section_ipsec_conf {
- my ($section_name, $ipsec, $kernel_version) = @_;
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (find {
- my $s = $ipsec->{$key1}{$_}[0];
- $s !~ /^#/ && $s =~ m/(^conn|^config|^version)/ &&
- $section_name eq "$s $ipsec->{$key1}{$_}[1]";
- } ikeys %{$ipsec->{$key1}}) {
- delete $ipsec->{$key1};
- }
- }
- } else {
- #- kernel 2.6 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (find {
- my $s = "$ipsec->{$key1}{src_range} $ipsec->{$key1}{dst_range}";
- $s !~ /^#/ && $ipsec->{$key1}{src_range} && $section_name eq $s;
- } ikeys %{$ipsec->{$key1}}) {
- delete $ipsec->{$key1-1};
- delete $ipsec->{$key1};
- }
- }
- }
-}
-
-sub add_section_ipsec_conf {
- my ($new_section, $ipsec) = @_;
- put_in_hash($ipsec, { max(keys %$ipsec) + 1 => '' });
- put_in_hash($ipsec, { max(keys %$ipsec) + 1 => $new_section });
-}
-
-sub already_existing_section_ipsec_conf {
- my ($section_name, $ipsec, $kernel_version) = @_;
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (find {
- my $s = $ipsec->{$key1}{$_}[0];
- $s !~ /^#/ && $s =~ m/(^conn|^config|^version)/ &&
- $section_name eq "$s $ipsec->{$key1}{$_}[1]";
- } ikeys %{$ipsec->{$key1}}) {
- return "already existing";
- }
- }
- } else {
- #- kernel 2.6 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (find {
- my $s = "$ipsec->{$key1}{src_range} $ipsec->{$key1}{dst_range}";
- $s !~ /^#/ && $ipsec->{$key1}{src_range} &&
- $section_name eq $s;
- } ikeys %{$ipsec->{$key1}}) {
- return "already existing";
- }
- }
- }
- return "no";
-}
-
-#- returns the reference to the dynamical list for editing
-sub dynamic_list {
- my ($number, $ipsec) = @_;
- my @list = map { { label => $ipsec->{$number}{$_}[0] . "=",
- val => \$ipsec->{$number}{$_}[1] } } ikeys %{$ipsec->{$number}};
-
- @list;
-}
-
-#- returns the hash key number of $section_name
-sub matched_section_key_number_ipsec_conf {
- my ($section_name, $ipsec, $kernel_version) = @_;
- if ($kernel_version < 2.5) {
- #- kernel 2.4 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (find {
- my $s = $ipsec->{$key1}{$_}[0];
- $s !~ /^#/ && $s =~ m/(^conn|^config|^version)/ &&
- $section_name eq "$s $ipsec->{$key1}{$_}[1]";
- } ikeys %{$ipsec->{$key1}}) {
- return $key1;
- }
- }
- } else {
- #- kernel 2.6 part -------------------------------
- foreach my $key1 (ikeys %$ipsec) {
- if (find {
- my $s = "$ipsec->{$key1}{src_range} $ipsec->{$key1}{dst_range}";
- $s !~ /^#/ && $ipsec->{$key1}{src_range} &&
- $section_name eq $s;
- } ikeys %{$ipsec->{$key1}}) {
- return $key1;
- }
- }
- }
-}
-1
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
deleted file mode 100644
index 740741b16..000000000
--- a/perl-install/network/isdn.pm
+++ /dev/null
@@ -1,193 +0,0 @@
-package network::isdn; # $Id$
-