Subversion Repositories ALCASAR

Rev

Rev 1371 | Rev 1373 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1371 Rev 1372
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 1371 2014-06-03 22:08:56Z richard $ 
2
#  $Id: alcasar.sh 1372 2014-06-04 09:29:45Z richard $ 
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
 
5
 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...] 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...] 
7
# Ce programme est un logiciel libre ; This software is free and open source
7
# Ce programme est un logiciel libre ; This software is free and open source
Line 880... Line 880...
880
##################################################################################
880
##################################################################################
881
param_chilli ()
881
param_chilli ()
882
{
882
{
883
# chilli unit for systemd
883
# chilli unit for systemd
884
cat << EOF > /lib/systemd/system/chilli.service
884
cat << EOF > /lib/systemd/system/chilli.service
-
 
885
#  This file is part of systemd.
-
 
886
#
-
 
887
#  systemd is free software; you can redistribute it and/or modify it
-
 
888
#  under the terms of the GNU General Public License as published by
-
 
889
#  the Free Software Foundation; either version 2 of the License, or
-
 
890
#  (at your option) any later version.
885
[Unit]
891
[Unit]
886
Description=chilli is a captive portal daemon
892
Description=chilli is a captive portal daemon
887
After=network.target
893
After=network.target
888
 
894
 
889
[Service]
895
[Service]
Line 1182... Line 1188...
1182
	chown -R nfsen:www-data /var/www/nfsen
1188
	chown -R nfsen:www-data /var/www/nfsen
1183
	chown -R apache:apache /usr/share/nfsen
1189
	chown -R apache:apache /usr/share/nfsen
1184
	cp -f $DIR_CONF/nfsen/PortTracker.pm /tmp/nfsen-1.3.6p1/contrib/PortTracker/
1190
	cp -f $DIR_CONF/nfsen/PortTracker.pm /tmp/nfsen-1.3.6p1/contrib/PortTracker/
1185
# use of our conf file and init unit
1191
# use of our conf file and init unit
1186
	cp $DIR_CONF/nfsen/nfsen.conf /tmp/nfsen-1.3.6p1/etc/
1192
	cp $DIR_CONF/nfsen/nfsen.conf /tmp/nfsen-1.3.6p1/etc/
1187
	cp $DIR_CONF/nfsen/nfsen.service /lib/systemd/system/
-
 
1188
# Installation of nfsen
1193
# Installation of nfsen
1189
	DirTmp=$(pwd)
1194
	DirTmp=$(pwd)
1190
	cd /tmp/nfsen-1.3.6p1/
1195
	cd /tmp/nfsen-1.3.6p1/
1191
	/usr/bin/perl5 install.pl etc/nfsen.conf
1196
	/usr/bin/perl5 install.pl etc/nfsen.conf
1192
	/usr/bin/perl5 install.pl etc/nfsen.conf # to avoid a Perl mistake "Semaphore introuvable"
1197
	/usr/bin/perl5 install.pl etc/nfsen.conf # to avoid a Perl mistake "Semaphore introuvable"
Line 1209... Line 1214...
1209
AddType application/x-httpd-php .php 
1214
AddType application/x-httpd-php .php 
1210
php_flag magic_quotes_gpc on 
1215
php_flag magic_quotes_gpc on 
1211
php_flag track_vars on 
1216
php_flag track_vars on 
1212
</Directory>
1217
</Directory>
1213
EOF
1218
EOF
-
 
1219
# nfsen unit for systemd
-
 
1220
cat << EOF > /lib/systemd/system/nfsen.service
-
 
1221
#  This file is part of systemd.
-
 
1222
#
-
 
1223
#  systemd is free software; you can redistribute it and/or modify it
-
 
1224
#  under the terms of the GNU General Public License as published by
-
 
1225
#  the Free Software Foundation; either version 2 of the License, or
-
 
1226
#  (at your option) any later version.
-
 
1227
 
-
 
1228
# This unit launches nfsen (a Netflow grapher).
-
 
1229
[Unit]
-
 
1230
Description= NfSen init script
-
 
1231
After=network.target iptables.service
-
 
1232
 
-
 
1233
[Service]
-
 
1234
Type=oneshot
-
 
1235
RemainAfterExit=yes
-
 
1236
ExecStart=/usr/bin/nfsen start 
-
 
1237
ExecStop=/usr/bin/nfsen stop
-
 
1238
ExecRestart=/usr/bin/nfsen restart
-
 
1239
TimeoutSec=0
-
 
1240
 
-
 
1241
[Install]
-
 
1242
WantedBy=multi-user.target
-
 
1243
EOF
1214
# Add the listen port to collect netflow packet (nfcapd)
1244
# Add the listen port to collect netflow packet (nfcapd)
1215
$SED s?'\$ziparg $extensions.*?\$ziparg $extensions -b 127.0.0.1";'?g /usr/libexec/NfSenRC.pm 
1245
$SED s?'\$ziparg $extensions.*?\$ziparg $extensions -b 127.0.0.1";'?g /usr/libexec/NfSenRC.pm 
1216
# expire delay for the profile "live"
1246
# expire delay for the profile "live"
1217
	nfsen -m live -e 62d 2>/dev/null
1247
	nfsen -m live -e 62d 2>/dev/null
1218
# clear the installation
1248
# clear the installation
Line 1294... Line 1324...
1294
expand-hosts
1324
expand-hosts
1295
bogus-priv
1325
bogus-priv
1296
filterwin2k
1326
filterwin2k
1297
address=/#/$PRIVATE_IP
1327
address=/#/$PRIVATE_IP
1298
EOF
1328
EOF
-
 
1329
# Start after chilli (which create tun0)
-
 
1330
	$SED "s?^After=.*?After=syslog.target network.target chilli.service?g" /lib/systemd/system/dnsmasq.service
1299
# Create dnsmasq-blacklist and dnsmasq-whitelist unit
1331
# Create dnsmasq-blacklist and dnsmasq-whitelist unit
1300
	cp -f /lib/systemd/system/dnsmasq.service /lib/systemd/system/dnsmasq-blacklist.service
1332
	cp -f /lib/systemd/system/dnsmasq.service /lib/systemd/system/dnsmasq-blacklist.service
1301
	cp -f /lib/systemd/system/dnsmasq.service /lib/systemd/system/dnsmasq-whitelist.service
1333
	cp -f /lib/systemd/system/dnsmasq.service /lib/systemd/system/dnsmasq-whitelist.service
1302
	$SED "s?^ExecStart=.*?ExecStart=/usr/sbin/dnsmasq -C /etc/dnsmasq-blacklist.conf?g" /lib/systemd/system/dnsmasq-blacklist.service
1334
	$SED "s?^ExecStart=.*?ExecStart=/usr/sbin/dnsmasq -C /etc/dnsmasq-blacklist.conf?g" /lib/systemd/system/dnsmasq-blacklist.service
1303
	$SED "s?^ExecStart=.*?ExecStart=/usr/sbin/dnsmasq -C /etc/dnsmasq-whitelist.conf?g" /lib/systemd/system/dnsmasq-whitelist.service
1335
	$SED "s?^ExecStart=.*?ExecStart=/usr/sbin/dnsmasq -C /etc/dnsmasq-whitelist.conf?g" /lib/systemd/system/dnsmasq-whitelist.service
1304
# TODO Start after chilli which create tun0
-
 
1305
#	$SED "s?^# chkconfig:.*?# chkconfig: 2345 99 40?g" /etc/init.d/dnsmasq
-
 
1306
} # End dnsmasq
1336
} # End dnsmasq
1307
 
1337
 
1308
##########################################################
1338
##########################################################
1309
##		Fonction "BL"				##
1339
##		Fonction "BL"				##
1310
##########################################################
1340
##########################################################