updated scripts

This commit is contained in:
Paul 2021-01-17 17:45:09 +01:00
parent 736d270364
commit 0b97450366

View File

@ -3,9 +3,11 @@
import argparse import argparse
import gnupg import gnupg
KEYID = "salt" KEYID = "salt"
GPGHOME = "/etc/salt/gpgkeys" GPGHOME = "/etc/salt/gpgkeys"
def parse_args(): def parse_args():
parser = argparse.ArgumentParser(description='Encrypt password') parser = argparse.ArgumentParser(description='Encrypt password')
parser.add_argument('password', type=str, nargs=1, parser.add_argument('password', type=str, nargs=1,
@ -13,6 +15,7 @@ def parse_args():
args = parser.parse_args() args = parser.parse_args()
return args return args
def encrypt(password=""): def encrypt(password=""):
gpg = gnupg.GPG(gnupghome=GPGHOME, secret_keyring=KEYID) gpg = gnupg.GPG(gnupghome=GPGHOME, secret_keyring=KEYID)
encrypted_password = gpg.encrypt(password, KEYID) encrypted_password = gpg.encrypt(password, KEYID)