Skip to content
Snippets Groups Projects
Commit 6775d7e9 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Fixed iptables setup for apt cacher (refs #19053).

parent 2e09e693
No related branches found
No related tags found
No related merge requests found
......@@ -5,24 +5,22 @@ source /root/envsetup/conf.sh
APT_CACHER_PWD=$(pwgen 12)
# installation cm
aptitude install -y campus-manager
apt-get install -y campus-manager
# installation cache local
aptitude install -y apt-cacher-ng
apt-get install -y apt-cacher-ng
# secure it
echo "AdminAuth: ${APT_CACHER_USER}:${APT_CACHER_PWD}" >> /etc/apt-cacher-ng/security.conf
service apt-cacher-ng restart
# proxy
if [ ${PROXY} = "1" ]
then
if [ ${PROXY_AUTHENTICATION} = "1" ]
then
# general settings
echo "Proxy: http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
if [ ${PROXY} = "1" ]; then
if [ ${PROXY_AUTHENTICATION} = "1" ]; then
# general settings
echo "Proxy: http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
else
# general settings
echo "Proxy: http://${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
# general settings
echo "Proxy: http://${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
fi
fi
......@@ -35,11 +33,18 @@ sed -i "s@server_name skyreach;@server_name ${CM_SERVER_NAME};@" /etc/nginx/site
service nginx restart
# iptables rules for port 3142
DEBIAN_FRONTEND=noninteractive aptitude install -y iptables-persistent
update-rc.d iptables-persistent enable
DEBIAN_FRONTEND=noninteractive apt-get install -y iptables-persistent
iptables -A INPUT -p tcp -s localhost --destination-port 3142 -j ACCEPT
iptables -A INPUT -p tcp --destination-port 3142 -j DROP
service iptables-persistent save
iptables-save
# the save using "service" command fails on VM
if ( cat /etc/lsb-release | grep '14.04' ); then
update-rc.d iptables-persistent enable
service iptables-persistent save || true
else
update-rc.d netfilter-persistent enable
service netfilter-persistent save || true
fi
LIG=$(grep -n "^iface lo inet loopback" /etc/network/interfaces | awk -F ":" '{print$1}')
LIG=$(( ${LIG} + 1 ))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment