From 6fa519f35d1570665f47b0e1faf6a6cd87b5d8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Mar 2023 23:20:32 +0100 Subject: [PATCH] Password generator (#109) * fix * Update install * Update install * Update install * Update install * Update manifest.toml * Update install * Update manifest.toml * fix * Update install * fix * fix --- conf/config.json | 2 +- conf/groupname.json | 2 +- conf/systemd.service | 2 +- scripts/install | 17 +++++++---------- scripts/upgrade | 12 ++++++++---- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/conf/config.json b/conf/config.json index 1a49c26..0d1b371 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,4 +1,4 @@ { "canonicalHost": "__DOMAIN__", - "admin":[{"username":"__ADMIN__","password":"__PASSWORD__"}] + "admin":[{"username":"__ADMIN__", "password":__PASSWORD_HASH__}] } diff --git a/conf/groupname.json b/conf/groupname.json index eff91e8..cef3c09 100644 --- a/conf/groupname.json +++ b/conf/groupname.json @@ -1,5 +1,5 @@ { - "op": [{"username": "__ADMIN__", "password": "__PASSWORD__"}], + "op": [{"username": "__ADMIN__", "password": __PASSWORD_HASH__}], "presenter": [{}], "description": "__GROUP_DESCRIPTION__", "public": true, diff --git a/conf/systemd.service b/conf/systemd.service index aa4af39..8207fb1 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Galène: Videoconferencing server +Description=Galène: videoconferencing server Documentation=https://galene.org After=network.target diff --git a/scripts/install b/scripts/install index 305c4e6..7463851 100755 --- a/scripts/install +++ b/scripts/install @@ -14,17 +14,7 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#group_name=$YNH_APP_ARG_GROUP_NAME -#group_description=$YNH_APP_ARG_GROUP_DESCRIPTION password=$YNH_APP_ARG_PASSWORD - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." --weight=4 - -#ynh_app_setting_set --app=$app --key=group_name --value="$group_name" -#ynh_app_setting_set --app=$app --key=group_description --value="$group_description" ynh_app_setting_set --app=$app --key=password --value="$password" #================================================= @@ -71,6 +61,9 @@ ynh_script_progression --message="Building app..." --weight=1 ynh_exec_warn_less ynh_install_go --go_version=$go_version ynh_use_go +pushd $install_dir/build/galene-password-generator/ + ynh_exec_warn_less ynh_exec_as $app CGO_ENABLED=0 $ynh_go build -o $install_dir/ +popd pushd $install_dir/build/ ynh_exec_warn_less ynh_exec_as $app CGO_ENABLED=0 $ynh_go build -ldflags='-s -w' -o $install_dir/live/ popd @@ -84,6 +77,8 @@ ynh_secure_remove --file="$install_dir/.cache/" ynh_secure_remove --file="$install_dir/go/" ynh_secure_remove --file="$install_dir/.go-version" +chmod +x "$install_dir/galene-password-generator" + #================================================= # CREATE DATA DIRECTORY #================================================= @@ -100,6 +95,8 @@ chown -R $app:www-data "$data_dir" #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 +password_hash=$(echo $($install_dir/galene-password-generator $password)) + # Configure Galène ynh_add_config --template="../conf/config.json" --destination="$install_dir/live/data/config.json" chmod 400 "$install_dir/live/data/config.json" diff --git a/scripts/upgrade b/scripts/upgrade index dee0530..f5f7a58 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,10 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 -group_name=$(ynh_app_setting_get --app=$app --key=group_name) -group_description=$(ynh_app_setting_get --app=$app --key=group_description) password=$(ynh_app_setting_get --app=$app --key=password) #================================================= @@ -67,7 +64,7 @@ ynh_setup_source --dest_dir="$install_dir/build" ynh_setup_source --dest_dir="$install_dir/build_ldap" --source_id="ldap" mkdir -p "$install_dir/live/data" mkdir -p "$install_dir/live_ldap/data" -#REMOVEME? ynh_secure_remove --file="$install_dir/live/static/" +ynh_secure_remove --file="$install_dir/live/static/" cp -r "$install_dir/build/static/" "$install_dir/live/" ynh_replace_string --match_string="