Commit 495634e6 by Czémán Arnold

openbsd: finish password changing

parent 2e3d53de
...@@ -4,5 +4,5 @@ ipv6: ok ...@@ -4,5 +4,5 @@ ipv6: ok
hostname: ? hostname: ?
time: ok time: ok
smb: ok smb: ok
passwd update: ? passwd update: ok
get-ssh-keys: ok get-ssh-keys: ok
...@@ -70,14 +70,18 @@ class Context(BaseContext): ...@@ -70,14 +70,18 @@ class Context(BaseContext):
libc.clock_settime(CLOCK_REALTIME, ctypes.byref(ts)) libc.clock_settime(CLOCK_REALTIME, ctypes.byref(ts))
@staticmethod @staticmethod
def change_password(password): def _change_user_password(username, password):
# TODO: root password
enc_proc = subprocess.Popen( enc_proc = subprocess.Popen(
['/usr/bin/encrypt'], ['/usr/bin/encrypt'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE) stdin=subprocess.PIPE, stdout=subprocess.PIPE)
enc_password, _ = enc_proc.communicate('%s\n' % password) enc_password, _ = enc_proc.communicate('%s\n' % password)
subprocess.Popen( 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 @staticmethod
def restart_networking(): 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