summaryrefslogtreecommitdiff
path: root/python/vyos/authutils.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-05 16:23:12 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-06 20:22:35 +0100
commit4b6a6304184a91357c4e8260a134bfa9705f7e23 (patch)
tree6560ad3a28b71e85913ccd173222f86b543c1710 /python/vyos/authutils.py
parentaceb0817a65bf01669cada3ceb60d65b81607bc3 (diff)
downloadvyos-1x-4b6a6304184a91357c4e8260a134bfa9705f7e23.tar.gz
vyos-1x-4b6a6304184a91357c4e8260a134bfa9705f7e23.zip
util: T2226: rewrite make_password_hash to use cmd
Diffstat (limited to 'python/vyos/authutils.py')
-rw-r--r--python/vyos/authutils.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/python/vyos/authutils.py b/python/vyos/authutils.py
index 234294649..90a46ffb4 100644
--- a/python/vyos/authutils.py
+++ b/python/vyos/authutils.py
@@ -15,16 +15,14 @@
import re
-from subprocess import Popen, PIPE, STDOUT
+from vyos.util import cmd
def make_password_hash(password):
""" Makes a password hash for /etc/shadow using mkpasswd """
- mkpasswd = Popen(['mkpasswd', '--method=sha-512', '--stdin'], stdout=PIPE, stdin=PIPE, stderr=PIPE)
- hash = mkpasswd.communicate(input=password.encode(), timeout=5)[0].decode().strip()
-
- return hash
+ mkpassword = 'mkpasswd --method=sha-512 --stdin'
+ return cmd(mkpassword, input=password.encode(), timeout=5)
def split_ssh_public_key(key_string, defaultname=""):
""" Splits an SSH public key into its components """