script: temp homedir config

* added passphrase caching of 5 minutes.
This commit is contained in:
Ben McGinnes 2018-03-27 12:16:29 +11:00
parent 5b32efbaf3
commit 1b5da37a47

View File

@ -69,6 +69,10 @@ personal-digest-preferences SHA512 SHA384 SHA256 SHA224 RIPEMD160 SHA1
personal-compress-preferences ZLIB BZIP2 ZIP Uncompressed personal-compress-preferences ZLIB BZIP2 ZIP Uncompressed
""" """
agentconf = """# gpg-agent.conf settings for key generation:
default-cache-ttl 300
"""
if len(sys.argv) == 1: if len(sys.argv) == 1:
print(intro) print(intro)
new_homedir = input("Enter the temporary gnupg homedir name: ") new_homedir = input("Enter the temporary gnupg homedir name: ")
@ -107,9 +111,12 @@ else:
print("Creating the {0} directory.".format(nh)) print("Creating the {0} directory.".format(nh))
os.mkdir(nh) os.mkdir(nh)
os.chmod(nh, 0o700) os.chmod(nh, 0o700)
with open("{0}/{1}".format(nh, "gpg.conf"), "w") as f: with open("{0}/{1}".format(nh, "gpg.conf"), "w") as f1:
f.write(gpgconf) f1.write(gpgconf)
os.chmod("{0}/{1}".format(nh, "gpg.conf"), 0o600) os.chmod("{0}/{1}".format(nh, "gpg.conf"), 0o600)
with open("{0}/{1}".format(nh, "gpg-agent.conf"), "w") as f2:
f2.write(gpgconf)
os.chmod("{0}/{1}".format(nh, "gpg-agent.conf"), 0o600)
print("""You may now use the {0} directory as an alternative GPG homedir: print("""You may now use the {0} directory as an alternative GPG homedir:
gpg --homedir {0} gpg --homedir {0}