mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-10 11:00:22 +00:00
sso: Safety check to make sure auth_pubtkt is enabled
Signed-off-by: Joseph Nuthalpati <njoseph@thoughtworks.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
416cb881cd
commit
32d17e6c93
@ -21,10 +21,10 @@ sign it with the FreedomBox server's private key.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
import base64
|
||||
import datetime
|
||||
import argparse
|
||||
from plinth import action_utils
|
||||
|
||||
from OpenSSL import crypto
|
||||
|
||||
@ -40,18 +40,26 @@ def parse_arguments():
|
||||
'create-key-pair',
|
||||
help='create a key pair for the apache server '
|
||||
'to sign auth_pubtkt tickets')
|
||||
gen_tkt = subparsers.add_parser('generate-ticket',
|
||||
help='generate auth_pubtkt ticket')
|
||||
subparsers.add_parser(
|
||||
'enable-mod', help='enabled the Apache module auth_pubtkt')
|
||||
gen_tkt = subparsers.add_parser(
|
||||
'generate-ticket', help='generate auth_pubtkt ticket')
|
||||
gen_tkt.add_argument('--uid', help='username of the user')
|
||||
gen_tkt.add_argument('--private-key-file',
|
||||
help='path of the private key file of the server')
|
||||
gen_tkt.add_argument('--tokens',
|
||||
help='tokens, usually containing the user groups')
|
||||
gen_tkt.add_argument(
|
||||
'--private-key-file',
|
||||
help='path of the private key file of the server')
|
||||
gen_tkt.add_argument(
|
||||
'--tokens', help='tokens, usually containing the user groups')
|
||||
|
||||
subparsers.required = True
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def subcommand_enable_mod(_):
|
||||
"""Safety check to make sure auth_pubtkt is enabled"""
|
||||
action_utils.webserver_enable('auth_pubtkt', kind='module')
|
||||
|
||||
|
||||
def subcommand_create_key_pair(_):
|
||||
"""Create public/private key pair for signing the auth_pubtkt
|
||||
tickets.
|
||||
|
||||
@ -35,4 +35,5 @@ managed_packages = ['libapache2-mod-auth-pubtkt', 'openssl', 'python3-openssl']
|
||||
def setup(helper, old_version=None):
|
||||
"""Install the required packages"""
|
||||
helper.install(managed_packages)
|
||||
actions.superuser_run('auth-pubtkt', ['enable-mod'])
|
||||
actions.superuser_run('auth-pubtkt', ['create-key-pair'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user