mirror of
https://github.com/YunoHost-Apps/squid3_ynh.git
synced 2024-09-03 20:26:11 +02:00
Port fixes
This commit is contained in:
parent
c86332fa3e
commit
51678b834d
4 changed files with 28 additions and 34 deletions
|
@ -52,8 +52,8 @@ ynh_script_progression --message="Configuring firewall..."
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
### - Remove the section "CLOSE A PORT" in the remove script
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=$squid_port)
|
squid_port=$(ynh_find_port --port=$squid_port)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=squid_port --value=$squid_port
|
||||||
ynh_app_setting_set --app=$app --key=new_port --value=$new_port
|
ynh_app_setting_set --app=$app --key=new_port --value=$new_port
|
||||||
|
|
||||||
# Optional: Expose this port publicly
|
# Optional: Expose this port publicly
|
||||||
|
@ -61,7 +61,7 @@ ynh_app_setting_set --app=$app --key=new_port --value=$new_port
|
||||||
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
||||||
|
|
||||||
# Open the port
|
# Open the port
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $squid_port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
@ -98,7 +98,7 @@ else
|
||||||
ynh_die "No squid folder found in /etc. Looks like squid 3 package is not installed. Try installing it manually by apt-get install squid3"
|
ynh_die "No squid folder found in /etc. Looks like squid 3 package is not installed. Try installing it manually by apt-get install squid3"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/squid.conf"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$squid_port" --target_file="../conf/squid.conf"
|
||||||
ynh_replace_string --match_string="__SQUID__" --replace_string="$squid" --target_file="../conf/squid.conf"
|
ynh_replace_string --match_string="__SQUID__" --replace_string="$squid" --target_file="../conf/squid.conf"
|
||||||
cp -f "../conf/squid.conf" "/etc/$squid/."
|
cp -f "../conf/squid.conf" "/etc/$squid/."
|
||||||
# Save squid folder in app settings
|
# Save squid folder in app settings
|
||||||
|
@ -167,7 +167,7 @@ ynh_script_progression --message="Starting a systemd service..."
|
||||||
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$squid --action="restart" --log_path="/var/log/$squid/access.log"
|
ynh_systemd_action --service_name=$squid --action="restart" --log_path="/var/log/$squid/cache.log"
|
||||||
|
|
||||||
yunohost app ssowatconf
|
yunohost app ssowatconf
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ Enter these value in the below feilds.
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
| Http proxy: Your any registered domain name or ip eg domain.tld
|
| Http proxy: Your any registered domain name or ip eg domain.tld
|
||||||
|
|
|
|
||||||
|port: $port
|
|port: $squid_port
|
||||||
|
|
|
|
||||||
|Tick mark use this proxy server for all protocols
|
|Tick mark use this proxy server for all protocols
|
||||||
|
|
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
port=$(ynh_app_setting_get $app port)
|
squid_port=$(ynh_app_setting_get $app squid_port)
|
||||||
squid=$(ynh_app_setting_get $app squid_folder)
|
squid=$(ynh_app_setting_get $app squid_folder)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,10 +42,10 @@ ynh_remove_app_dependencies
|
||||||
# CLOSE A PORT
|
# CLOSE A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $squid_port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $port..."
|
ynh_script_progression --message="Closing port $squid_port..."
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
ynh_exec_warn_less yunohost firewall disallow TCP $squid_port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,7 +26,7 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
port=$(ynh_app_setting_get $app port)
|
squid_port=$(ynh_app_setting_get $app squid_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -46,9 +46,9 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=$squid_port)
|
squid_port=$(ynh_find_port --port=$squid_port)
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $squid_port
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=squid_port --value=$squid_port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
|
@ -70,7 +70,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save squid folder
|
# Save squid folder
|
||||||
ynh_app_setting_set $app squid_folder $squid
|
ynh_app_setting_set --app=$app --key=squid_folder --value=$squid
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE INOTIFY'S CONFIG
|
# RESTORE INOTIFY'S CONFIG
|
||||||
|
@ -83,7 +83,7 @@ yunohost app ssowatconf
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
yunohost service add squid3 --log "/var/log/$squid/access.log"
|
yunohost service add squid3 --log "/var/log/$squid/cache.log"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -99,7 +99,7 @@ Enter these value in the below feilds.
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
| Http proxy: Your any registered domain name or ip eg domain.tld
|
| Http proxy: Your any registered domain name or ip eg domain.tld
|
||||||
|
|
|
|
||||||
|port: $port
|
|port: $squid_port
|
||||||
|
|
|
|
||||||
|Tick mark use this proxy server for all protocols
|
|Tick mark use this proxy server for all protocols
|
||||||
|
|
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
port=$(ynh_app_setting_get $app port)
|
squid_port=$(ynh_app_setting_get $app squid_port)
|
||||||
new_port=$(ynh_app_setting_get $app new_port)
|
new_port=$(ynh_app_setting_get $app new_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -37,7 +37,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." -
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
@ -46,27 +46,21 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# If #new_port is not defined test the $port and keep it open
|
# If #new_port is not defined test the $port and keep it open
|
||||||
if [ -z $new_port ] then
|
if [ -z $new_port ] then
|
||||||
# Optional: Expose this port publicly
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $squid_port
|
||||||
# (N.B. : you only need to do this if the app actually needs to expose the port publicly.
|
ynh_app_setting_set --app=$app --key=port --value=$squid_port
|
||||||
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
|
||||||
|
|
||||||
# Find an available port
|
|
||||||
port=$(ynh_find_port --port=$squid_port)
|
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
|
||||||
# If $new_port is define close the $port and open the $new_port
|
# If $new_port is define close the $port and open the $new_port
|
||||||
else
|
else
|
||||||
#Close $port
|
#Close $port
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $squid_port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $port..."
|
ynh_script_progression --message="Closing port $squid_port..."
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
ynh_exec_warn_less yunohost firewall disallow TCP $squid_port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Open $new_port
|
# Open $new_port
|
||||||
port=$(ynh_find_port --port=$squid_new_port)
|
port=$(ynh_find_port --port=$squid_new_port)
|
||||||
#Add the value of $new_port to $port
|
#Add the value of $new_port to $port
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=squid_port --value=$squid_port
|
||||||
#Remove the value of $new_port
|
#Remove the value of $new_port
|
||||||
ynh_app_setting_set --app=$app --key=new_port --value=""
|
ynh_app_setting_set --app=$app --key=new_port --value=""
|
||||||
fi
|
fi
|
||||||
|
@ -96,7 +90,7 @@ fi
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
ynh_backup_if_checksum_is_different --file="/etc/$squid/squid.conf"
|
ynh_backup_if_checksum_is_different --file="/etc/$squid/squid.conf"
|
||||||
|
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/squid.conf"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$squid_port" --target_file="../conf/squid.conf"
|
||||||
ynh_replace_string --match_string="__SQUID__" --replace_string="$squid" --target_file="../conf/squid.conf"
|
ynh_replace_string --match_string="__SQUID__" --replace_string="$squid" --target_file="../conf/squid.conf"
|
||||||
cp -f "../conf/squid.conf" "/etc/$squid/."
|
cp -f "../conf/squid.conf" "/etc/$squid/."
|
||||||
# Save squid folder
|
# Save squid folder
|
||||||
|
@ -119,7 +113,7 @@ ynh_store_file_checksum --file="/etc/$squid/squid.conf"
|
||||||
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
||||||
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
||||||
|
|
||||||
yunohost service add squid3 --log "/var/log/$squid/access.log"
|
yunohost service add squid3 --log "/var/log/$squid/cache.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART SQUID'S SERVICE and SSOWATCONF
|
# RESTART SQUID'S SERVICE and SSOWATCONF
|
||||||
|
@ -141,7 +135,7 @@ Enter these value in the below feilds.
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
| Http proxy: Your any registered domain name or ip eg domain.tld
|
| Http proxy: Your any registered domain name or ip eg domain.tld
|
||||||
|
|
|
|
||||||
|port: $port
|
|port: $squid_port
|
||||||
|
|
|
|
||||||
|Tick mark use this proxy server for all protocols
|
|Tick mark use this proxy server for all protocols
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue