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

fix(jans-linux-setup): re-orginize creating smtp configuration #4457

Merged
merged 1 commit into from
Apr 5, 2023
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
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
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