Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 1517 2014-12-09 23:06:31Z richard $
|
2 |
# $Id: alcasar.sh 1518 2014-12-16 23:06:52Z 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 1304... |
Line 1304... |
1304 |
userdel -r tinyproxy 2>/dev/null
|
1304 |
userdel -r tinyproxy 2>/dev/null
|
1305 |
groupdel tinyproxy 2>/dev/null
|
1305 |
groupdel tinyproxy 2>/dev/null
|
1306 |
fi
|
1306 |
fi
|
1307 |
groupadd -f tinyproxy
|
1307 |
groupadd -f tinyproxy
|
1308 |
useradd -r -g tinyproxy -s /bin/false -c "system user for tinyproxy" tinyproxy
|
1308 |
useradd -r -g tinyproxy -s /bin/false -c "system user for tinyproxy" tinyproxy
|
1309 |
mkdir -p /run/tinyproxy /var/log/tinyproxy
|
1309 |
mkdir -p var/run/tinyproxy /var/log/tinyproxy
|
1310 |
chown -R tinyproxy.tinyproxy /run/tinyproxy /var/log/tinyproxy
|
1310 |
chown -R tinyproxy.tinyproxy /run/tinyproxy /var/log/tinyproxy
|
1311 |
[ -e /etc/tinyproxy/tinyproxy.conf.default ] || cp /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.conf.default
|
1311 |
[ -e /etc/tinyproxy/tinyproxy.conf.default ] || cp /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.conf.default
|
1312 |
$SED "s?^User.*?User tinyproxy?g" /etc/tinyproxy/tinyproxy.conf
|
1312 |
$SED "s?^User.*?User tinyproxy?g" /etc/tinyproxy/tinyproxy.conf
|
1313 |
$SED "s?^Group.*?Group tinyproxy?g" /etc/tinyproxy/tinyproxy.conf
|
1313 |
$SED "s?^Group.*?Group tinyproxy?g" /etc/tinyproxy/tinyproxy.conf
|
1314 |
$SED "s?^Port.*?Port 8090?g" /etc/tinyproxy/tinyproxy.conf # Listen Port
|
1314 |
$SED "s?^Port.*?Port 8090?g" /etc/tinyproxy/tinyproxy.conf # Listen Port
|
1315 |
$SED "s?^#Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf # Listen NIC (only intif)
|
1315 |
$SED "s?^#Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf # Listen NIC (only intif)
|
1316 |
$SED "s?^#LogFile.*?LogFile \"/var/log/tinyproxy/tinyproxy.log\"?g" /etc/tinyproxy/tinyproxy.conf
|
1316 |
$SED "s?^#LogFile.*?LogFile \"/var/log/tinyproxy/tinyproxy.log\"?g" /etc/tinyproxy/tinyproxy.conf
|
- |
|
1317 |
$SED "s?^#PidFile.*?PidFile \"/var/run/tinyproxy/tinyproxy.pid\"?g" /etc/tinyproxy/tinyproxy.conf
|
1317 |
$SED "s?^LogLevel.*?LogLevel Error?g" /etc/tinyproxy/tinyproxy.conf # Only errors are logged
|
1318 |
$SED "s?^LogLevel.*?LogLevel Error?g" /etc/tinyproxy/tinyproxy.conf # Only errors are logged
|
1318 |
$SED "s?^#Upstream.*?Upstream 127.0.0.1:8090?g" /etc/tinyproxy/tinyproxy.conf # forward to HAVP
|
1319 |
$SED "s?^#Upstream.*?Upstream 127.0.0.1:8090?g" /etc/tinyproxy/tinyproxy.conf # forward to HAVP
|
1319 |
$SED "s?^#DisableViaHeader.*?DisableViaHeader Yes?g" /etc/tinyproxy/tinyproxy.conf # Stealth mode
|
1320 |
$SED "s?^#DisableViaHeader.*?DisableViaHeader Yes?g" /etc/tinyproxy/tinyproxy.conf # Stealth mode
|
1320 |
# Create the systemd unit
|
1321 |
# Create the systemd unit
|
1321 |
cat << EOF > /lib/systemd/system/tinyproxy.service
|
1322 |
cat << EOF > /lib/systemd/system/tinyproxy.service
|
Line 1325... |
Line 1326... |
1325 |
# under the terms of the GNU General Public License as published by
|
1326 |
# under the terms of the GNU General Public License as published by
|
1326 |
# the Free Software Foundation; either version 2 of the License, or
|
1327 |
# the Free Software Foundation; either version 2 of the License, or
|
1327 |
# (at your option) any later version.
|
1328 |
# (at your option) any later version.
|
1328 |
|
1329 |
|
1329 |
# This unit launches tinyproxy (a very light proxy).
|
1330 |
# This unit launches tinyproxy (a very light proxy).
|
- |
|
1331 |
# The "sleep 2" is needed because the pid file isn't ready for systemd
|
1330 |
[Unit]
|
1332 |
[Unit]
|
1331 |
Description=Tinyproxy Web Proxy Server
|
1333 |
Description=Tinyproxy Web Proxy Server
|
1332 |
After=network.target iptables.service
|
1334 |
After=network.target iptables.service
|
1333 |
|
1335 |
|
1334 |
[Service]
|
1336 |
[Service]
|
1335 |
Type=forking
|
1337 |
Type=forking
|
1336 |
User=tinyproxy
|
- |
|
1337 |
ExecStartPre=/bin/chown -R tinyproxy.tinyproxy /run/tinyproxy
|
1338 |
ExecStartPre=/bin/chown -R tinyproxy.tinyproxy /var/run/tinyproxy /var/log/tinyproxy
|
- |
|
1339 |
ExecStartPre=/bin/sleep 2
|
1338 |
PIDFile=/run/tinyproxy/tinyproxy.pid
|
1340 |
PIDFile=/var/run/tinyproxy/tinyproxy.pid
|
1339 |
ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy/tinyproxy.conf
|
1341 |
ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy/tinyproxy.conf
|
1340 |
|
1342 |
|
1341 |
[Install]
|
1343 |
[Install]
|
1342 |
WantedBy=multi-user.target
|
1344 |
WantedBy=multi-user.target
|
1343 |
EOF
|
1345 |
EOF
|