From 86c0b90951a382d42cea84b8a27e66e06de0edea Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 27 Oct 2023 14:42:22 +1000 Subject: [PATCH 1/6] Use Python 3.8 to publish API doc --- .github/workflows/publish-api-documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-api-documentation.yml b/.github/workflows/publish-api-documentation.yml index 30beb62f..68bd91cd 100644 --- a/.github/workflows/publish-api-documentation.yml +++ b/.github/workflows/publish-api-documentation.yml @@ -18,7 +18,7 @@ jobs: ref: "gh-pages" - uses: actions/setup-python@v3 with: - python-version: 3.7 + python-version: 3.8 - name: Merge changes from 3.0 branch run: | git config user.name github-actions From cbc7e59d3f149ebd705cb6cffeb4fb1ec56db6a3 Mon Sep 17 00:00:00 2001 From: Dustin Date: Mon, 30 Oct 2023 11:00:45 -0400 Subject: [PATCH 2/6] Update remote-install.sh Removed an extra slash at the end when setting the user home directory. This was causing unexpected behavior for other scrips as ~ was aliased to /opt/gns3/ instead of the expected /opt/gns3. This caused an extra / to appear in commands unexpectedly. --- scripts/remote-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index 4664cd04..6c68a640 100644 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -163,9 +163,9 @@ log "Install GNS3 packages" apt-get install -y gns3-server log "Create user GNS3 with /opt/gns3 as home directory" -if [ ! -d "/opt/gns3/" ] +if [ ! -d "/opt/gns3" ] then - useradd -m -d /opt/gns3/ gns3 + useradd -m -d /opt/gns3 gns3 fi @@ -462,4 +462,4 @@ NEEDRESTART_MODE=a apt-get upgrade python3 -c 'import sys; sys.path.append("/usr/local/bin/"); import welcome; ws = welcome.Welcome_dialog(); ws.repair_remote_install()' cd /opt/gns3 su gns3 -fi \ No newline at end of file +fi From 7ad3afbdef96640e056eac062ba7dc3da8286553 Mon Sep 17 00:00:00 2001 From: Dustin Date: Sun, 5 Nov 2023 13:35:06 -0500 Subject: [PATCH 3/6] Update welcome.py Fixed an issue where the shell option in dialog failed to drop you back to bash. --- scripts/welcome.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/welcome.py b/scripts/welcome.py index 821e4f97..d7e0cf4c 100644 --- a/scripts/welcome.py +++ b/scripts/welcome.py @@ -438,7 +438,8 @@ Images and projects are located in /opt/gns3 self.display.clear() if code == Dialog.OK: if tag == "Shell": - os.execvp("bash", ['/bin/bash']) + print("Type: 'welcome.py' to get back to the dialog menu.") + sys.exit(0) elif tag == "Version": self.mode() elif tag == "Restore": From 76bd5921c5ab2daa325a5b9a123673907561d632 Mon Sep 17 00:00:00 2001 From: Xatrekak Date: Mon, 6 Nov 2023 19:02:29 -0500 Subject: [PATCH 4/6] Fixed updating system and GNS3. --- scripts/remote-install.sh | 5 +++++ scripts/welcome.py | 41 ++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index 6c68a640..289ad335 100644 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -304,6 +304,11 @@ log "GNS3 installed with success" if [ $WELCOME_SETUP == 1 ] then +cat < /etc/sudoers.d/gns3 +gns3 ALL = (ALL) NOPASSWD: /usr/bin/apt-key +gns3 ALL = (ALL) NOPASSWD: /usr/bin/apt-get +gns3 ALL = (ALL) NOPASSWD: /usr/sbin/reboot +EOFI NEEDRESTART_MODE=a apt-get install -y net-tools NEEDRESTART_MODE=a apt-get install -y python3-pip NEEDRESTART_MODE=a apt-get install -y dialog diff --git a/scripts/welcome.py b/scripts/welcome.py index d7e0cf4c..77de8d75 100644 --- a/scripts/welcome.py +++ b/scripts/welcome.py @@ -163,19 +163,38 @@ class Welcome_dialog: def update(self, force=False): if not force: - if self.display.yesno("PLEASE SNAPSHOT THE VM BEFORE RUNNING THE UPGRADE IN CASE OF FAILURE. The server will reboot at the end of the upgrade process. Continue?") != self.display.OK: + if self.display.yesno("It is recommended to ensure all Nodes are shutdown before upgrading. Continue?") != self.display.OK: return - release = self.get_release() - if release == "2.2": - if self.display.yesno("It is recommended to run GNS3 version 2.2 with lastest GNS3 VM based on Ubuntu 18.04 LTS, please download this VM from our website or continue at your own risk!") != self.display.OK: + code, option = self.display.menu("Select an option", + choices=[("Upgrade GNS3", "Upgrades only the GNS3 pakage and dependences."), + ("Upgrade All", "Upgrades all avaiable packages"), + ("Dist Upgrade", "Upgrades all avaiable packages and the Linux Kernel. Requires a reboot.")]) + if code == Dialog.OK: + if option == "Upgrade GNS3": + ret = os.system( + "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2E3EF7B \ + && sudo apt-get update \ + && sudo apt-get install -y --only-upgrade gns3-server" + ) + elif option == "Upgrade All": + ret = os.system( + 'sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com \ + && sudo apt-get update \ + && sudo apt-get upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' + ) + elif option == "Dist Upgrade": + ret = os.system( + 'sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com \ + && sudo apt-get update \ + && sudo apt-get dist-upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' + ) + if ret != 0: + print("ERROR DURING UPGRADE PROCESS PLEASE TAKE A SCREENSHOT IF YOU NEED SUPPORT") + time.sleep(15) return - if release.endswith("dev"): - ret = os.system("curl -Lk https://raw.githubusercontent.com/GNS3/gns3-vm/unstable/scripts/update_{}.sh > /tmp/update.sh && bash -x /tmp/update.sh".format(release)) - else: - ret = os.system("curl -Lk https://raw.githubusercontent.com/GNS3/gns3-vm/master/scripts/update_{}.sh > /tmp/update.sh && bash -x /tmp/update.sh".format(release)) - if ret != 0: - print("ERROR DURING UPGRADE PROCESS PLEASE TAKE A SCREENSHOT IF YOU NEED SUPPORT") - time.sleep(15) + if option == "Dist Upgrade": + if self.display.yesno("Reboot now?") == self.display.OK: + os.system("sudo reboot now") def migrate(self): From ac86717bc07fd817b7cdf5b320f2058deb7e5f35 Mon Sep 17 00:00:00 2001 From: John Fleming <31658656+spikefishjohn@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:15:17 -0500 Subject: [PATCH 5/6] Update telnet_server.py Set tcp keepalive timers to 60 seconds. Seems to default to 2 hours on ubuntu 22. Most firewalls will age out an idle tcp session at 1 hour. Will not address telnet console failing after a tcp session has failed (TimeoutError). --- gns3server/utils/asyncio/telnet_server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gns3server/utils/asyncio/telnet_server.py b/gns3server/utils/asyncio/telnet_server.py index 0f6152e1..14742e00 100644 --- a/gns3server/utils/asyncio/telnet_server.py +++ b/gns3server/utils/asyncio/telnet_server.py @@ -190,6 +190,11 @@ class AsyncioTelnetServer: sock = network_writer.get_extra_info("socket") sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + # 60 sec keep alives, close tcp session after 4 missed + # Will keep a firewall from aging out telnet console. + writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) + writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 10) + writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4) #log.debug("New connection from {}".format(sock.getpeername())) # Keep track of connected clients From 54abf85523d266dd69cc5275f0c581ec04984b0d Mon Sep 17 00:00:00 2001 From: John Fleming <31658656+spikefishjohn@users.noreply.github.com> Date: Thu, 25 Jan 2024 01:41:57 -0500 Subject: [PATCH 6/6] Update telnet_server.py Maybe use the correct object name this time for the socket objects. --- gns3server/utils/asyncio/telnet_server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gns3server/utils/asyncio/telnet_server.py b/gns3server/utils/asyncio/telnet_server.py index 14742e00..b8829847 100644 --- a/gns3server/utils/asyncio/telnet_server.py +++ b/gns3server/utils/asyncio/telnet_server.py @@ -192,9 +192,9 @@ class AsyncioTelnetServer: sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) # 60 sec keep alives, close tcp session after 4 missed # Will keep a firewall from aging out telnet console. - writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) - writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 10) - writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4) + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 10) + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4) #log.debug("New connection from {}".format(sock.getpeername())) # Keep track of connected clients