1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-30 20:28:08 +00:00

Merge branch 'master' into 1.5

This commit is contained in:
Julien Duponchelle 2016-03-29 09:20:43 +02:00
commit c1193c23c1
No known key found for this signature in database
GPG Key ID: F1E2485547D4595D
2 changed files with 41 additions and 41 deletions

View File

@ -594,8 +594,10 @@ class VMware(BaseManager):
""" """
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
from win32com.shell import shell, shellcon import ctypes
documents_folder = shell.SHGetSpecialFolderPath(None, shellcon.CSIDL_PERSONAL) path = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(None, 5, None, 0, path)
documents_folder = path.value
windows_type = sys.getwindowsversion().product_type windows_type = sys.getwindowsversion().product_type
if windows_type == 2 or windows_type == 3: if windows_type == 2 or windows_type == 3:
return '{}\My Virtual Machines'.format(documents_folder) return '{}\My Virtual Machines'.format(documents_folder)

View File

@ -24,6 +24,7 @@
function help { function help {
echo "Usage:" >&2 echo "Usage:" >&2
echo "--with-openvpn: Install Open VPN" >&2 echo "--with-openvpn: Install Open VPN" >&2
echo "--with-iou: Install IOU" >&2
echo "--help: This help" >&2 echo "--help: This help" >&2
} }
@ -42,8 +43,9 @@ fi
# Read the options # Read the options
USE_VPN=0 USE_VPN=0
USE_IOU=0
TEMP=`getopt -o h --long with-openvpn,help -n 'gns3-remote-install.sh' -- "$@"` TEMP=`getopt -o h --long with-openvpn,with-iou,help -n 'gns3-remote-install.sh' -- "$@"`
if [ $? != 0 ] if [ $? != 0 ]
then then
help help
@ -58,6 +60,10 @@ while true ; do
USE_VPN=1 USE_VPN=1
shift shift
;; ;;
--with-iou)
USE_IOU=1
shift
;;
-h|--help) -h|--help)
help help
exit 1 exit 1
@ -73,17 +79,16 @@ set -e
export DEBIAN_FRONTEND="noninteractive" export DEBIAN_FRONTEND="noninteractive"
log "Add GNS3 repository" log "Add GNS3 repository"
cat > /etc/apt/sources.list.d/gns3.list << EOF cat <<EOFLIST > /etc/apt/sources.list.d/gns3.list
deb http://ppa.launchpad.net/gns3/ppa/ubuntu trusty main deb http://ppa.launchpad.net/gns3/ppa/ubuntu trusty main
deb-src http://ppa.launchpad.net/gns3/ppa/ubuntu trusty main deb-src http://ppa.launchpad.net/gns3/ppa/ubuntu trusty main
deb http://ppa.launchpad.net/gns3/qemu/ubuntu trusty main deb http://ppa.launchpad.net/gns3/qemu/ubuntu trusty main
deb-src http://ppa.launchpad.net/gns3/qemu/ubuntu trusty main deb-src http://ppa.launchpad.net/gns3/qemu/ubuntu trusty main
EOF EOFLIST
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2E3EF7B apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2E3EF7B
log "Update system packages" log "Update system packages"
dpkg --add-architecture i386
apt-get update apt-get update
log "Upgrade packages" log "Upgrade packages"
@ -107,41 +112,31 @@ fi
log "Add GNS3 to the docker group" log "Add GNS3 to the docker group"
usermod -aG docker gns3 usermod -aG docker gns3
log "IOU setup" if [ $USE_IOU == 1 ]
#apt-get install -y gns3-iou then
log "IOU setup"
dpkg --add-architecture i386
apt-get update
# Force the host name to gns3vm apt-get install -y gns3-iou
hostnamectl set-hostname gns3vm
# Force hostid for IOU # Force the host name to gns3vm
dd if=/dev/zero bs=4 count=1 of=/etc/hostid hostnamectl set-hostname gns3vm
# Block iou call. The server is down # Force hostid for IOU
echo "127.0.0.254 xml.cisco.com" | tee --append /etc/hosts dd if=/dev/zero bs=4 count=1 of=/etc/hostid
# Block iou call. The server is down
echo "127.0.0.254 xml.cisco.com" | tee --append /etc/hosts
fi
log "Add gns3 to the kvm group" log "Add gns3 to the kvm group"
usermod -aG kvm gns3 usermod -aG kvm gns3
log "Setup VDE network"
apt-get install -y vde2 uml-utilities
usermod -a -G vde2-net gns3
cat <<EOF > /etc/network/interfaces.d/qemu0.conf
# A vde network
auto qemu0
iface qemu0 inet static
address 172.16.0.1
netmask 255.255.255.0
vde2-switch -t qemu0
EOF
log "Setup GNS3 server" log "Setup GNS3 server"
mkdir -p /etc/gns3
#TODO: 1.4.5 allow /etc/gns3/gns3_server.conf it's cleaner cat <<EOFC > /etc/gns3/gns3_server.conf
cat <<EOF > /opt/gns3/gns3_server.conf
[Server] [Server]
host = 0.0.0.0 host = 0.0.0.0
port = 3080 port = 3080
@ -151,9 +146,12 @@ report_errors = True
[Qemu] [Qemu]
enable_kvm = True enable_kvm = True
EOF EOFC
cat <<EOF > /etc/init/gns3.conf chown -R gns3:gns3 /etc/gns3
chmod -R 700 /etc/gns3
cat <<EOFI > /etc/init/gns3.conf
description "GNS3 server" description "GNS3 server"
author "GNS3 Team" author "GNS3 Team"
@ -175,7 +173,7 @@ end script
pre-stop script pre-stop script
echo "[`date`] GNS3 Stopping" echo "[`date`] GNS3 Stopping"
end script end script
EOF EOFI
chown root:root /etc/init/gns3.conf chown root:root /etc/init/gns3.conf
chmod 644 /etc/init/gns3.conf chmod 644 /etc/init/gns3.conf
@ -193,7 +191,7 @@ if [ $USE_VPN == 1 ]
then then
log "Setup VPN" log "Setup VPN"
cat <<EOF > /opt/gns3/gns3_server.conf cat <<EOFSERVER > /etc/gns3/gns3_server.conf
[Server] [Server]
host = 172.16.253.1 host = 172.16.253.1
port = 3080 port = 3080
@ -203,7 +201,7 @@ report_errors = True
[Qemu] [Qemu]
enable_kvm = True enable_kvm = True
EOF EOFSERVER
log "Install packages for Open VPN" log "Install packages for Open VPN"
@ -221,7 +219,7 @@ UUID=$(uuid)
log "Update motd" log "Update motd"
cat <<EOF > /etc/update-motd.d/70-openvpn cat <<EOFMOTD > /etc/update-motd.d/70-openvpn
#!/bin/sh #!/bin/sh
echo "" echo ""
echo "_______________________________________________________________________________________________" echo "_______________________________________________________________________________________________"
@ -232,7 +230,7 @@ echo "And add it to your openvpn client."
echo "" echo ""
echo "apt-get remove nginx-light to disable the HTTP server." echo "apt-get remove nginx-light to disable the HTTP server."
echo "And remove this file with rm /etc/update-motd.d/70-openvpn" echo "And remove this file with rm /etc/update-motd.d/70-openvpn"
EOF EOFMOTD
chmod 755 /etc/update-motd.d/70-openvpn chmod 755 /etc/update-motd.d/70-openvpn
@ -250,7 +248,7 @@ chmod 600 /etc/openvpn/key.pem
[ -f /etc/openvpn/cert.pem ] || openssl x509 -req -in /etc/openvpn/csr.pem -out /etc/openvpn/cert.pem -signkey /etc/openvpn/key.pem -days 24855 [ -f /etc/openvpn/cert.pem ] || openssl x509 -req -in /etc/openvpn/csr.pem -out /etc/openvpn/cert.pem -signkey /etc/openvpn/key.pem -days 24855
log "Create client configuration" log "Create client configuration"
cat <<EOF > /root/client.ovpn cat <<EOFCLIENT > /root/client.ovpn
client client
nobind nobind
comp-lzo comp-lzo
@ -302,7 +300,7 @@ server {
listen 8003; listen 8003;
root /usr/share/nginx/openvpn; root /usr/share/nginx/openvpn;
} }
EOF EOFCLIENT
[ -f /etc/nginx/sites-enabled/openvpn ] || ln -s /etc/nginx/sites-available/openvpn /etc/nginx/sites-enabled/ [ -f /etc/nginx/sites-enabled/openvpn ] || ln -s /etc/nginx/sites-available/openvpn /etc/nginx/sites-enabled/
service nginx stop service nginx stop
service nginx start service nginx start