Skip to content

Commit

Permalink
fix(jans-linux-setup): re-orginize creating smtp configuration (#4457)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed Apr 5, 2023
1 parent 60775c0 commit 5b543cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 1 addition & 3 deletions jans-linux-setup/jans_setup/jans_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,13 @@ def do_installation():
if not Config.installed_instance:
jansInstaller.configureSystem()
jansInstaller.make_salt()
jansAuthInstaller.make_salt()

if not base.snap:
jreInstaller.start_installation()
jettyInstaller.start_installation()
jythonInstaller.start_installation()

jansInstaller.generate_configuration()

jansInstaller.generate_smtp_config()
jansInstaller.copy_scripts()
jansInstaller.encode_passwords()

Expand Down
20 changes: 10 additions & 10 deletions jans-linux-setup/jans_setup/setup_app/installers/jans.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ def initialize(self):
self.logIt("Key generator path was determined as {}".format(Config.non_setup_properties['key_export_path']))

self.extract_scripts()

self.make_salt()

if not Config.get('smtp_jks_pass'):
Config.smtp_jks_pass = self.getPW()
try:
Config.smtp_jks_pass_enc = self.obscure(Config.smtp_jks_pass)
except Exception as e:
self.logIt("JansInstaller. __init__ failed. Reason: %s" % str(e), errorLog=True)

def configureSystem(self):
self.logIt("Configuring system", 'jans')
Expand Down Expand Up @@ -577,9 +568,18 @@ def enable_scripts(self, inums, enable=True):
def extract_scripts(self):
base.extract_from_zip(base.current_app.jans_zip, 'docs/script-catalog', Config.script_catalog_dir)

def generate_configuration(self):

def generate_smtp_config(self):
self.logIt("Generating smtp keys", pbar=self.service_name)

if not Config.get('smtp_jks_pass'):
Config.smtp_jks_pass = self.getPW()
try:
Config.smtp_jks_pass_enc = self.obscure(Config.smtp_jks_pass)
except Exception as e:
self.logIt("JansInstaller. __init__ failed. Reason: %s" % str(e), errorLog=True)


cmd_cert_gen = [Config.cmd_keytool, '-genkeypair',
'-alias', Config.smtp_alias,
'-keyalg', 'ec',
Expand Down
5 changes: 2 additions & 3 deletions jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self):

def install(self):
self.logIt("Copying auth.war into jetty webapps folder...")

self.make_pairwise_calculation_salt()
self.installJettyService(self.jetty_app_configuration[self.service_name], True)
self.copyFile(self.source_files[0][0], self.jetty_service_webapps)
self.external_libs()
Expand All @@ -79,7 +79,6 @@ def generate_configuration(self):
if Config.get('use_external_key'):
self.import_openbanking_key()


def get_config_api_scopes(self):
scopes_def = base.current_app.ConfigApiInstaller.get_scope_defs()
scope_list = []
Expand Down Expand Up @@ -153,7 +152,7 @@ def genRandomString(self, N):
+ string.ascii_uppercase
+ string.digits) for _ in range(N))

def make_salt(self, enforce=False):
def make_pairwise_calculation_salt(self, enforce=False):
if not Config.get('pairwiseCalculationKey') or enforce:
Config.pairwiseCalculationKey = self.genRandomString(random.randint(20,30))
if not Config.get('pairwiseCalculationSalt') or enforce:
Expand Down

0 comments on commit 5b543cd

Please sign in to comment.