Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generate passwurd keystore #916

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions setup_app/installers/gluu.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ def post_install_tasks(self):
if Config.profile == static.SetupProfiles.DISA_STIG:
self.disa_stig_post_install_tasks()

if base.argsp.gluu_passwurd_cert:
self.generate_gluu_passwurd_api_keystore()

def disa_stig_post_install_tasks(self):

self.chown(Config.gluuOptFolder, Config.jetty_user, Config.gluu_group)
Expand All @@ -474,6 +477,14 @@ def disa_stig_post_install_tasks(self):

self.chown(jetty_absolute_dir.parent.as_posix(), Config.user_group, recursive=True)


def generate_gluu_passwurd_api_keystore(self):
suffix = 'passwurd_api'
key_fn, csr_fn, crt_fn = self.gen_cert(suffix, 'changeit', user='jetty')
passwurd_api_keystore_fn = os.path.join(Config.certFolder, 'passwurdAKeystore.pcks12')
self.gen_keystore(suffix, passwurd_api_keystore_fn, 'changeit', key_fn, crt_fn, store_type='PKCS12')


def enable_scripts(self, inums):
if inums:
for inum in inums:
Expand Down
1 change: 1 addition & 0 deletions setup_app/utils/arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def arg_parser():
parser.add_argument('-enable-script', action='append', help="inum of script to enable", required=False)
parser.add_argument('-ox-authentication-mode', help="Sets oxAuthenticationMode")
parser.add_argument('-ox-trust-authentication-mode', help="Sets oxTrustAuthenticationMode")
parser.add_argument('--gluu-passwurd-cert', help="Creates Gluu Passwurd API keystore", action='store_true')

# spanner options
parser.add_argument('-spanner-project', help="Spanner project name")
Expand Down
1 change: 1 addition & 0 deletions setup_app/utils/crypto64.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def gen_cert(self, suffix, password, user='root', cn=None, truststore_fn=None):
self.delete_key(alias, truststore_fn)
self.import_cert_to_java_truststore(alias, public_certificate)

return key, csr, public_certificate

def delete_key(self, alias, truststore_fn=None):
if not truststore_fn:
Expand Down
1 change: 1 addition & 0 deletions setup_app/utils/properties_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def load_properties(self, prop_file, no_update=[]):

base.argsp.ox_authentication_mode = p.get('ox-authentication-mode')
base.argsp.ox_trust_authentication_mode = p.get('ox-trust-authentication-mode')
base.argsp.gluu_passwurd_cert = True if p.get('gluu-passwurd-cert','').lower() == 'true' else False

properties_list = list(p.keys())

Expand Down