mirror of
https://github.com/YunoHost-Apps/squid3_ynh.git
synced 2024-09-03 20:26:11 +02:00
Ldap fix and added mailutils as dependency
This commit is contained in:
parent
881fb75e0f
commit
cf01a24824
7 changed files with 49 additions and 55 deletions
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
password="pass"
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
|
|
@ -21,7 +21,7 @@ acl purge method PURGE
|
||||||
acl CONNECT method CONNECT
|
acl CONNECT method CONNECT
|
||||||
|
|
||||||
###Directive pour n’autoriser que les comptes enregistrés dans le LDAP de Yunohost
|
###Directive pour n’autoriser que les comptes enregistrés dans le LDAP de Yunohost
|
||||||
auth_param basic program /usr/lib/squid/basic_ldap_auth -b dc=yunohost,dc=org -h 127.0.0.1 -D cn=admin,dc=yunohost,dc=org -w __ADMIN_PASS__ -f "uid=%s"
|
auth_param basic program /usr/lib/squid/basic_ldap_auth -b dc=yunohost,dc=org -h 127.0.0.1 -f "uid=%s"
|
||||||
|
|
||||||
auth_param basic children 50
|
auth_param basic children 50
|
||||||
auth_param basic realm Web-Proxy
|
auth_param basic realm Web-Proxy
|
||||||
|
@ -44,9 +44,9 @@ dns_nameservers 127.0.0.1
|
||||||
##Port d'écoute du Proxy
|
##Port d'écoute du Proxy
|
||||||
http_port __PORT__
|
http_port __PORT__
|
||||||
forwarded_for off ### mode transparant, la vrai IP est cachée
|
forwarded_for off ### mode transparant, la vrai IP est cachée
|
||||||
cache_dir aufs /var/spool/squid 10000 16 256
|
cache_dir aufs /var/spool/squid3 10000 16 256
|
||||||
hierarchy_stoplist cgi-bin ?
|
hierarchy_stoplist cgi-bin ?
|
||||||
access_log /var/log/squid/access.log squid
|
access_log /var/log/squid3/access.log squid
|
||||||
refresh_pattern ^ftp: 1440 20% 10080
|
refresh_pattern ^ftp: 1440 20% 10080
|
||||||
refresh_pattern ^gopher: 1440 0% 1440
|
refresh_pattern ^gopher: 1440 0% 1440
|
||||||
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
|
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
|
||||||
|
|
|
@ -18,18 +18,6 @@
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [],
|
"services": [],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install" : []
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"type": "password",
|
|
||||||
"ask": {
|
|
||||||
"en": "Your Yunohost admin password (The password you use for the web-admin for Yunohost) "
|
|
||||||
},
|
|
||||||
"help": {
|
|
||||||
"en": "The admin password is required to give all registered user access to Squid"
|
|
||||||
},
|
|
||||||
"example": "Choose a password"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,22 +12,47 @@ ynh_delete_file_checksum () {
|
||||||
ynh_app_setting_delete $app $checksum_setting_name
|
ynh_app_setting_delete $app $checksum_setting_name
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
# Send an email to inform the administrator
|
||||||
#
|
#
|
||||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||||
# | arg: -m --app_message= - The message to send to the administrator.
|
# | arg: app_message - The message to send to the administrator.
|
||||||
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||||
# example: "root admin@domain"
|
# example: "root admin@domain"
|
||||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||||
# example: "root admin@domain user1 user2"
|
# example: "root admin@domain user1 user2"
|
||||||
ynh_send_readme_to_admin() {
|
ynh_send_readme_to_admin() {
|
||||||
# Declare an array to define the options of this helper.
|
local app_message="${1:-...No specific information...}"
|
||||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= )
|
local recipients="${2:-root}"
|
||||||
local app_message
|
|
||||||
local recipients
|
# Retrieve the email of users
|
||||||
# Manage arguments with getopts
|
find_mails () {
|
||||||
ynh_handle_getopts_args "$@"
|
local list_mails="$1"
|
||||||
local app_message="${app_message:-...No specific information...}"
|
local mail
|
||||||
local recipients="${recipients:-root}"
|
local recipients=" "
|
||||||
|
# Read each mail in argument
|
||||||
|
for mail in $list_mails
|
||||||
|
do
|
||||||
|
# Keep root or a real email address as it is
|
||||||
|
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||||
|
then
|
||||||
|
recipients="$recipients $mail"
|
||||||
|
else
|
||||||
|
# But replace an user name without a domain after by its email
|
||||||
|
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||||
|
then
|
||||||
|
recipients="$recipients $mail"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$recipients"
|
||||||
|
}
|
||||||
|
recipients=$(find_mails "$recipients")
|
||||||
|
|
||||||
|
local mail_subject="☁️🆈🅽🅷☁️: Yunohost \`$app\` message"
|
||||||
|
|
||||||
|
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||||
|
Specific information for the application $app.
|
||||||
|
$app_message
|
||||||
|
---
|
||||||
|
Automatic diagnosis data from YunoHost
|
||||||
|
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
|
|
|
@ -24,28 +24,8 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
admin_pass_yuno=$YNH_APP_ARG_PASSWORD
|
|
||||||
|
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
|
||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
||||||
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
||||||
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
||||||
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
||||||
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
||||||
### The app instance name is probably what interests you most, since this is
|
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
||||||
### db names, ...
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,7 +54,7 @@ ynh_app_setting_set $app port $port
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
ynh_install_app_dependencies squid3
|
ynh_install_app_dependencies squid3 mailutils
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -111,15 +91,15 @@ ynh_store_file_checksum "/etc/squid3/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/squid3/access.log"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART SQUID'S SERVICE
|
# RESTART SQUID'S SERVICE and SSOWATCONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
service squid3 restart
|
service squid3 restart
|
||||||
|
yunohost app ssowatconf
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
|
|
|
@ -32,6 +32,7 @@ fi
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
apt-get -y purge squid3
|
apt-get -y purge squid3
|
||||||
|
yunohost app ssowatconf
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CLOSE A PORT
|
# CLOSE A PORT
|
||||||
|
|
|
@ -34,7 +34,7 @@ port=$(ynh_app_setting_get $app port)
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_install_app_dependencies squid3
|
ynh_install_app_dependencies squid3 mailutils
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORE
|
# SPECIFIC RESTORE
|
||||||
|
@ -50,11 +50,12 @@ yunohost firewall allow --no-upnp TCP $port
|
||||||
ynh_secure_remove "/etc/squid3/squid.conf"
|
ynh_secure_remove "/etc/squid3/squid.conf"
|
||||||
ynh_restore_file "/etc/squid3/squid.conf"
|
ynh_restore_file "/etc/squid3/squid.conf"
|
||||||
service squid3 restart
|
service squid3 restart
|
||||||
|
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/squid3/access.log"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue