mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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 os
|
||||||
import time
|
|
||||||
import base64
|
import base64
|
||||||
import datetime
|
import datetime
|
||||||
import argparse
|
import argparse
|
||||||
|
from plinth import action_utils
|
||||||
|
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
|
|
||||||
@ -40,18 +40,26 @@ def parse_arguments():
|
|||||||
'create-key-pair',
|
'create-key-pair',
|
||||||
help='create a key pair for the apache server '
|
help='create a key pair for the apache server '
|
||||||
'to sign auth_pubtkt tickets')
|
'to sign auth_pubtkt tickets')
|
||||||
gen_tkt = subparsers.add_parser('generate-ticket',
|
subparsers.add_parser(
|
||||||
help='generate auth_pubtkt ticket')
|
'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('--uid', help='username of the user')
|
||||||
gen_tkt.add_argument('--private-key-file',
|
gen_tkt.add_argument(
|
||||||
help='path of the private key file of the server')
|
'--private-key-file',
|
||||||
gen_tkt.add_argument('--tokens',
|
help='path of the private key file of the server')
|
||||||
help='tokens, usually containing the user groups')
|
gen_tkt.add_argument(
|
||||||
|
'--tokens', help='tokens, usually containing the user groups')
|
||||||
|
|
||||||
subparsers.required = True
|
subparsers.required = True
|
||||||
return parser.parse_args()
|
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(_):
|
def subcommand_create_key_pair(_):
|
||||||
"""Create public/private key pair for signing the auth_pubtkt
|
"""Create public/private key pair for signing the auth_pubtkt
|
||||||
tickets.
|
tickets.
|
||||||
|
|||||||
@ -35,4 +35,5 @@ managed_packages = ['libapache2-mod-auth-pubtkt', 'openssl', 'python3-openssl']
|
|||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install the required packages"""
|
"""Install the required packages"""
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
|
actions.superuser_run('auth-pubtkt', ['enable-mod'])
|
||||||
actions.superuser_run('auth-pubtkt', ['create-key-pair'])
|
actions.superuser_run('auth-pubtkt', ['create-key-pair'])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user