1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yeswiki_ynh.git synced 2024-09-03 18:05:56 +02:00

More standard way to apply permissions + harden security for wakka.config.php

This commit is contained in:
Alexandre Aubin 2023-12-10 10:28:07 +01:00
parent 7573e36a79
commit 8d8cb0bdb7
4 changed files with 11 additions and 39 deletions

View file

@ -1,31 +1,3 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
loginldap_version="2021-03-01-2"
#=================================================
# PERSONAL HELPERS
#=================================================
# update directory right
# | arg: app - The application's name ; default : yeswiki
# | arg: install_dir - The path of the application's folder
# yeswiki_update_dir_rights yeswiki /var/www/yeswiki
yeswiki_update_dir_rights() {
local app="${1:-yeswiki}"
local install_dir="${2}"
chown -R $app:www-data $install_dir
chmod -R u=rwx,g=rx,o-rwx $install_dir
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -17,8 +17,8 @@ ynh_script_progression --message="Setting up source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chown -R $app:www-data $install_dir
chmod -R u=rwX,g=rX,o-rwx $install_dir
#=================================================
# PHP-FPM CONFIGURATION
@ -85,8 +85,9 @@ ynh_replace_string --match_string=");" --replace_string=" 'ldap_base' => 'ou=us
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
yeswiki_update_dir_rights $app $install_dir
chown -R $app:www-data $install_dir
chmod -R u=rwX,g=rX,o-rwx $install_dir
chmod g-rwx $install_dir/wakka.config.php
#=================================================
# END OF SCRIPT

View file

@ -17,11 +17,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
# Restore permissions on app files
yeswiki_update_dir_rights $app $install_dir
chown -R $app:www-data $install_dir
chmod -R u=rwX,g=rX,o-rwx $install_dir
chmod g-rwx $install_dir/wakka.config.php
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION

View file

@ -85,8 +85,9 @@ fi
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
yeswiki_update_dir_rights $app $install_dir
chown -R $app:www-data $install_dir
chmod -R u=rwX,g=rX,o-rwx $install_dir
chmod g-rwx $install_dir/wakka.config.php
#=================================================
# END OF SCRIPT