Commit 495634e6 by Czémán Arnold

openbsd: finish password changing

parent 2e3d53de
......@@ -4,5 +4,5 @@ ipv6: ok
hostname: ?
time: ok
smb: ok
passwd update: ?
passwd update: ok
get-ssh-keys: ok
......@@ -70,14 +70,18 @@ class Context(BaseContext):
libc.clock_settime(CLOCK_REALTIME, ctypes.byref(ts))
@staticmethod
def change_password(password):
# TODO: root password
def _change_user_password(username, password):
enc_proc = subprocess.Popen(
['/usr/bin/encrypt'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
enc_password, _ = enc_proc.communicate('%s\n' % password)
subprocess.Popen(
['/usr/sbin/usermod', '-p', enc_password.strip(), 'cloud'])
['/usr/sbin/usermod', '-p', enc_password.strip(), username])
@staticmethod
def change_password(password):
Context._change_user_password('cloud', password)
Context._change_user_password('root', password)
@staticmethod
def restart_networking():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment