3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

Add command line mkpasswd utility & encrypted password example

This commit is contained in:
James Lu 2016-11-19 17:16:04 -08:00
parent b1e4b34b79
commit c4351d61c6
2 changed files with 23 additions and 2 deletions

View File

@ -49,9 +49,13 @@ login:
accounts: accounts:
# Creates an account with username "user1". # Creates an account with username "user1".
user1: user1:
# Defines the password for the user. # Defines the password for the user. You can encrypt passwords using the
password: "somestring" # 'mkpasswd' command or the 'pylink-mkpasswd' utility included with PyLink.
password: "$6$rounds=617998$BwHhwX4wB5R0H9uw$Lyo.4icYjVSnSCDsjNIO5Ap5LAcyqLspBcUqVR0qlIB9o6vKU.WyrttHZum4dVW35cuc2wGP2SKa5Bv/svdiv1"
# Determines whether the password given is in plain-text. Defaults to false
# (plain text) for backwards compatibility.
encrypted: true
servers: servers:
# Please note: these are only EXAMPLE link blocks. You should edit them and # Please note: these are only EXAMPLE link blocks. You should edit them and

17
pylink-mkpasswd Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
"""
Password hashing utility for PyLink IRC Services.
"""
import passlib
from passlib.apps import custom_app_context as pwd_context
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Hashes a password for use with PyLink IRC Services.')
parser.add_argument('password', help='specifies the password to hash')
args = parser.parse_args()
assert args.password, "Password cannot be empty!"
print(pwd_context.encrypt(args.password))