You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.4 KiB

#!/usr/bin/env bash
DESC="Configuration de darkside."
run() {
. $VDN_PATH/bin/functions-scripts.sh
setErrorHandler
echoStart
name="darkside"
requireSshGuests $name
setHostname $name
cat << EOF | setHosts $name
127.0.0.1 localhost
$($VDN_PATH/bin/vdn-infos darkside PUBLIC_IP) darkside
$($VDN_PATH/bin/vdn-infos brightside PUBLIC_IP) brightside
$($VDN_PATH/bin/vdn-infos passerelle PUBLIC_IP) passerelle
EOF
# Fixe la route par défaut
cat << EOF | setFile $name /etc/network/if-up.d/default-interface
#!/bin/sh
[ "\$IFACE" = "eth0" ] && {
. /etc/vdn/config
/sbin/ifconfig eth0 \$PUBLIC_IP
/sbin/route add default dev eth0
} || :
EOF
vdn-ssh root@$name chmod 755 /etc/network/if-up.d/default-interface
cat << EOF | setInterfaces $name
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address $($VDN_PATH/bin/vdn-infos $name PUBLIC_IP)
netmask 255.0.0.0
EOF
echo "Post configurations."
cat << EOF | setFile $name /var/www/html/index.html
<html>
<body>
VDN Default Page for $name : It works !
</body>
</html>
EOF
vdn-ssh root@$name "systemctl enable apache2; systemctl restart apache2"
unsetErrorHandler
echoDone
}