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
|
||||
; Manifest
|
||||
password="pass"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
|
|
|
@ -21,7 +21,7 @@ acl purge method PURGE
|
|||
acl CONNECT method CONNECT
|
||||
|
||||
###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 realm Web-Proxy
|
||||
|
@ -44,9 +44,9 @@ dns_nameservers 127.0.0.1
|
|||
##Port d'écoute du Proxy
|
||||
http_port __PORT__
|
||||
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 ?
|
||||
access_log /var/log/squid/access.log squid
|
||||
access_log /var/log/squid3/access.log squid
|
||||
refresh_pattern ^ftp: 1440 20% 10080
|
||||
refresh_pattern ^gopher: 1440 0% 1440
|
||||
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
|
||||
|
|
|
@ -18,18 +18,6 @@
|
|||
"multi_instance": false,
|
||||
"services": [],
|
||||
"arguments": {
|
||||
"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"
|
||||
}
|
||||
]
|
||||
"install" : []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,22 +12,47 @@ ynh_delete_file_checksum () {
|
|||
ynh_app_setting_delete $app $checksum_setting_name
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||
# | arg: -m --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: app_message - The message to send to the administrator.
|
||||
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||
# 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
|
||||
# example: "root admin@domain user1 user2"
|
||||
ynh_send_readme_to_admin() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= )
|
||||
local app_message
|
||||
local recipients
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
local app_message="${app_message:-...No specific information...}"
|
||||
local recipients="${recipients:-root}"
|
||||
local app_message="${1:-...No specific information...}"
|
||||
local recipients="${2:-root}"
|
||||
|
||||
# Retrieve the email of users
|
||||
find_mails () {
|
||||
local list_mails="$1"
|
||||
local mail
|
||||
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
|
||||
#=================================================
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -74,7 +54,7 @@ ynh_app_setting_set $app port $port
|
|||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore 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
|
||||
### - 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
|
||||
|
||||
yunohost app ssowatconf
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
|
|
|
@ -32,6 +32,7 @@ fi
|
|||
|
||||
# Remove metapackage and its dependencies
|
||||
apt-get -y purge squid3
|
||||
yunohost app ssowatconf
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
|
|
|
@ -34,7 +34,7 @@ port=$(ynh_app_setting_get $app port)
|
|||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies squid3
|
||||
ynh_install_app_dependencies squid3 mailutils
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
|
@ -50,11 +50,12 @@ yunohost firewall allow --no-upnp TCP $port
|
|||
ynh_secure_remove "/etc/squid3/squid.conf"
|
||||
ynh_restore_file "/etc/squid3/squid.conf"
|
||||
service squid3 restart
|
||||
yunohost app ssowatconf
|
||||
#=================================================
|
||||
# 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