1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cryptpad_ynh.git synced 2024-09-03 18:26:14 +02:00

Merge pull request #75 from YunoHost-Apps/secure-config-file

Secure config file
This commit is contained in:
Éric Gaspar 2021-03-18 18:41:43 +01:00 committed by GitHub
commit fdb09eab1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 19 deletions

View file

@ -79,7 +79,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Configuring system user..." --weight=1 ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -131,7 +131,8 @@ popd || ynh_die
#================================================= #=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1 ynh_script_progression --message="Securing files and directories..." --weight=1
chown -R $app: $final_path chown -R $app:$app $final_path
chmod 600 "$final_path/config/config.js"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
@ -146,7 +147,7 @@ yunohost service add $app --description="Zero Knowledge realtime collaborative e
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="server available" ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="server available"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT

View file

@ -49,6 +49,14 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -56,20 +64,13 @@ ynh_script_progression --message="Restoring CryptPad main directory..." --weight
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Restore permissions on app files # Restore permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
chmod 600 "$final_path/config/config.js"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES

View file

@ -71,6 +71,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -99,14 +107,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=6
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# CONFIGURE CONFIG.JS # CONFIGURE CONFIG.JS
#================================================= #=================================================
@ -140,6 +140,7 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Set permissions on app files # Set permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
chmod 600 "$final_path/config/config.js"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST