Skip to content

Commit

Permalink
fix: vm setup suse fixes (#705)
Browse files Browse the repository at this point in the history
* fix: suse fixes

* refactor(admin-ui): remove admin-ui (ref: #691)

* fix: remove cb and spanner backend options for package

* refactor(ce-setup): ce-setup exclude jwt from config-cli

(cherry picked from commit 2f69a8a)
  • Loading branch information
devrimyatar authored and moabu committed Jan 26, 2022
1 parent e9d44c3 commit ca87028
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 173 deletions.
23 changes: 10 additions & 13 deletions jans-linux-setup/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
"JYTHON_VERSION": "2.7.3",
"OPENDJ_VERSION": "4.4.12",
"SETUP_BRANCH": "main",
"ADMIN_UI_FRONTEND_BRANCH": "main",
"NODE_VERSION": "v14.18.2"
}

jans_dir = '/opt/jans'
Expand All @@ -50,6 +48,7 @@
parser.add_argument('--jans-app-version', help="Version for Jannses applications")
parser.add_argument('--jans-build', help="Buid version for Janssen applications")
parser.add_argument('--setup-branch', help="Jannsen setup github branch")
parser.add_argument('--no-setup', help="Do not launch setup", action='store_true')

if '-a' in sys.argv:
parser.add_argument('--jetty-version', help="Jetty verison. For example 11.0.6")
Expand Down Expand Up @@ -99,7 +98,7 @@
print("Can't continue...")
sys.exit()

os.system('{} install -y {}'.format(package_installer, ' '.join(package_dependencies)))
os.system('{} install -y {}'.format(package_installer, ' '.join(package_dependencies)))


def extract_subdir(zip_fn, sub_dir, target_dir, zipf=None):
Expand Down Expand Up @@ -221,17 +220,15 @@ def download_gcs():
download('https://corretto.aws/downloads/resources/{0}/amazon-corretto-{0}-linux-x64.tar.gz'.format(app_versions['AMAZON_CORRETTO_VERSION']), os.path.join(app_dir, 'amazon-corretto-{0}-linux-x64.tar.gz'.format(app_versions['AMAZON_CORRETTO_VERSION'])))
download('https://repo1.maven.org/maven2/org/eclipse/jetty/{1}/{0}/{1}-{0}.tar.gz'.format(app_versions['JETTY_VERSION'], jetty_dist_string), os.path.join(app_dir,'{1}-{0}.tar.gz'.format(app_versions['JETTY_VERSION'], jetty_dist_string)))
download('https://maven.gluu.org/maven/org/gluufederation/jython-installer/{0}/jython-installer-{0}.jar'.format(app_versions['JYTHON_VERSION']), os.path.join(app_dir, 'jython-installer-{0}.jar'.format(app_versions['JYTHON_VERSION'])))
download('https://nodejs.org/dist/{0}/node-{0}-linux-x64.tar.xz'.format(app_versions['NODE_VERSION']), os.path.join(app_dir, 'node-{0}-linux-x64.tar.xz'.format(app_versions['NODE_VERSION'])))
download(urljoin(maven_base_url, 'jans-auth-server/{0}{1}/jans-auth-server-{0}{1}.war'.format(app_versions['JANS_APP_VERSION'], app_versions['JANS_BUILD'])), os.path.join(jans_app_dir, 'jans-auth.war'))
download(urljoin(maven_base_url, 'jans-auth-client/{0}{1}/jans-auth-client-{0}{1}-jar-with-dependencies.jar'.format(app_versions['JANS_APP_VERSION'], app_versions['JANS_BUILD'])), os.path.join(jans_app_dir, 'jans-auth-client-jar-with-dependencies.jar'))
download(urljoin(maven_base_url, 'jans-config-api-server/{0}{1}/jans-config-api-server-{0}{1}.war'.format(app_versions['JANS_APP_VERSION'], app_versions['JANS_BUILD'])), os.path.join(jans_app_dir, 'jans-config-api.war'))
download('https://github.com/sqlalchemy/sqlalchemy/archive/rel_1_3_23.zip', sqlalchemy_zip_file)
download(urljoin(maven_base_url, 'scim-plugin/{0}{1}/scim-plugin-{0}{1}-distribution.jar'.format(app_versions['JANS_APP_VERSION'], app_versions['JANS_BUILD'])), os.path.join(jans_app_dir, 'scim-plugin.jar'))
download('https://ox.gluu.org/icrby8xcvbcv/cli-swagger/jca.tgz', os.path.join(jans_app_dir, 'jca-swagger-client.tgz'))
download('https://ox.gluu.org/icrby8xcvbcv/cli-swagger/scim.tgz', os.path.join(jans_app_dir, 'scim-swagger-client.tgz'))
download(urljoin(maven_base_url, 'admin-ui-plugin/{0}{1}/admin-ui-plugin-{0}{1}-distribution.jar'.format(app_versions['JANS_APP_VERSION'], app_versions['JANS_BUILD'])), os.path.join(jans_app_dir, 'admin-ui-plugin-distribution.jar'))
download('https://github.com/GluuFederation/gluu-admin-ui/archive/refs/heads/{}.zip'.format(app_versions['ADMIN_UI_FRONTEND_BRANCH']), os.path.join(jans_app_dir, 'gluu-admin-ui.zip'))
download('https://raw.githubusercontent.com/GluuFederation/gluu-snap/master/facter/facter', os.path.join(jans_app_dir, 'facter'))
download('https://github.com/jpadilla/pyjwt/archive/refs/tags/2.3.0.zip', os.path.join(app_dir, 'pyjwt.zip'))

if argsp.profile == 'jans':
download('https://maven.gluu.org/maven/org/gluufederation/opendj/opendj-server-legacy/{0}/opendj-server-legacy-{0}.zip'.format(app_versions['OPENDJ_VERSION']), os.path.join(app_dir, 'opendj-server-legacy-{0}.zip'.format(app_versions['OPENDJ_VERSION'])))
Expand Down Expand Up @@ -348,7 +345,7 @@ def profile_setup():
print("Stopping OpenDj Server")
os.system('/opt/opendj/bin/stop-ds')

remove_list = ['/etc/certs', '/etc/jans', '/opt/jans', '/opt/amazon-corretto*', '/opt/node*', '/opt/jre', '/opt/jetty*', '/opt/jython*']
remove_list = ['/etc/certs', '/etc/jans', '/opt/jans', '/opt/amazon-corretto*', '/opt/jre', '/opt/jetty*', '/opt/jython*']
if argsp.profile == 'jans':
remove_list.append('/opt/opendj')
if not argsp.keep_downloads:
Expand Down Expand Up @@ -377,16 +374,16 @@ def profile_setup():
profile_setup()

extract_file(jans_zip_file, 'jans-config-api/server/src/main/resources/log4j2.xml', jans_app_dir)
extract_file(jans_zip_file, 'jans-config-api/plugins/admin-ui-plugin/config/log4j2-adminui.xml', jans_app_dir)

print("Preparing jans-cli package")
extract_subdir(jans_zip_file, 'jans-cli', 'jans-cli', os.path.join(jans_app_dir, 'jans-cli.zip'))

print("Launching Janssen Setup")
if not argsp.no_setup:
print("Launching Janssen Setup")

setup_cmd = 'python3 {}/setup.py'.format(setup_dir)
setup_cmd = 'python3 {}/setup.py'.format(setup_dir)

if argsp.args:
setup_cmd += ' ' + argsp.args
if argsp.args:
setup_cmd += ' ' + argsp.args

os.system(setup_cmd)
os.system(setup_cmd)
4 changes: 0 additions & 4 deletions jans-linux-setup/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
from setup_app.installers.jre import JreInstaller
from setup_app.installers.jetty import JettyInstaller
from setup_app.installers.jython import JythonInstaller
from setup_app.installers.node import NodeInstaller
from setup_app.installers.jans_auth import JansAuthInstaller

if Config.profile == 'jans':
Expand Down Expand Up @@ -156,7 +155,6 @@
jreInstaller = JreInstaller()
jettyInstaller = JettyInstaller()
jythonInstaller = JythonInstaller()
nodeInstaller = NodeInstaller()

if Config.profile == 'jans':
openDjInstaller = OpenDjInstaller()
Expand Down Expand Up @@ -270,8 +268,6 @@ def do_installation():
jreInstaller.start_installation()
jettyInstaller.start_installation()
jythonInstaller.start_installation()
if Config.installAdminUI:
nodeInstaller.start_installation()

jansInstaller.copy_scripts()
jansInstaller.encode_passwords()
Expand Down
3 changes: 0 additions & 3 deletions jans-linux-setup/setup_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Config:
etc_hostname = '/etc/hostname'
osDefault = '/etc/default'
sysemProfile = '/etc/profile'
node_home = '/opt/node'
jython_home = '/opt/jython'
ldapBaseFolder = '/opt/opendj'
network = '/etc/sysconfig/network'
Expand Down Expand Up @@ -171,7 +170,6 @@ def progress(self, service_name, msg, incr=False):
self.installJans = True
self.installJre = True
self.installJetty = True
self.installNode = False
self.installJython = True
self.installOxAuth = True
self.installOxTrust = True
Expand All @@ -189,7 +187,6 @@ def progress(self, service_name, msg, incr=False):
self.installJansCli = False
self.loadTestData = False
self.allowPreReleasedFeatures = False
self.installAdminUI = False

# backward compatibility
self.os_type = base.os_type
Expand Down
41 changes: 1 addition & 40 deletions jans-linux-setup/setup_app/installers/config_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,15 @@ def __init__(self):
self.load_ldif_files = [self.config_ldif_fn, self.scope_ldif_fn]
self.libDir = os.path.join(self.jetty_base, self.service_name, 'custom/libs/')
self.custom_config_dir = os.path.join(self.jetty_base, self.service_name, 'custom/config')
self.admin_ui_config_properties = os.path.join(self.output_folder, 'auiConfiguration.properties')

self.source_files = [
(os.path.join(Config.distJansFolder, 'jans-config-api.war'), 'https://maven.jans.io/maven/io/jans/jans-config-api-server/{0}/jans-config-api-server-{0}.war'.format(Config.oxVersion)),
(os.path.join(Config.distJansFolder, 'scim-plugin.jar'), 'https://maven.jans.io/maven/io/jans/scim-plugin/{0}/scim-plugin-{0}-distribution.jar'.format(Config.oxVersion)),
(os.path.join(Config.distJansFolder, 'admin-ui-plugin-distribution.jar'), 'https://maven.jans.io/maven/io/jans/admin-ui-plugin/{0}/admin-ui-plugin-{0}-distribution.jar'.format(Config.oxVersion)),
(os.path.join(Config.distJansFolder, 'log4j2.xml'), 'https://raw.githubusercontent.com/JanssenProject/jans-config-api/master/server/src/main/resources/log4j2.xml'),
(os.path.join(Config.distJansFolder, 'log4j2-adminui.xml'), 'https://raw.githubusercontent.com/JanssenProject/jans-config-api/master/plugins/admin-ui-plugin/config/log4j2-adminui.xml'),
(os.path.join(Config.distJansFolder, 'gluu-admin-ui.zip'), 'https://github.com/GluuFederation/gluu-admin-ui/archive/refs/heads/main.zip'),
(os.path.join(Config.distJansFolder, 'facter'), 'https://raw.githubusercontent.com/GluuFederation/gluu-snap/master/facter/facter'),
]

def install(self):
self.copyFile(self.source_files[6][0], '/usr/sbin')
self.copyFile(self.source_files[2][0], '/usr/sbin')
self.run([paths.cmd_chmod, '+x', '/usr/sbin/facter'])
self.installJettyService(self.jetty_app_configuration[self.service_name], True)
self.logIt("Copying fido.war into jetty webapps folder...")
Expand All @@ -61,8 +56,6 @@ def install(self):
self.copyFile(self.source_files[1][0], self.libDir)
scim_plugin_path = os.path.join(self.libDir, os.path.basename(self.source_files[1][0]))
self.add_extra_class(scim_plugin_path)
if Config.installAdminUI:
self.install_admin_ui_frontend()
self.enable()

def installed(self):
Expand Down Expand Up @@ -244,35 +237,3 @@ def load_test_data(self):
self.writeFile(out_fn, rendered_text)
self.dbUtils.import_ldif([out_fn])

def service_post_setup(self):
if Config.installAdminUI:
self.logIt("Installing Jans Admin UI", pbar=self.service_name)
self.check_clients([('role_based_client_id', '2000.')])
self.renderTemplateInOut(self.admin_ui_config_properties, self.templates_folder, self.output_folder)
self.copyFile(self.source_files[2][0], self.libDir)
admin_ui_plugin_path = os.path.join(self.libDir, os.path.basename(self.source_files[2][0]))
self.add_extra_class(admin_ui_plugin_path)
self.copyFile(self.admin_ui_config_properties, self.custom_config_dir)

for logfn in (self.source_files[3][0], self.source_files[4][0]):
self.copyFile(logfn, self.custom_config_dir)


def install_admin_ui_frontend(self):
self.logIt("Installing Jans Admin UI Frontend", pbar=self.service_name)
package_zip = zipfile.ZipFile(self.source_files[5][0], "r")
package_par_dir = package_zip.namelist()[0]
source_dir = os.path.join(Config.outputFolder, package_par_dir)
package_zip.extractall(Config.outputFolder)

self.renderTemplateInOut(os.path.join(source_dir, '.env.tmp'), source_dir, source_dir)
self.copyFile(os.path.join(source_dir, '.env.tmp'), os.path.join(source_dir, '.env'))
self.run([paths.cmd_chown, '-R', 'node:node', source_dir])
cmd_path = 'PATH=$PATH:{}/bin:{}/bin'.format(Config.jre_home, Config.node_home)

for cmd in ('npm install @openapitools/openapi-generator-cli', 'npm run api', 'npm install', 'npm run plugin:clean', 'npm run build:prod'):
self.logIt("Executing `{}`".format(cmd), pbar=self.service_name)
run_cmd = '{} {}'.format(cmd_path, cmd)
self.run(['/bin/su', 'node','-c', run_cmd], source_dir)

self.copyTree(os.path.join(source_dir, 'dist'), '/var/www/html/admin')
14 changes: 7 additions & 7 deletions jans-linux-setup/setup_app/installers/httpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def __init__(self):
self.apache2_ssl_24_conf = os.path.join(self.output_folder, 'https_jans.conf')

if base.os_type == 'suse':
self.https_gluu_fn = '/etc/apache2/vhosts.d/_https_gluu.conf'
self.https_jans_fn = '/etc/apache2/vhosts.d/_https_gluu.conf'
elif base.clone_type == 'rpm':
self.https_gluu_fn = '/etc/httpd/conf.d/https_gluu.conf'
self.https_jans_fn = '/etc/httpd/conf.d/https_gluu.conf'
else:
self.https_gluu_fn = '/etc/apache2/sites-available/https_gluu.conf'
self.https_jans_fn = '/etc/apache2/sites-available/https_gluu.conf'


def configure(self):
Expand Down Expand Up @@ -180,15 +180,15 @@ def write_httpd_config(self):
self.copyFile(self.apache2_ssl_24_conf, '/etc/httpd/conf.d/https_gluu.conf')

if base.os_type == 'suse':
self.copyFile(self.apache2_ssl_conf, self.https_gluu_fn)
self.copyFile(self.apache2_ssl_conf, self.https_jans_fn)

elif base.clone_type == 'rpm' and base.os_initdaemon == 'init':
self.copyFile(self.apache2_conf, '/etc/httpd/conf/httpd.conf')
self.copyFile(self.apache2_ssl_conf, self.https_gluu_fn)
self.copyFile(self.apache2_ssl_conf, self.https_jans_fn)

elif base.clone_type == 'deb':
self.copyFile(self.apache2_ssl_conf, self.https_gluu_fn)
self.run([paths.cmd_ln, '-s', self.https_gluu_fn,
self.copyFile(self.apache2_ssl_conf, self.https_jans_fn)
self.run([paths.cmd_ln, '-s', self.https_jans_fn,
'/etc/apache2/sites-enabled/https_gluu.conf'])

def installed(self):
Expand Down
2 changes: 0 additions & 2 deletions jans-linux-setup/setup_app/installers/jans.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ def __repr__(self):


txt += 'Install Apache 2 web server'.ljust(30) + repr(Config.installHttpd).rjust(35) + (' *' if 'installHttpd' in Config.addPostSetupService else '') + "\n"
txt += 'Install Node'.ljust(30) + repr(Config.installAdminUI).rjust(35) + "\n"
txt += 'Install Auth Server'.ljust(30) + repr(Config.installOxAuth).rjust(35) + "\n"
txt += 'Install Jans Auth Config Api'.ljust(30) + repr(Config.installConfigApi).rjust(35) + "\n"
txt += 'Install Jans Admin UI'.ljust(30) + repr(Config.installAdminUI).rjust(35) + "\n"
if Config.profile == 'jans':
txt += 'Install Fido2 Server'.ljust(30) + repr(Config.installFido2).rjust(35) + (' *' if 'installFido2' in Config.addPostSetupService else '') + "\n"
txt += 'Install Scim Server'.ljust(30) + repr(Config.installScimServer).rjust(35) + (' *' if 'installScimServer' in Config.addPostSetupService else '') + "\n"
Expand Down
5 changes: 5 additions & 0 deletions jans-linux-setup/setup_app/installers/jans_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self):
(os.path.join(Config.distJansFolder, 'jans-cli.zip'), 'https://api.github.com/repos/JanssenProject/jans-cli/tarball/main'.format(Config.oxVersion)),
(os.path.join(Config.distJansFolder, 'jca-swagger-client.tgz'), 'https://ox.gluu.org/icrby8xcvbcv/cli-swagger/jca.tgz'),
(os.path.join(Config.distJansFolder, 'scim-swagger-client.tgz'), 'https://ox.gluu.org/icrby8xcvbcv/cli-swagger/scim.tgz'),
(os.path.join(Config.distAppFolder, 'pyjwt.zip'), 'https://github.com/jpadilla/pyjwt/archive/refs/tags/2.3.0.zip'),
]

def install(self):
Expand All @@ -60,6 +61,10 @@ def install(self):
self.writeFile(init_fn, '')
shutil.unpack_archive(self.source_files[i+1][0], swagger_cli_dir)

#extract pyjwt from archieve
base.extract_from_zip(self.source_files[3][0], 'jwt', os.path.join(self.jans_cli_install_dir, 'pylib/jwt'))


def generate_configuration(self):
self.check_clients([('role_based_client_id', '2000.')])

Expand Down
61 changes: 0 additions & 61 deletions jans-linux-setup/setup_app/installers/node.py

This file was deleted.

4 changes: 3 additions & 1 deletion jans-linux-setup/setup_app/installers/rdbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def local_install(self):
packageUtils.check_and_install_packages()

if Config.rdbm_type == 'mysql':
if base.clone_type == 'rpm':
if base.os_type == 'suse':
self.restart('mysql')
elif base.clone_type == 'rpm':
self.restart('mysqld')
result, conn = self.dbUtils.mysqlconnection(log=False)
if not result:
Expand Down
3 changes: 0 additions & 3 deletions jans-linux-setup/setup_app/setup_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ def get_setup_options():
if base.argsp.ldap_admin_password:
setupOptions['ldapPass'] = base.argsp.ldap_admin_password

if base.argsp.install_admin_ui:
setupOptions['installAdminUI'] = True

if base.argsp.admin_password:
setupOptions['admin_password'] = base.argsp.admin_password
elif base.argsp.ldap_admin_password:
Expand Down
2 changes: 0 additions & 2 deletions jans-linux-setup/setup_app/utils/arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def arg_parser():

parser.add_argument('-approved-issuer', help="Api Approved Issuer")

parser.add_argument('--install-admin-ui', help="Install Gluu Admin UI", action='store_true')

argsp = parser.parse_args()

return argsp
Loading

0 comments on commit ca87028

Please sign in to comment.