"Fossies" - the Fresh Open Source Software Archive 
Member "sshdfilter-1.5.7/install_aswrapper.pl" (4 Jun 2010, 6575 Bytes) of package /linux/privat/old/sshdfilter-1.5.7.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "install_aswrapper.pl" see the
Fossies "Dox" file reference documentation.
1 #!/usr/bin/perl
2
3 # Identify the distro, accounting for slackware.
4 if (-e "/etc/slackware-version")
5 { open(ISSFILE,"/etc/slackware-version"); }
6 else
7 { open(ISSFILE,"/etc/issue") || die "Tried to open /etc/issue to guess your system type, but failed"; }
8
9 my $aline=<ISSFILE>;
10
11 close ISSFILE;
12
13 my $pattype="";
14 my $inittype="";
15 my $confpath="";
16 my $exepath="";
17 my $initname="";
18 my $logconf="";
19
20 if( $aline =~ /Red Hat Enterprise Linux ES release 4/ )
21 {
22 printf "System type: RH Enterprise\n";
23 $pattype="rhFC30";
24 $inittype="$pattype";
25 $confpath="/etc/";
26 $exepath="/usr/sbin/";
27 $initname="sshd";
28 $logconf="/etc/log.d/conf/services/";
29 $logserv="/etc/log.d/scripts/services/";
30 } elsif ( $aline =~ /Fedora Core release 2 / ) {
31 printf "System type: Fedora Core 2, post RH9.0, but not FC3 or FC4\n";
32 $pattype="rh7390";
33 $inittype="$pattype";
34 $confpath="/etc/";
35 $exepath="/usr/sbin/";
36 $initname="sshd";
37 $logconf="/etc/log.d/conf/services/";
38 $logserv="/etc/log.d/scripts/services/";
39 } elsif ( $aline =~ /Fedora Core release 4 / ) {
40 printf "System type: Fedora Core 4\n";
41 $pattype="rhFC30";
42 $inittype="rhFC40";
43 $confpath="/etc/";
44 $exepath="/usr/sbin/";
45 $initname="sshd";
46 $logconf="/etc/logwatch/conf/";
47 $logserv="/etc/logwatch/scripts/";
48 } elsif( $aline =~ /Fedora/ ) {
49 printf "System type: Fedora, post RH9.0 and post Fedora Core 2\n";
50 $pattype="rhFC30";
51 $inittype="$pattype";
52 $confpath="/etc/";
53 $exepath="/usr/sbin/";
54 $initname="sshd";
55 $logconf="/etc/log.d/conf/services/";
56 $logserv="/etc/log.d/scripts/services/";
57 } elsif ( $aline =~ /Red Hat/ ) {
58 printf "System type: RedHat, pre Fedora\n";
59 $pattype="rh7390";
60 $inittype="$pattype";
61 $confpath="/etc/";
62 $exepath="/usr/sbin/";
63 $initname="sshd";
64 $logconf="/etc/log.d/conf/services/";
65 $logserv="/etc/log.d/scripts/services/";
66 } elsif ( $aline =~ /Ubuntu/ ) {
67 printf "System type: Ubuntu system\n";
68 $pattype="";
69 $inittype="ub80";
70 $confpath="/etc/";
71 $exepath="/usr/local/sbin/";
72 $initname="ssh";
73 $logconf="/etc/log.d/conf/services/";
74 $logserv="/usr/share/logwatch/scripts/services/";
75 } elsif ( $aline =~ /Debian/ ) {
76 printf "System type: Debian system\n";
77 $pattype="deb31";
78 $inittype="$pattype";
79 $confpath="/etc/";
80 $exepath="/usr/local/sbin/";
81 $initname="ssh";
82 $logconf="/etc/log.d/conf/services/";
83 $logserv="/usr/share/logwatch/scripts/services/";
84 } elsif ( $aline =~ / SUSE / ) {
85 printf "System type: SUSE system\n";
86 $pattype="su10rc1";
87 $inittype="$pattype";
88 $confpath="/etc/";
89 $exepath="/usr/local/sbin/";
90 $initname="sshd";
91 $logconf="/etc/log.d/conf/services/";
92 $logserv="/usr/share/logwatch/scripts/services/";
93 } elsif ( $aline =~ /entoo / ) {
94 printf "System type: Gentoo system\n";
95 $pattype="su10rc1";
96 $inittype="$pattype";
97 $confpath="/etc/";
98 $exepath="/usr/sbin/";
99 $initname="sshd";
100 $logconf="/etc/log.d/conf/services/";
101 $logserv="/usr/share/logwatch/scripts/services/";
102 } elsif ( $aline =~ /CentOS 5\./ ) {
103 printf "System type: CentOS 5.x\n";
104 $pattype="co55";
105 $inittype="$pattype";
106 $confpath="/etc/";
107 $exepath="/usr/sbin/";
108 $initname="sshd";
109 $logconf="/etc/log.d/conf/services/";
110 $logserv="/etc/log.d/scripts/services/";
111 } elsif ( $aline =~ /CentOS 3\./ ) {
112 printf "System type: CentOS 3.x\n";
113 $pattype="rhFC30";
114 $inittype="$pattype";
115 $confpath="/etc/";
116 $exepath="/usr/sbin/";
117 $initname="sshd";
118 $logconf="/etc/log.d/conf/services/";
119 $logserv="/etc/log.d/scripts/services/";
120 } elsif ( $aline =~ /CentOS / ) {
121 printf "System type: CentOS 4.x\n";
122 $pattype="rh7390";
123 $inittype="$pattype";
124 $confpath="/etc/";
125 $exepath="/usr/sbin/";
126 $initname="sshd";
127 $logconf="/etc/log.d/conf/services/";
128 $logserv="/etc/log.d/scripts/services/";
129 } elsif ($aline =~ /Slackware/) {
130 printf "System type: Slackware Linux\n";
131 $pattype = "su10rc1";
132 $inittype = "slackware";
133 $confpath = "/etc";
134 $exepath = "/usr/sbin";
135 $initname = "sshd";
136 $logconf="/etc/log.d/conf/services";
137 $logserv="/etc/log.d/scripts/services";
138 } else {
139 printf "System type does not appear to be Fedora, RedHat pre Fedora, Debian, Ubuntu, \n";
140 printf "CentOS, SUSE, RH Enterprise, Gentoo or Slackware. So, you will have to install manually \n";
141 printf "(see INSTALL) and send me some hints on how to identify your system.\n";
142 exit 1;
143 }
144
145
146 printf "configuration path: $confpath.\n";
147 printf "exepath: $exepath.\n";
148 if( -f "$confpath/sshdfilterrc" ) {
149 printf "Not installing configuration file, already exists.\n";
150 } else {
151 printf "Installing configuration file sshdfilterrc.\n";
152 system("cat etc/sshdfilterrc > /etc/sshdfilterrc");
153 system("chmod 644 /etc/sshdfilterrc");
154 }
155
156 printf "Installing man pages to /usr/share/man/man{1,5}\n";
157 system("install -m 644 man/sshdfilter.1 /usr/share/man/man1/");
158 system("install -m 644 man/sshdfilterrc.5 /usr/share/man/man5/");
159
160 printf "Installing sshdfilter script.\n";
161 system("install -m 744 source/sshdfilter.pl $exepath/sshdfilter");
162
163 if ($inittype eq "slackware") {
164 printf "Patching your sshd startup script in /etc/rc.d\n";
165 if( ! -f "/etc/rc.d/$initname.orig" ) {
166 system("cp /etc/rc.d/$initname /etc/rc.d/$initname.orig");
167 system("chmod 644 /etc/rc.d/$initname.orig");
168 }
169 system("(cd /etc/rc.d ; patch -l -N -b ) < etc/init.d/rc.$initname.patch");
170 } else {
171 printf "Patching your sshd startup script in /etc/init.d/.\n";
172 if( ! -f "/etc/init.d/$initname.orig" ) {
173 system("cp /etc/init.d/$initname /etc/init.d/$initname.orig");
174 }
175 system("(cd /etc/init.d/ ; patch -l -N -b ) < etc/init.d/$initname.$inittype.patch");
176 }
177
178 #if ( -d "$logconf" ) {
179 # printf "LogWatch directory found, installing LogWatch scripts.\n";
180 # system("install -m 644 etc/log.d/conf/services/sshdfilt.conf $logconf/");
181 # system("install -m 644 etc/log.d/scripts/services/sshdfilt $logserv/");
182 # printf "Modifying $logconf/secure.conf.\n";
183 # if( ! -f "$logconf/secure.conf.orig" ) {
184 # system("cp $logconf/secure.conf $logconf/secure.conf.orig");
185 # }
186 # system("sed \"s/ sshdfilt//g;s/ sshd/ sshd sshdfilt/g;\" < $logconf/secure.conf > /tmp/sshdfilt.inst");
187 # system("install -m 644 /tmp/sshdfilt.inst $logconf/secure.conf");
188 #}
189
190 printf "Assuming that all worked, read INSTALL for the final steps.\n";
191 printf "If not, you will have to install manually by reading INSTALL in full,\n";
192 printf "this script followed route 1, sshd wrapper, not route 2, standalone.\n";
193
194