Allow https access from git in private mode

This commit is contained in:
Josué Tille 2019-02-14 09:51:19 +01:00
parent d89b9c06c5
commit 300340cfc9
No known key found for this signature in database
GPG Key ID: D5E068C6DFA8681D
3 changed files with 22 additions and 4 deletions

View File

@ -81,3 +81,21 @@ set_permission() {
chmod u=rwX,g=rX,o= "/home/$app" chmod u=rwX,g=rX,o= "/home/$app"
chmod u=rwX,g=rX,o= "/var/log/$app" chmod u=rwX,g=rX,o= "/var/log/$app"
} }
set_access_settings() {
if [ "$is_public" = '1' ]
then
ynh_app_setting_set $app unprotected_uris "/"
else
# For an access to the git server by https in private mode we need to allow the access to theses URL :
# - "DOMAIN/PATH/USER/REPOSITORY/info/refs"
# - "DOMAIN/PATH/USER/REPOSITORY/git-upload-pack"
# - "DOMAIN/PATH/USER/REPOSITORY/git-receive-pack"
excaped_domain=${domain//'.'/'%.'}
excaped_domain=${excaped_domain//'-'/'%-'}
excaped_path=${path_url//'.'/'%.'}
excaped_path=${excaped_path//'-'/'%-'}
ynh_app_setting_set $app skipped_regex "$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-receive%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-upload%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/info/refs"
fi
}

View File

@ -104,10 +104,7 @@ ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ../conf/login_source.sql
#================================================= #=================================================
# Unprotect root from SSO if public # Unprotect root from SSO if public
if [ "$is_public" = '1' ] set_access_settings
then
ynh_app_setting_set $app unprotected_uris "/"
fi
# Add gitea to YunoHost's monitored services # Add gitea to YunoHost's monitored services
yunohost service add "$app" --log "/var/log/$app/$app.log" yunohost service add "$app" --log "/var/log/$app/$app.log"

View File

@ -106,6 +106,9 @@ config_nginx
# Set permissions # Set permissions
set_permission set_permission
# Unprotect root from SSO if public
set_access_settings
# Reload services # Reload services
# ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gitea.log" # ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gitea.log"
sleep 20 sleep 20