Skip to content

Commit

Permalink
Fix ModuleErrorNotFoundError: No module named passlib. Ref https://gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed May 15, 2024
1 parent 7eca89a commit 13c42e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fi

# Install the GNS3 VM menu dependency
sudo apt-get install -y dialog
sudo -H pip3 install pythondialog
sudo -H pip3 install pythondialog bcrypt==4.1.2

# Block IOU phone home call
echo "127.0.0.254 xml.cisco.com" | sudo tee --append /etc/hosts
Expand Down
1 change: 1 addition & 0 deletions scripts/upgrade_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ sudo dpkg --configure -a
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade -y

# upgrade the GNS3 welcome script
sudo -H pip3 install pythondialog bcrypt==4.1.2
curl -Lk "https://raw.githubusercontent.com/GNS3/gns3-vm/$BRANCH/scripts/welcome.py" > /tmp/gns3welcome.py
sudo mv "/tmp/gns3welcome.py" "/usr/local/bin/gns3welcome.py"
sudo chmod 755 "/usr/local/bin/gns3welcome.py"
Expand Down
9 changes: 5 additions & 4 deletions scripts/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
import configparser
import urllib.request
import json
from passlib.context import CryptContext
from dialog import Dialog, PythonDialogBug
import bcrypt

pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
from dialog import Dialog, PythonDialogBug

try:
locale.setlocale(locale.LC_ALL, '')
Expand Down Expand Up @@ -407,7 +406,9 @@ def reset_password():

if d.yesno("Do you want to reset the admin password for the GNS3 controller?") == d.OK:
# sqlite3 gns3_controller.db "UPDATE users SET hashed_password = null WHERE username = 'admin';"
hashed_password = pwd_context.hash("admin")
salt = bcrypt.gensalt()
default_password = "admin"
hashed_password = bcrypt.hashpw(password=default_password.encode('utf-8'), salt=salt).decode('utf-8')
os.system('sqlite3 /opt/gns3/server/gns3_controller.db "UPDATE users SET hashed_password = {} WHERE username = admin;"'.format(hashed_password))
d.infobox("Admin password has been reset to 'admin'")

Expand Down

0 comments on commit 13c42e9

Please sign in to comment.