Browse Source

Merge branch 'develop' of https://github.com/pwman3/pwman3 into develop

Oz N Tiram 7 years ago
parent
commit
d442035088
5 changed files with 30 additions and 19 deletions
  1. 1 1
      Vagrantfile
  2. 12 12
      provision_vagrant.sh
  3. 11 1
      pwman/ui/baseui.py
  4. 1 1
      pwman/util/crypto_engine.py
  5. 5 4
      tests/init_mongo.js

+ 1 - 1
Vagrantfile

@@ -10,7 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   # please see the online documentation at vagrantup.com.
 
   # Every Vagrant virtual environment requires a box to build off of.
-  config.vm.box = "ubuntu/trusty64"
+  config.vm.box = "ubuntu/xenial64"
   config.vm.hostname = "pwman-dev"
   config.vm.provision :shell, path: "provision_vagrant.sh"
 

+ 12 - 12
provision_vagrant.sh

@@ -1,16 +1,19 @@
 #!/usr/bin/env bash
-export DEBIAN_FRONTEND=noninteractive
-
 sudo locale-gen "en_US.UTF-8"
-sudo dpkg-reconfigure locales
+sudo dpkg-reconfigure --frontend=noninteractiv locales
 
 echo "LC_ALL=en_US.UTF-8" >> /etc/environment
 echo "LANG=en_US.UTF-8" >> /etc/environment
 
-PACKAGES="python-psycopg2 sqlite3 git postgresql-server-dev-9.3 \
+PACKAGES="python-psycopg2 sqlite3 git \
+postgresql-server-dev-9.5 postgresql \
+postgresql-contrib \
 python-dev python3-dev libffi-dev \
-postgresql-9.3 python3-psycopg2 mysql-server-5.6 build-essential"
+postgresql python3-psycopg2 build-essential \
+mysql-server-5.7
+"
 
+set -x
 
 apt-get update
 apt-get install -y ${PACKAGES}
@@ -26,21 +29,18 @@ fi
 
 sudo mysqladmin -u root password toor
 
-PYTHON_PACKAGES="psycopg2 pymysql pymongo==2.8 pexpect coverage unittest2 \
-virtualenvwrapper"
+PYTHON_PACKAGES="psycopg2 pymysql pymongo pexpect coverage pew"
 
 sudo pip3 install ${PYTHON_PACKAGES}
-sudo pip install ${PYTHON_PACKAGES}
 
 # install mongodb
+sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
 
-sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
-echo "deb http://repo.mongodb.org/apt/ubuntu \
-	"$(lsb_release -sc)"/mongodb-org/3.0 multiverse" \
-	| sudo tee /etc/apt/sources.list.d/mongodb-org-3.1.list
+echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
 
 sudo apt-get update
 sudo apt-get install -y mongodb-org
+sudo systemctl start mongod
 
 cd /home/vagrant
 if [ ! -d pwman3 ]; then

+ 11 - 1
pwman/ui/baseui.py

@@ -417,7 +417,17 @@ class BaseCommands(HelpUIMixin, AliasesMixin, BaseUtilsMixin):
 
     def do_passwd(self, args):  # pragma: no cover
         """change the master password of the database"""
-        pass
+        """old_enc = CryptoEngine.get()
+        CryptoEngine._instance = None
+        new_enc = CryptoEngine.get()
+
+        TODO: backup tables: NODE, TAG, CRYPTO, LOOKUP
+        TODO: create new tables
+        TODO: Iterate on old entries, create new entries with new crypto
+        TODO: If no errors encountered remove backup tables.
+
+        TODO: expand list nodes to accept table name
+        """
 
     def do_tags(self, args):
         """

+ 1 - 1
pwman/util/crypto_engine.py

@@ -116,7 +116,7 @@ def prepare_data(text, block_size):
     return text.ljust(newdatasize)
 
 
-class CryptoEngine(object):  # pagma: no cover
+class CryptoEngine(object):
     _instance = None
     _callback = None
 

+ 5 - 4
tests/init_mongo.js

@@ -1,7 +1,8 @@
 // run this script with $ mongo < init_mongo.js
 
-db.createUser({user: "tester", pwd: "12345678",
-              roles: [{role: "dbAdmin", db: "pwmantest"},
+if ( !  db.getUser("tester") ) {
+     db.createUser({user: "tester", pwd: "12345678",
+                   roles: [{role: "dbAdmin", db: "pwmantest"},
                       {role: "readWrite", db: "pwmantest"},]
-              })
-
+                   })
+}