mirror of
https://github.com/YunoHost-Apps/galene_ynh.git
synced 2024-09-03 18:36:31 +02:00
Protect config groups folder
This commit is contained in:
parent
ee2f0ca80c
commit
b3f1626caf
3 changed files with 13 additions and 15 deletions
|
@ -19,7 +19,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
new_path=$YNH_APP_NEW_PATH
|
new_path="/"
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
|
|
@ -67,11 +67,11 @@ ynh_script_progression --message="Finding an available port..." --weight=3
|
||||||
port=$(ynh_find_port --port=8443)
|
port=$(ynh_find_port --port=8443)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port for TURN
|
||||||
turn_port=$(ynh_find_port --port=1194)
|
turn_port=$(ynh_find_port --port=1194)
|
||||||
ynh_app_setting_set --app=$app --key=turn_port --value=$turn_port
|
ynh_app_setting_set --app=$app --key=turn_port --value=$turn_port
|
||||||
|
|
||||||
# Open the ports
|
# Open TURN port
|
||||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||||
|
|
||||||
ynh_exec_warn_less yunohost firewall allow Both $turn_port
|
ynh_exec_warn_less yunohost firewall allow Both $turn_port
|
||||||
|
@ -86,7 +86,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
|
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA FOLDER
|
# CREATE DATA AND GROUPS FOLDER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define app's data directory
|
# Define app's data directory
|
||||||
|
@ -94,6 +94,11 @@ data="$final_path/data"
|
||||||
# Create data folder
|
# Create data folder
|
||||||
mkdir -p "$data"
|
mkdir -p "$data"
|
||||||
|
|
||||||
|
# Define app's groups directory
|
||||||
|
groups="$final_path/groups"
|
||||||
|
# Create groups folder
|
||||||
|
mkdir -p "$groups"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A SERVER CERTIFICATE
|
# CREATE A SERVER CERTIFICATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -132,24 +137,13 @@ ynh_replace_string --match_string="__TURN_PORT__" --replace_string="$turn_port"
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE GROUPS FOLDER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Define app's groups directory
|
|
||||||
groups="$final_path/groups"
|
|
||||||
# Create groups folder
|
|
||||||
mkdir -p "$groups"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd"
|
ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd"
|
||||||
ynh_store_file_checksum --file="$final_path/data/passwd"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json"
|
ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json"
|
||||||
ynh_store_file_checksum --file="$final_path/groups/$group_name.json"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -160,6 +154,8 @@ ynh_store_file_checksum --file="$final_path/groups/$group_name.json"
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
chmod -R 755 $final_path
|
chmod -R 755 $final_path
|
||||||
|
chmod -R 600 $final_path/groups
|
||||||
|
chmod 600 $final_path/data/passwd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
|
|
@ -73,6 +73,8 @@ ynh_system_user_create --username=$app
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
chmod -R 755 $final_path
|
chmod -R 755 $final_path
|
||||||
|
chmod -R 600 $final_path/groups
|
||||||
|
chmod 600 $final_path/data/passwd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
|
Loading…
Add table
Reference in a new issue