updated encrypt_password.py script

This commit is contained in:
Paul 2022-10-23 16:40:45 +02:00
parent 5685a34fe3
commit 06603d9294

View File

@ -10,15 +10,19 @@ GPGHOME = "/etc/salt/gpgkeys"
def parse_args():
parser = argparse.ArgumentParser(description='Encrypt password')
parser.add_argument('password', type=str, nargs=1,
parser.add_argument('password',
type=str,
nargs=1,
help='password to encrypt')
args = parser.parse_args()
return args
def encrypt(password=""):
gpg = gnupg.GPG(gnupghome=GPGHOME, secret_keyring=KEYID)
encrypted_password = gpg.encrypt(password, KEYID)
gpg = gnupg.GPG(gnupghome=GPGHOME,
secret_keyring=KEYID)
encrypted_password = gpg.encrypt(password,
KEYID)
return encrypted_password