mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
monkeysphere: Add Let's Encrypt certificates
Filter letsencrypt domains from snakeoil list. Rename views for snakeoil and letsencrypt.
This commit is contained in:
1 parent
cc6f44d87e
commit
5c810ed87f
4 files changed
+140
-21
No files matched your search
+41
-8
@@ -41,9 +41,14 @@ def parse_arguments():
|
||||
host_import_ssh_key.add_argument(
|
||||
'domain', help='Fully-qualified domain name')
|
||||
|
||||
host_import_https_key = subparsers.add_parser(
|
||||
'host-import-https-key', help='Import host HTTPS key')
|
||||
host_import_https_key.add_argument(
|
||||
host_import_snakeoil_key = subparsers.add_parser(
|
||||
'host-import-snakeoil-key', help='Import host snakeoil key')
|
||||
host_import_snakeoil_key.add_argument(
|
||||
'domain', help='Fully-qualified domain name')
|
||||
|
||||
host_import_letsencrypt_key = subparsers.add_parser(
|
||||
'host-import-letsencrypt-key', help="Import Let's Encrypt key")
|
||||
host_import_letsencrypt_key.add_argument(
|
||||
'domain', help='Fully-qualified domain name')
|
||||
|
||||
host_publish_key = subparsers.add_parser(
|
||||
@@ -96,13 +101,41 @@ def subcommand_host_import_ssh_key(arguments):
|
||||
print(output.decode())
|
||||
|
||||
|
||||
def subcommand_host_import_https_key(arguments):
|
||||
"""Import host HTTPS key."""
|
||||
output = subprocess.check_output(
|
||||
def subcommand_host_import_snakeoil_key(arguments):
|
||||
"""Import host snakeoil key."""
|
||||
proc = subprocess.Popen(
|
||||
['monkeysphere-host', 'import-key',
|
||||
'/etc/ssl/private/ssl-cert-snakeoil.key',
|
||||
'https://' + arguments.domain])
|
||||
print(output.decode())
|
||||
'https://' + arguments.domain],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
env=dict(
|
||||
os.environ,
|
||||
MONKEYSPHERE_PROMPT='false'))
|
||||
output, error = proc.communicate()
|
||||
output, error = output.decode(), error.decode()
|
||||
if proc.returncode != 0:
|
||||
raise Exception(output, error)
|
||||
|
||||
print(output)
|
||||
|
||||
|
||||
def subcommand_host_import_letsencrypt_key(arguments):
|
||||
"""Import Let's Encrypt key."""
|
||||
proc = subprocess.Popen(
|
||||
['monkeysphere-host', 'import-key',
|
||||
os.path.join('/etc/letsencrypt/live',
|
||||
arguments.domain, 'privkey.pem'),
|
||||
'https://' + arguments.domain],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
env=dict(
|
||||
os.environ,
|
||||
MONKEYSPHERE_PROMPT='false'))
|
||||
output, error = proc.communicate()
|
||||
output, error = output.decode(), error.decode()
|
||||
if proc.returncode != 0:
|
||||
raise Exception(output, error)
|
||||
|
||||
print(output)
|
||||
|
||||
|
||||
def subcommand_host_publish_key(arguments):
|
||||
|
||||
Reference in new issue
Block a user