1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

new permission hpb, some fixes

This commit is contained in:
Kay0u 2021-06-09 18:26:39 +02:00
parent 35e9c956f4
commit 2413cb492b
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
7 changed files with 65 additions and 16 deletions

View file

@ -30,7 +30,8 @@
"verify_peer": false, "verify_peer": false,
"verify_peer_name": false "verify_peer_name": false
} }
} },
"trusted_proxies": [ "127.0.0.1", "::1" ]
}, },
"apps": { "apps": {
"user_ldap": { "user_ldap": {

View file

@ -4,6 +4,7 @@ Description = Push daemon for Nextcloud clients
[Service] [Service]
Environment=SOCKET_PATH=/var/run/__APP__/notify-push.sock Environment=SOCKET_PATH=/var/run/__APP__/notify-push.sock
Environment=NEXTCLOUD_URL=https://__DOMAIN____PATH__ Environment=NEXTCLOUD_URL=https://__DOMAIN____PATH__
Environment=ALLOW_SELF_SIGNED=true
ExecStart=__FINAL_PATH__/apps/notify_push/bin/x86_64/notify_push __FINAL_PATH__/config/config.php ExecStart=__FINAL_PATH__/apps/notify_push/bin/x86_64/notify_push __FINAL_PATH__/config/config.php
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__

View file

@ -59,12 +59,28 @@ then
fi fi
#================================================= #=================================================
# SETUP SSOWAT # CONFIGURE NOTIFY_PUSH APP
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..."
# Temporary fix for the API permission (workaround for https://github.com/YunoHost/issues/issues/2294 ) if [ $enable_notify_push -eq 1 ]
ynh_permission_url --permission="api" --url="re:$new_domain\/.well-known\/.*" --auth_header="false" --clear_urls then
domain="$new_domain"
path_url="$new_path"
exec_occ config:app:set notify_push base_endpoint --value https://$domain$path_url/push
ynh_add_systemd_config --service="${app}-notify-push"
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -239,13 +239,12 @@ ynh_multimedia_addaccess $app
if [ $enable_notify_push -eq 1 ] if [ $enable_notify_push -eq 1 ]
then then
exec_occ app:install notify_push exec_occ app:install notify_push
exec_occ config:app:set notify_push base_endpoint --value https://$domain$path_url/push
mkdir -p /var/run/$app/ mkdir -p /var/run/$app/
chown $app: /var/run/$app/ chown $app: /var/run/$app/
ynh_add_systemd_config --service="${app}-notify-push" ynh_add_systemd_config --service="${app}-notify-push"
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
fi fi
#================================================= #=================================================
@ -264,6 +263,10 @@ find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
chmod 640 "$install_dir/config/config.php" chmod 640 "$install_dir/config/config.php"
chmod 755 /home/yunohost.app chmod 755 /home/yunohost.app
chmod 750 $install_dir chmod 750 $install_dir
if [ $enable_notify_push -eq 1 ]
then
chmod 740 $final_path/apps/notify_push/bin/x86_64/notify_push
fi
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -282,13 +285,26 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=8
ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
#================================================= #=================================================
# CHECK IF NOTIFY_PUSH WORKS # CONFIGURE NOTIFY_PUSH APP
#================================================= #=================================================
if [ $use_notify_push -eq 1 ] if [ $use_notify_push -eq 1 ]
then then
if ! ynh_exec_as "$app" nextcloud php7.3 $final_path/occ notify_push:self-test; then ynh_permission_create --permission="hpb" --label="High Performance Backend" --url="/push" --additional_urls="/index.php/apps/notify_push/" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
ynh_print_warn --message="High Performance Backend is not working correctly, try to repair it or contact YNH support." fi
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# CHECK IF NOTIFY_PUSH WORKS
#=================================================
if [ $enable_notify_push -eq 1 ]
then
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
if ! exec_occ notify_push:self-test; then
ynh_print_warn --message="The High Performance Backend service is still not working properly. Please log in with a user to your NextCloud instance, restart the High Performance Backend service with \"systemctl restart $app-notify-push.service\", and run \"sudo -u $app php${phpversion} $final_path/occ notify_push:self-test\" to verify that everything is green."
fi fi
fi fi

View file

@ -24,7 +24,7 @@ ynh_remove_fail2ban_config
# Remove notify push # Remove notify push
ynh_remove_systemd_config --service="${app}-notify-push" ynh_remove_systemd_config --service="${app}-notify-push"
ynh_secure_remove --file="/var/run/$app/" ynh_secure_remove --file="/var/run/$app"
# Remove a cron file # Remove a cron file
# TODO: Ensure that cron job is not running (How !?) # TODO: Ensure that cron job is not running (How !?)

View file

@ -78,7 +78,7 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory
# RESTORE THE NOTIFY_PUSH APP # RESTORE THE NOTIFY_PUSH APP
#================================================= #=================================================
if [ $use_notify_push -eq 1 ] if [ $enable_notify_push -eq 1 ]
then then
mkdir -p /var/run/$app/ mkdir -p /var/run/$app/
chown $app: /var/run/$app/ chown $app: /var/run/$app/
@ -153,8 +153,10 @@ ynh_systemd_action --service_name=nginx --action=reload
if [ $enable_notify_push -eq 1 ] if [ $enable_notify_push -eq 1 ]
then then
if ! ynh_exec_as "$app" nextcloud php7.3 $final_path/occ notify_push:self-test; then ynh_systemd_action --service_name="${app}-notify-push" --action=restart
ynh_print_warn --message="High Performance Backend is not working correctly, try to repair it or contact YNH support."
if ! exec_occ notify_push:self-test; then
ynh_print_warn --message="The High Performance Backend service is still not working properly. Please log in with a user to your NextCloud instance, restart the High Performance Backend service with \"systemctl restart $app-notify-push.service\", and run \"sudo -u $app php${phpversion} $final_path/occ notify_push:self-test\" to verify that everything is green."
fi fi
fi fi

View file

@ -320,6 +320,11 @@ chmod 640 "$install_dir/config/config.php"
chmod 755 /home/yunohost.app chmod 755 /home/yunohost.app
chmod 750 $install_dir chmod 750 $install_dir
if [ $enable_notify_push -eq 1 ]
then
chmod 740 $final_path/apps/notify_push/bin/x86_64/notify_push
fi
#================================================= #=================================================
# REGEN SYSTEM CONFIGURATIONS # REGEN SYSTEM CONFIGURATIONS
#================================================= #=================================================
@ -355,6 +360,12 @@ fi
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
if [ $enable_notify_push -eq 1 ]
then
ynh_add_nginx_config "${app}-notify-push"
fi
#================================================= #=================================================
# CRON JOB # CRON JOB
#================================================= #=================================================
@ -407,8 +418,10 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*
if [ $use_notify_push -eq 1 ] if [ $use_notify_push -eq 1 ]
then then
if ! ynh_exec_as "$app" nextcloud php7.3 $final_path/occ notify_push:self-test; then ynh_systemd_action --service_name="${app}-notify-push" --action=restart
ynh_print_warn --message="High Performance Backend is not working correctly, try to repair it or contact YNH support."
if ! exec_occ notify_push:self-test; then
ynh_print_warn --message="The High Performance Backend service is still not working properly. Please log in with a user to your NextCloud instance, restart the High Performance Backend service with \"systemctl restart $app-notify-push.service\", and run \"sudo -u $app php${phpversion} $final_path/occ notify_push:self-test\" to verify that everything is green."
fi fi
fi fi