Intégration de la branche better-apacheconfig
This commit is contained in:
commit
a7767f7983
2
.udir
2
.udir
|
@ -19,7 +19,7 @@ openvz_service=
|
|||
# Faut-il installer le service kill-ssh-user-sessions?
|
||||
ksus_service=
|
||||
|
||||
configure_variables=(dest uninst_utools rm_utools kvm_service openvz_service)
|
||||
configure_variables=(dest uninst_utools rm_utools kvm_service openvz_service ksus_service)
|
||||
configure_dest_for=(bashrc profile lib/uinst/conf lib/uinst/rootconf lib/profile.d/nutools.shared lib/bashrc.d/bash_completion.shared lib/init.d/kvm-stop-all legacy/sysinc/utools legacy/sysinc/system_caps legacy/sysinc/private/init)
|
||||
config_scripts=(lib/uinst/conf lib/uinst/system_caps.legacy)
|
||||
install_profiles=true
|
||||
|
|
163
apacheconfig
163
apacheconfig
|
@ -16,6 +16,19 @@ OPTIONS
|
|||
Créer un nouveau répertoire de configuration pour un hôte
|
||||
-d, --destdir DESTDIR[=$TEMPLATECTL_NAME]
|
||||
Nom du répertoire local de configuration.
|
||||
-f,--full
|
||||
--partial
|
||||
Indiquer respectivement que la configuration est complète ou partielle.
|
||||
Avec la configuration complète, le serveur peut être complètement
|
||||
configuré avec tous les fichiers présents. Avec la configuration
|
||||
partielle, uniquement les informations spécifiques à un service en
|
||||
particulier sont disponibles.
|
||||
Cette option est utilisée avec --create. Par défaut, la configuration
|
||||
est partielle.
|
||||
Pour le moment, la seule différence est que --full crée un fichier de
|
||||
configuration nommé .apacheconfig alors que --partial crée un fichier
|
||||
nommé apacheconfig.conf qui est visible et donc découvrable et éditable
|
||||
plus facilement
|
||||
|
||||
-t, --template [OPT]
|
||||
Gérer les fichiers du répertoire local avec templatectl. La valeur de
|
||||
|
@ -46,9 +59,12 @@ OPTIONS
|
|||
Lors du déploiement de la configuration, les valeurs des variables
|
||||
dynamiques sont remplacées dans les fichiers destination.
|
||||
Les arguments qui restent sont passés tels quels à apache_autoconf
|
||||
-N, --network-config
|
||||
Mettre aussi à jour la configuration réseau.
|
||||
-r, --certsdir CERTSDIR
|
||||
Spécifier le cas échéant le répertoire contenant les certificats à
|
||||
déployer. Cet argument est requis si le répertoire certsconf/ existe.
|
||||
déployer. Cet argument est requis si le répertoire certsconf/ existe,
|
||||
sauf si les certificats sont déjà déployés.
|
||||
|
||||
--localhosts
|
||||
Créer dans le fichier /etc/hosts tous les noms d'hôte ayant un suffixe
|
||||
|
@ -63,24 +79,45 @@ OPTIONS
|
|||
-S, --one-site SITE
|
||||
Ne déployer que le fichier de site spécifié. Cette option est utilisée
|
||||
avec --deploy ou --localhosts et est utile pour le développement et les
|
||||
tests."
|
||||
tests.
|
||||
|
||||
-k, --new-site HOST.TLD
|
||||
Créer une définition pour un nouveau site à partir des fichiers du
|
||||
répertoires templates/
|
||||
-K, --new-site-templatedir TEMPLATEDIR
|
||||
Spécifier le répertoire source pour les templates de site utilisés par
|
||||
l'option --new-site. Par défaut, utiliser le répertoire templates/ situé
|
||||
dans le répertoire de configuration.
|
||||
Si TEMPLATEDIR est un nom simple sans séparateur de chemin '/' et qu'un
|
||||
répertoire templates/TEMPLATEDIR existe, alors prendre ce répertoire-là
|
||||
comme source.
|
||||
--new-site-force
|
||||
Avec --new-site, utiliser le nom d'hôte fourni même s'il n'est pas
|
||||
pleinement qualifié"
|
||||
}
|
||||
|
||||
action=
|
||||
destdir=
|
||||
nohideconfig=
|
||||
nohideconfig=auto
|
||||
templateopt=
|
||||
FULLCONF=
|
||||
netconf=
|
||||
aac_certsdir=
|
||||
bits=
|
||||
oneconf=
|
||||
onemodule=
|
||||
onesite=
|
||||
site_host=
|
||||
site_templdir=
|
||||
site_force=
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
-c,--create action=create
|
||||
-d:,--destdir: destdir=
|
||||
--no-hideconfig nohideconfig=1
|
||||
--hideconfig nohideconfig=
|
||||
-f,--full FULLCONF=1
|
||||
--partial FULLCONF=
|
||||
-t::,--template:: '$set@ templateopt; action=template'
|
||||
--help-template '$templateopt=-help; action=template'
|
||||
-l,--list '$templateopt=l; action=template'
|
||||
|
@ -96,15 +133,23 @@ args=(
|
|||
-8,--jessie '$array_add TEMPLATECTL_VARS sysver=jessie'
|
||||
--bits: bits=
|
||||
-u,--update,--deploy action=deploy
|
||||
-N,--network-config netconf=1
|
||||
-r:,--certsdir: aac_certsdir=
|
||||
--localhosts action=localhosts
|
||||
-C:,--one-conf: oneconf=
|
||||
-M:,--one-module: onemodule=
|
||||
-S:,--one-site: onesite=
|
||||
-k:,--new-site: '$action=new-site; set@ site_host'
|
||||
-K:,--new-site-templatedir: site_templdir=
|
||||
--new-site-force site_force=
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
apacheconfig_loadconf "$destdir" || die
|
||||
if [ "$nohideconfig" == auto ]; then
|
||||
[ -n "$FULLCONF" ] && nohideconfig= || nohideconfig=1
|
||||
fi
|
||||
|
||||
apacheconfig_loadconf "$destdir" "$nohideconfig" || die
|
||||
apacheconfig_sysinfos "$sysname" "$sysdist" "$sysver" "$bits"
|
||||
|
||||
################################################################################
|
||||
|
@ -128,7 +173,7 @@ if [ "$action" == create ]; then
|
|||
ask_yesno "Le fichier $(ppath "$config") sera écrasé. Voulez-vous continuer?" O || die
|
||||
rm -f "$config" || die
|
||||
fi
|
||||
templatectl -d "$destdir" --config "$config" --no-load-vars -m --write-vars
|
||||
templatectl -d "$destdir" --config "$config" ${nohideconfig:+--no-hide-config} --no-load-vars -m --write-vars
|
||||
|
||||
################################################################################
|
||||
elif [ "$action" == template ]; then
|
||||
|
@ -142,7 +187,9 @@ elif [ "$action" == deploy -o "$action" == localhosts ]; then
|
|||
[ -d "$destdir" ] || die "$destdir: répertoire introuvable"
|
||||
|
||||
args=(
|
||||
-d "$destdir" --$action ${aac_certsdir:+-r "$aac_certsdir"}
|
||||
-d "$destdir" --$action
|
||||
${netconf:+--network-config}
|
||||
${aac_certsdir:+-r "$aac_certsdir"}
|
||||
${oneconf:+--one-conf "$oneconf"}
|
||||
${onemodule:+--one-module "$onemodule"}
|
||||
${onesite:+--one-site "$onesite"}
|
||||
|
@ -160,11 +207,113 @@ elif [ "$action" == deploy -o "$action" == localhosts ]; then
|
|||
apacheconfig_deploy \
|
||||
"$destdir" "$aac_certsdir" \
|
||||
"$config" "$oneconf" "$onemodule" "$onesite" \
|
||||
"$custom_sysinfos" "$sysname" "$sysdist" "$sysver" "$bits" || die
|
||||
"$custom_sysinfos" "$sysname" "$sysdist" "$sysver" "$bits" \
|
||||
"$netconf" || die
|
||||
eend
|
||||
elif [ "$action" == localhosts ]; then
|
||||
etitle "Mise à jour de /etc/hosts"
|
||||
apacheconfig_deploy_localhosts "$destdir" "$aac_certsdir" "$onesite" || die
|
||||
eend
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
elif [ "$action" == new-site ]; then
|
||||
host="$site_host"
|
||||
templdir="$site_templdir"
|
||||
if [[ "$templdir" != */* ]] && [ -d "$destdir/templates/$templdir" ]; then
|
||||
templdir="$destdir/templates/$templdir"
|
||||
elif [ -z "$templdir" ]; then
|
||||
templdir="$destdir/templates"
|
||||
fi
|
||||
[ -d "$templdir" ] || die "$templdir: répertoire introuvable"
|
||||
force="$site_force"
|
||||
|
||||
clrtempl=
|
||||
ssltempl=
|
||||
certstempl=
|
||||
wwwtempl=
|
||||
array_from_lines templs "$(list_files "$templdir" "*SITE.conf")"
|
||||
[ ${#templs[*]} -gt 0 ] && clrtempl="${templs[0]}"
|
||||
array_from_lines templs "$(list_files "$templdir" "*SITE.ssl.conf")"
|
||||
[ ${#templs[*]} -gt 0 ] && ssltempl="${templs[0]}"
|
||||
array_from_lines templs "$(list_files "$templdir" "*SITE-certs.conf")"
|
||||
[ ${#templs[*]} -gt 0 ] && certstempl="${templs[0]}"
|
||||
array_from_lines templs "$(list_dirs "$templdir" "*SITE")"
|
||||
[ ${#templs[*]} -gt 0 ] && wwwtempl="${templs[0]}"
|
||||
|
||||
found=
|
||||
for i in "$clrtempl" "$ssltempl" "$certstempl" "$wwwtempl"; do
|
||||
[ -n "$i" ] && { found=1; break; }
|
||||
done
|
||||
[ -n "$found" ] || die "Aucun template disponible"
|
||||
|
||||
if [ -z "$force" ] && [[ "$host" != *.* ]]; then
|
||||
die "$host n'est pas un nom d'hôte pleinement qualifié"
|
||||
fi
|
||||
|
||||
etitle "$host"
|
||||
hostname="${host%%.*}"
|
||||
clrconf="${clrtempl/SITE/$hostname}"
|
||||
sslconf="${ssltempl/SITE/$hostname}"
|
||||
certsconf="${certstempl/SITE/$hostname}"
|
||||
wwwdir="${wwwtempl/SITE/$hostname}"
|
||||
|
||||
mkdir -p "$destdir/certsconf"
|
||||
mkdir -p "$destdir/sites"
|
||||
|
||||
sedscript="\
|
||||
s/SITE.TLD/$host/g
|
||||
s/SITE/$hostname/g"
|
||||
|
||||
if [ -z "$clrtempl" ]; then
|
||||
:
|
||||
elif [ ! -f "$templdir/$clrtempl" ]; then
|
||||
ewarn "Le fichier $(ppath "$templdir/$clrtempl") n'existe pas. La copie ne sera pas complète"
|
||||
elif [ -f "$destdir/sites/$clrconf" ]; then
|
||||
ewarn "Le fichier sites/$clrconf existe déjà. Il ne sera pas écrasé."
|
||||
else
|
||||
estep "sites/$clrconf"
|
||||
sed "$sedscript" "$templdir/$clrtempl" >"$destdir/sites/$clrconf" || die
|
||||
fi
|
||||
|
||||
if [ -z "$ssltempl" ]; then
|
||||
:
|
||||
elif [ ! -f "$templdir/$ssltempl" ]; then
|
||||
ewarn "Le fichier $(ppath "$templdir/$ssltempl") n'existe pas. La copie ne sera pas complète"
|
||||
elif [ -f "$destdir/sites/$sslconf" ]; then
|
||||
ewarn "Le fichier sites/$sslconf existe déjà. Il ne sera pas écrasé."
|
||||
else
|
||||
estep "sites/$sslconf"
|
||||
sed "$sedscript" "$templdir/$ssltempl" >"$destdir/sites/$sslconf" || die
|
||||
fi
|
||||
|
||||
if [ -z "$certstempl" ]; then
|
||||
:
|
||||
elif [ ! -f "$templdir/$certstempl" ]; then
|
||||
ewarn "Le fichier $(ppath "$templdir/$certstempl") n'existe pas. La copie ne sera pas complète"
|
||||
elif [ -f "$destdir/certsconf/$certsconf" ]; then
|
||||
ewarn "Le fichier certsconf/$certsconf exite déjà. Il ne sera pas écrasé."
|
||||
else
|
||||
estep "certsconf/$certsconf"
|
||||
sed "$sedscript" "$templdir/$certstempl" >"$destdir/certsconf/$certsconf" || die
|
||||
fi
|
||||
|
||||
if [ -z "$wwwtempl" ]; then
|
||||
:
|
||||
elif [ ! -d "$templdir/$wwwtempl" ]; then
|
||||
ewarn "Le répertoire $(ppath "$templdir/$wwwtempl") n'existe pas. La copie ne sera pas complète"
|
||||
elif [ -d "$destdir/$wwwdir" ]; then
|
||||
ewarn "Le répertoire $wwwdir existe déjà. Il ne sera pas écrasé."
|
||||
else
|
||||
estep "$wwwdir"
|
||||
cpdirnovcs "$templdir/$wwwtempl" "$destdir/$wwwdir" || die
|
||||
sed -i "$sedscript" "$destdir/$wwwdir/.udir" || die
|
||||
fi
|
||||
|
||||
eend
|
||||
|
||||
if [ -n "$wwwtempl" ]; then
|
||||
eimportant "Ne pas oublier le cas échéant de mettre à jour HTDMAPPINGS dans $(ppath "$config") e.g.
|
||||
HTDMAPPINGS=($wwwdir)"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -5,28 +5,101 @@
|
|||
##@require sysinfos
|
||||
##@require apache
|
||||
uprovide apache.tools
|
||||
urequire base sysinfos apache
|
||||
urequire base sysinfos template apache
|
||||
|
||||
function __apache_resolvcert() {
|
||||
function __apache_rc_destdir() {
|
||||
[ -z "$3" ] && set_var "${1:-certsdir}" "$(get_APACHESSLCERTSDIR_prefix)"
|
||||
[ -z "$4" ] && set_var "${2:-keysdir}" "$(get_APACHESSLKEYSDIR_prefix)"
|
||||
}
|
||||
|
||||
function __apache_rc_loadconf() {
|
||||
[ -n "$__rc_dir" ] || __rc_dir="$(dirname "$__rc_conf")"
|
||||
eval "$(
|
||||
source "$__rc_conf"
|
||||
set_var_cmd __rc_cert "$cert"
|
||||
set_var_cmd __rc_key "$key"
|
||||
set_var_cmd __rc_ca "$ca"
|
||||
echo_setv __rc_cert "$cert"
|
||||
echo_setv __rc_key "$key"
|
||||
echo_setv __rc_ca "$ca"
|
||||
)"
|
||||
[ -n "$__rc_cert" ] && __rc_cert="$(abspath "$__rc_cert" "$__rc_dir")"
|
||||
[ -n "$__rc_key" ] && __rc_key="$(abspath "$__rc_key" "$__rc_dir")"
|
||||
[ -n "$__rc_ca" ] && __rc_ca="$(abspath "$__rc_ca" "$__rc_dir")"
|
||||
}
|
||||
|
||||
function __apache_checkvars() {
|
||||
function __apache_rc_resolveprefix() {
|
||||
local __prefix __cert __key
|
||||
local __certsdir="$1" __keysdir="$2"
|
||||
__apache_rc_destdir __certsdir __keysdir "$__certsdir" "$__keysdir"
|
||||
|
||||
if [ -z "$__rc_cert" ]; then
|
||||
# si pas de certificat, alors générer un préfixe pour chercher les
|
||||
# fichiers
|
||||
setx __prefix=basename "$__rc_conf"
|
||||
__prefix="${__prefix%certs.conf}"
|
||||
elif [ ! -f "$__rc_cert" ]; then
|
||||
# si le fichier source n'existe pas, vérifier s'il existe dans la
|
||||
# destination
|
||||
setx __cert=basename "$__rc_cert"
|
||||
setx __key=basename "$__rc_key"
|
||||
if [ -f "$__certsdir/$__cert" -a -f "$__keysdir/$__key" ]; then
|
||||
# parfait, les fichiers existent déjà à l'endroit prévu
|
||||
:
|
||||
else
|
||||
# construire un préfixe avec le nom du fichier
|
||||
__prefix="$__cert"
|
||||
if [ "${__prefix%.pem}" != "$__prefix" ]; then
|
||||
__prefix="${__prefix%.pem}"
|
||||
elif [ "${__prefix%.crt}" != "$__prefix" ]; then
|
||||
__prefix="${__prefix%.crt}"
|
||||
fi
|
||||
if [ -n "${__prefix//[0-9]/}" ]; then
|
||||
# enlever le suffixe numérique, uniquement si le nom ne contient
|
||||
# pas que des chiffres
|
||||
while [ -n "$__prefix" -a "${__prefix%[0-9]}" != "$__prefix" ]; do
|
||||
__prefix="${__prefix%[0-9]}"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$__prefix" ]; then
|
||||
local -a __certs
|
||||
array_from_lines __certs "$(list_files "$__certsdir" "$__prefix*" | LANG=C sort -r)"
|
||||
if [ ${#__certs[*]} -gt 0 ]; then
|
||||
__cert="${__certs[0]}"
|
||||
__key="${__cert%.*}.key"
|
||||
__rc_cert="$__rc_dir/$__cert"
|
||||
__rc_key="$__rc_dir/$__key"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function __apache_rc_checkfiles() {
|
||||
local destdir="$1"; shift
|
||||
local file
|
||||
for file in "$@"; do
|
||||
[ -n "$file" ] || continue
|
||||
[ -f "$file" ] && continue
|
||||
if [ -n "$destdir" -a -f "$destdir/$(basename "$file")" ]; then
|
||||
[ -z "$__apache_rc_quiet" ] && ewarn "$file: fichier introuvable
|
||||
Le fichier existant $destdir/$(basename "$file") sera utilisé"
|
||||
continue
|
||||
fi
|
||||
eerror "$file: fichier introuvable"
|
||||
return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
function __apache_rc_checkvars() {
|
||||
local __certsdir="$1" __keysdir="$2"
|
||||
__apache_rc_destdir __certsdir __keysdir "$__certsdir" "$__keysdir"
|
||||
|
||||
if [ -n "$__rc_cert" -a -z "$__rc_key" ]; then
|
||||
local __rc_name __rc_ext
|
||||
splitname "$__rc_cert" __rc_name __rc_ext
|
||||
if [ "$__rc_ext" == "crt" -o "$__rc_ext" == "pem" ]; then
|
||||
__rc_key="$__rc_name.key"
|
||||
enote "La clé privée n'a pas été spécifiée. La valeur $(ppath "$__rc_key") sera utilisée"
|
||||
[ -z "$__apache_rc_quiet" ] && enote "La clé privée n'a pas été spécifiée. La valeur $(ppath "$__rc_key") sera utilisée"
|
||||
else
|
||||
eerror "Impossible de trouver la clé privée correspondant au certificat $(ppath "$__rc_cert")"
|
||||
return 1
|
||||
|
@ -36,30 +109,31 @@ function __apache_checkvars() {
|
|||
eerror "Vous devez spécifier le certificat à installer"
|
||||
return 1
|
||||
elif [ -z "$__rc_cert" ]; then
|
||||
eattention "Seul le certificat autorité a été spécifié."
|
||||
[ -z "$__apache_rc_quiet" ] && eattention "Seul le certificat autorité a été spécifié."
|
||||
elif [ -z "$__rc_ca" ]; then
|
||||
ewarn "Aucun certificat autorité n'a pas été spécifié. Cela ne peut marcher que si le certificat est autosigné"
|
||||
[ -z "$__apache_rc_quiet" ] && ewarn "Aucun certificat autorité n'a pas été spécifié. Cela ne peut marcher que si le certificat est autosigné"
|
||||
fi
|
||||
|
||||
local i
|
||||
for i in "$__rc_cert" "$__rc_key" "$__rc_ca"; do
|
||||
[ -n "$i" ] || continue
|
||||
[ -f "$i" ] || {
|
||||
eerror "$i: Fichier introuvable"
|
||||
return 1
|
||||
}
|
||||
done
|
||||
__apache_rc_checkfiles "$__certsdir" "$__rc_ca" "$__rc_cert" || return 1
|
||||
__apache_rc_checkfiles "$__keysdir" "$__rc_key" || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
function apache_resolvecert() {
|
||||
# Calculer l'emplacement des certificats correspondant aux arguments $1 et
|
||||
# $2 (qui correspondent aux options --conf et --dir de apache_addcert()),
|
||||
# puis initialiser les variables $3(=cert), $4(=key) et $5(=ca)
|
||||
# Si ces valeurs sont déjà calculées, on peut fournir $6=certsdir et
|
||||
# $7=keysdir
|
||||
local __rc_conf="$1" __rc_dir="$2"
|
||||
local __rc_cert __rc_key __rc_ca
|
||||
|
||||
__apache_resolvcert
|
||||
__apache_checkvars || return 1
|
||||
local __certsdir="$6" __keysdir="$7"
|
||||
__apache_rc_destdir __certsdir __keysdir "$__certsdir" "$__keysdir"
|
||||
|
||||
__apache_rc_loadconf
|
||||
__apache_rc_resolveprefix "$__certsdir" "$__keysdir"
|
||||
__apache_rc_checkvars "$__certsdir" "$__keysdir" || return 1
|
||||
set_var "${3:-cert}" "$__rc_cert"
|
||||
set_var "${4:-key}" "$__rc_key"
|
||||
set_var "${5:-ca}" "$__rc_ca"
|
||||
|
@ -93,29 +167,33 @@ OPTIONS
|
|||
|
||||
eval "$(utools_local)"
|
||||
local action=install
|
||||
local certsconf certsdir cert key ca
|
||||
local certsconf certssrcdir cert key ca
|
||||
local __out_cert __out_key __out_ca
|
||||
parse_opts "${PRETTYOPTS[@]}" \
|
||||
--help '$exit_with __apache_addcert_display_help' \
|
||||
-C:,--conf: certsconf= \
|
||||
-d:,--dir: certsdir= \
|
||||
-d:,--dir: certssrcdir= \
|
||||
--out-cert: '$set@ __out_cert; action=dump' \
|
||||
--out-key: '$set@ __out_key; action=dump' \
|
||||
--out-ca: '$set@ __out_ca; action=dump' \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
|
||||
local certsdir keysdir
|
||||
__apache_rc_destdir certsdir keysdir
|
||||
|
||||
local __rc_conf __rc_dir
|
||||
local __rc_cert __rc_key __rc_ca
|
||||
if [ -n "$certsconf" ]; then
|
||||
__rc_conf="$certsconf"
|
||||
__rc_dir="$certsdir"
|
||||
__apache_resolvconf
|
||||
__apache_checkvars || return 1
|
||||
__rc_dir="$certssrcdir"
|
||||
__apache_rc_loadconf
|
||||
__apache_rc_resolveprefix "$certsdir" "$keysdir"
|
||||
__apache_rc_checkvars "$certsdir" "$keysdir" || return 1
|
||||
else
|
||||
__rc_cert="$1"
|
||||
__rc_key="$2"
|
||||
__rc_ca="$3"
|
||||
__apache_checkvars || return 1
|
||||
__apache_rc_checkvars "$certsdir" "$keysdir" || return 1
|
||||
fi
|
||||
cert="$__rc_cert"
|
||||
key="$__rc_key"
|
||||
|
@ -129,9 +207,7 @@ OPTIONS
|
|||
ask_yesno "Voulez-vous continuer?" O || return 1
|
||||
urequire install
|
||||
|
||||
etitle "Installation des certificats"
|
||||
certsdir="$(get_APACHESSLCERTSDIR_prefix)"
|
||||
keysdir="$(get_APACHESSLKEYSDIR_prefix)"
|
||||
etitled "Copie des fichiers"
|
||||
if [ ! -d "$certsdir" ]; then
|
||||
mkdir -p "$certsdir" || return 1
|
||||
chmod 755 "$certsdir" || return 1
|
||||
|
@ -140,38 +216,36 @@ OPTIONS
|
|||
mkdir -p "$keysdir" || return 1
|
||||
chmod 710 "$keysdir" || return 1
|
||||
fi
|
||||
if [ -n "$cert" ]; then
|
||||
copy_replace "$cert" "$certsdir" || return 1
|
||||
if [ -n "$cert" -a -f "$cert" ]; then
|
||||
if copy_update "$cert" "$certsdir"; then
|
||||
chmod 644 "$certsdir/$(basename "$cert")" || return 1
|
||||
copy_replace "$key" "$keysdir" || return 1
|
||||
fi
|
||||
if copy_update "$key" "$keysdir"; then
|
||||
chmod 640 "$keysdir/$(basename "$key")" || return 1
|
||||
fi
|
||||
if [ -n "$ca" ]; then
|
||||
copy_replace "$ca" "$certsdir" || return 1
|
||||
fi
|
||||
if [ -n "$ca" -a -f "$ca" ]; then
|
||||
if copy_update "$ca" "$certsdir"; then
|
||||
chmod 644 "$certsdir/$(basename "$ca")" || return 1
|
||||
fi
|
||||
fi
|
||||
eend
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
__APACHE_AUTOCONF_SUFFIXES=(d8 d)
|
||||
__APACHE_AUTOCONF_SUFFIX_d8=(-d debian -v jessie+)
|
||||
__APACHE_AUTOCONF_SUFFIX_d=(-d debian)
|
||||
function __apache_autoconf_check_suffix() {
|
||||
array_contains __APACHE_AUTOCONF_SUFFIXES "$1" || return 1
|
||||
local sysinfos="__APACHE_AUTOCONF_SUFFIX_${1}[@]"
|
||||
check_sysinfos --vars sysname sysdist sysver bits "${!sysinfos}"
|
||||
}
|
||||
function __apache_autoconf_filter_suffix_files() {
|
||||
grep -vF ..
|
||||
}
|
||||
function __apache_autoconf_setup() {
|
||||
if ! check_sysinfos --vars sysname sysdist sysver bits -s linux64 linux32 linux -d debian; then
|
||||
eerror "apache_autoconf n'est supporté que sur Debian linux"
|
||||
eerror "$(get_sysinfos_desc): système non supporté. debian linux est requis"
|
||||
return 1
|
||||
fi
|
||||
urequire install
|
||||
urequire debian install
|
||||
if [ -z "$__apache_autoconf_no_require_apache" ]; then
|
||||
pkg_check apache2 || {
|
||||
eerror "apache2 non installé. impossible de continuer"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
compute_apache_prefixes
|
||||
return 0
|
||||
}
|
||||
|
@ -193,24 +267,8 @@ function __apache_autoconf_fillcopy() {
|
|||
# script sed $FILLSCRIPT. Le fichier temporaire $FILLTEMP est utilisé pour
|
||||
# le remplacement des valeurs. $3 contient le cas échéant des commandes sed
|
||||
# supplémentaires
|
||||
# Si des fichiers suffixes existent, ne faire la copie que si un fichier
|
||||
# approprié correspondant au système courant est trouvé
|
||||
local src="$1" dest="$2" sedscript="$3" perms="${4:-go+rX}"
|
||||
|
||||
# vérifier les fichiers suffixe
|
||||
local suffix have_suffix found_suffix
|
||||
for suffix in "${__APACHE_AUTOCONF_SUFFIXES[@]}"; do
|
||||
if [ -f "$src..$suffix" ]; then
|
||||
have_suffix=1
|
||||
if __apache_autoconf_check_suffix "$suffix"; then
|
||||
found_suffix=1
|
||||
src="$src..$suffix"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
[ -n "$have_suffix" -a -z "$found_suffix" ] && return 1
|
||||
|
||||
# valeurs à remplacer dans le fichier
|
||||
local var found_var
|
||||
for var in "${FILLVARS[@]}"; do
|
||||
|
@ -225,14 +283,16 @@ $sedscript" <"$src" >"$FILLTEMP"
|
|||
src="$FILLTEMP"
|
||||
fi
|
||||
|
||||
copy_update "$src" "$dest" "$perms"
|
||||
copy_update "$src" "$dest" "$perms" && return
|
||||
estepn "$(basename -- "$dest")"
|
||||
return 1
|
||||
}
|
||||
|
||||
__APACHE_AUTOCONF_HELP="\
|
||||
--confdir CONFDIR
|
||||
Spécifier l'emplacement des fichiers de configuration apache ainsi que des
|
||||
fichiers 'confs.conf', 'modules.conf' et 'sites.conf'. Par défaut, prendre
|
||||
le répertoire local DESTDIR.
|
||||
fichiers 'syspkgs.conf', 'confs.conf', 'modules.conf' et 'sites.conf'. Par
|
||||
défaut, prendre le répertoire local DESTDIR.
|
||||
--confsdir CONFSDIR
|
||||
Spécifier l'emplacement des fichiers des configuration. Par défaut, utiliser
|
||||
DESTDIR/confs si ce répertoire existe.
|
||||
|
@ -264,7 +324,7 @@ function apache_autoconf() {
|
|||
local autoconfdir certsdir confdir confsdir oneconf modulesdir onemodule
|
||||
local sitesdir onesite cgibindir wwwdir certsconfdir rrdir onecms
|
||||
local sysname sysdist sysver bits
|
||||
local destconfsdir a2xconf
|
||||
local netconf destconfsdir a2xconf
|
||||
local restart=1
|
||||
parse_opts "${PRETTYOPTS[@]}" \
|
||||
--help '$exit_with __display_apache_autoconf_help' \
|
||||
|
@ -288,6 +348,7 @@ function apache_autoconf() {
|
|||
-7,--wheezy sysver=wheezy \
|
||||
-8,--jessie sysver=jessie \
|
||||
--bits: bits= \
|
||||
--network-config netconf=1 \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
|
||||
if [ -n "$sysname" -o -n "$sysdist" -o -n "$sysver" ]; then
|
||||
|
@ -298,13 +359,13 @@ function apache_autoconf() {
|
|||
sysver=("${MYSYSVER[@]}")
|
||||
bits="$MYBITS"
|
||||
fi
|
||||
__apache_autoconf_setup || return 1
|
||||
if __apache_autoconf_check_suffix d8; then
|
||||
__apache_autoconf_no_require_apache= __apache_autoconf_setup || return 1
|
||||
if check_sysinfos --vars sysname sysdist sysver bits -d debian -v jessie+; then
|
||||
confdefault=000-default.conf
|
||||
confdefaultssl=default-ssl.conf
|
||||
destconfsdir="$APACHECONFDIR/conf-available"
|
||||
a2xconf=1
|
||||
elif __apache_autoconf_check_suffix d; then
|
||||
elif check_sysinfos --vars sysname sysdist sysver bits -d debian; then
|
||||
confdefault=default
|
||||
confdefaultssl=default-ssl
|
||||
destconfsdir="$APACHECONFDIR/conf.d"
|
||||
|
@ -340,6 +401,19 @@ function apache_autoconf() {
|
|||
local -a FILLVARS; local FILLSCRIPT FILLTEMP
|
||||
__apache_autoconf_fillxxx "$@"
|
||||
|
||||
# Installation des packages système
|
||||
if [ -f "$confdir/syspkgs.conf" ]; then
|
||||
local -a syspkgs
|
||||
local syspkg
|
||||
array_from_lines syspkgs "$(<"$confdir/syspkgs.conf" filter_conf)"
|
||||
if ! pkg_check "${syspkgs[@]}"; then
|
||||
etitle "Installation de paquets système"
|
||||
estep "${syspkgs[@]}"
|
||||
pkg_install "${syspkgs[@]}" || return 1
|
||||
eend
|
||||
fi
|
||||
fi
|
||||
|
||||
# Copie des certificats
|
||||
local modified rehash conf
|
||||
if [ -d "$certsconfdir" ]; then
|
||||
|
@ -350,17 +424,10 @@ function apache_autoconf() {
|
|||
array_addu FILLVARS ca
|
||||
|
||||
etitle "Installation des certificats"
|
||||
[ -n "$certsdir" -a ! -d "$certsdir" ] && ewarn "$certsdir: répertoire invalide"
|
||||
array_lsfiles certsconfs "$certsconfdir" "*.conf"
|
||||
for certsconf in "${certsconfs[@]}"; do
|
||||
if [ -z "$certsdir" ]; then
|
||||
eerror "CERTSDIR est requis si --certsconfdir est spécifié"
|
||||
return 1
|
||||
elif [ ! -d "$certsdir" ]; then
|
||||
eerror "$certsdir: répertoire invalide"
|
||||
return 1
|
||||
fi
|
||||
apache_resolvecert "$certsconf" "$certsdir" cert key ca || return 1
|
||||
apache_addcert -y "$cert" "$key" "$ca"
|
||||
apache_addcert -y -C "$certsconf" -d "$certsdir" "$cert" "$key" "$ca" || return 1
|
||||
modified=1
|
||||
done
|
||||
array_lsfiles certspems "$certsconfdir" "*.crt" "*.pem"
|
||||
|
@ -378,11 +445,9 @@ function apache_autoconf() {
|
|||
local -a confs
|
||||
local conf
|
||||
etitle "Installation des configurations"
|
||||
array_from_lines confs "$(list_files "$confsdir" "*.conf" | __apache_autoconf_filter_suffix_files)"
|
||||
array_from_lines confs "$(list_files "$confsdir" "*.conf")"
|
||||
for conf in "${confs[@]}"; do
|
||||
[ -z "$oneconf" -o "$conf" == "$oneconf" ] || continue
|
||||
|
||||
estep "$conf"
|
||||
__apache_autoconf_fillcopy \
|
||||
"$confsdir/$conf" \
|
||||
"$destconfsdir/$conf" && modified=1
|
||||
|
@ -395,11 +460,9 @@ function apache_autoconf() {
|
|||
local -a confs
|
||||
local conf
|
||||
etitle "Installation des configurations des modules"
|
||||
array_from_lines confs "$(list_files "$modulesdir" "*.conf" | __apache_autoconf_filter_suffix_files)"
|
||||
array_from_lines confs "$(list_files "$modulesdir" "*.conf")"
|
||||
for conf in "${confs[@]}"; do
|
||||
[ -z "$onemodule" -o "$conf" == "$onemodule" ] || continue
|
||||
|
||||
estep "$conf"
|
||||
__apache_autoconf_fillcopy \
|
||||
"$modulesdir/$conf" \
|
||||
"$APACHECONFDIR/mods-available/$conf" && modified=1
|
||||
|
@ -409,12 +472,12 @@ function apache_autoconf() {
|
|||
|
||||
# Règles de réécriture
|
||||
if [ -d "$rrdir" -a -z "$onecms" ]; then
|
||||
# legacy... remplacé par des fichiers de règles directement dans le répertoire de configuration
|
||||
local -a confs
|
||||
local conf
|
||||
etitle "Installation des règles de réécriture"
|
||||
array_from_lines confs "$(list_files "$rrdir" "RewriteRules*.conf")"
|
||||
for conf in "${confs[@]}"; do
|
||||
estep "$conf"
|
||||
__apache_autoconf_fillcopy \
|
||||
"$rrdir/$conf" \
|
||||
"$APACHECONFDIR/$conf" && modified=1
|
||||
|
@ -426,9 +489,9 @@ function apache_autoconf() {
|
|||
local -a enablesites disablesites
|
||||
if [ -d "$sitesdir" -a \( -z "$onecms" -o -n "$onesite" \) ]; then
|
||||
local -a confs
|
||||
local conf confname destconf certsconf
|
||||
local conf confname destconf certsconf sedscript copied
|
||||
etitle "Installation des sites"
|
||||
array_from_lines confs "$(list_files "$sitesdir" "*.conf" | __apache_autoconf_filter_suffix_files)"
|
||||
array_from_lines confs "$(list_files "$sitesdir" "*.conf")"
|
||||
for confname in "${confs[@]}"; do
|
||||
conf="$sitesdir/$confname"
|
||||
[ -z "$onesite" -o "$confname" == "$onesite" ] || continue
|
||||
|
@ -449,27 +512,44 @@ function apache_autoconf() {
|
|||
*) destconf="$confname";;
|
||||
esac
|
||||
|
||||
copied=
|
||||
if [ -n "$certsconf" ]; then
|
||||
certsconf="$certsconfdir/$certsconf"
|
||||
if [ -f "$certsconf" ]; then
|
||||
apache_resolvecert "$certsconf" "$certsdir" cert key ca || return 1
|
||||
__apache_rc_quiet=1 apache_resolvecert "$certsconf" "$certsdir" cert key ca || return 1
|
||||
if [ -n "$cert" -a -n "$key" ]; then
|
||||
sedscript="\
|
||||
s#@@cert@@#$APACHESSLCERTSDIR/$(basename "$cert")#g
|
||||
s#@@key@@#$APACHESSLKEYSDIR/$(basename "$key")#g"
|
||||
if [ -n "$ca" ]; then
|
||||
sedscript="$sedscript
|
||||
s#@@ca@@#$APACHESSLCERTSDIR/$(basename "$ca")#g"
|
||||
else
|
||||
sedscript="$sedscript
|
||||
/@@ca@@/s/^/#/g"
|
||||
fi
|
||||
__apache_autoconf_fillcopy \
|
||||
"$conf" \
|
||||
"$APACHEAVSITESDIR/$destconf" "\
|
||||
s#@@cert@@#$APACHESSLCERTSDIR/$(basename "$cert")#g
|
||||
s#@@key@@#$APACHESSLKEYSDIR/$(basename "$key")#g
|
||||
s#@@ca@@#$APACHESSLCERTSDIR/$(basename "$ca")#g
|
||||
"
|
||||
"$APACHEAVSITESDIR/$destconf" "$sedscript"
|
||||
copied=1
|
||||
else
|
||||
eerror "$(ppath "$certsconf"): fichier introuvable. Il a été ignoré"
|
||||
eerror "$(ppath "$certsconf"): définition des certificats introuvable
|
||||
Le fichier de configuration $confname a été ignoré"
|
||||
fi
|
||||
else
|
||||
eerror "$(ppath "$certsconf"): fichier introuvable
|
||||
Le fichier de configuration $confname a été ignoré"
|
||||
fi
|
||||
else
|
||||
__apache_autoconf_fillcopy \
|
||||
"$conf" \
|
||||
"$APACHEAVSITESDIR/$destconf"
|
||||
copied=1
|
||||
fi
|
||||
if [ -n "$copied" ]; then
|
||||
enablesites=("${enablesites[@]}" "$destconf")
|
||||
modified=1
|
||||
fi
|
||||
done
|
||||
eend
|
||||
fi
|
||||
|
@ -478,16 +558,28 @@ s#@@ca@@#$APACHESSLCERTSDIR/$(basename "$ca")#g
|
|||
if [ -d "$confdir" -a -z "$onecms" ]; then
|
||||
local -a confs
|
||||
local conf
|
||||
|
||||
etitle "Configuration de base"
|
||||
array_add ignores confs.conf modules.conf sites.conf
|
||||
array_from_lines confs "$(list_files "$confdir" | __apache_autoconf_filter_suffix_files)"
|
||||
array_add ignores syspkgs.conf confs.conf modules.conf sites.conf network.conf
|
||||
array_from_lines confs "$(list_files "$confdir")"
|
||||
for conf in "${confs[@]}"; do
|
||||
array_contains ignores "$conf" && continue
|
||||
estep "$conf"
|
||||
__apache_autoconf_fillcopy \
|
||||
"$confdir/$conf" \
|
||||
"$APACHECONFDIR/$conf" && modified=1
|
||||
done
|
||||
|
||||
array_from_lines confs "$(list_files "$confdir" "*rewrite*.rules")"
|
||||
if [ ${#confs[*]} -gt 0 ]; then
|
||||
etitle "Règles de réécriture"
|
||||
for conf in "${confs[@]}"; do
|
||||
[ -f "$APACHECONFDIR/$conf" ] || continue
|
||||
estep "$conf"
|
||||
legacy_mkRewriteRules "$APACHECONFDIR/$conf" && modified=1
|
||||
done
|
||||
eend
|
||||
fi
|
||||
|
||||
if [ -f "$confdir/confs.conf" -a -n "$a2xconf" ]; then
|
||||
local -a confs
|
||||
local conf
|
||||
|
@ -564,9 +656,30 @@ s#@@ca@@#$APACHESSLCERTSDIR/$(basename "$ca")#g
|
|||
fi
|
||||
|
||||
# Contenu web
|
||||
if [ -d "$wwwdir" -a -z "$onecms" ]; then
|
||||
etitle "Installation des fichiers du serveur web"
|
||||
if [ -z "$onecms" ]; then
|
||||
etitled "Installation des fichiers du serveur web"
|
||||
if is_defined HTDMAPPINGS; then
|
||||
local htdmapping src dest
|
||||
for htdmapping in "${HTDMAPPINGS[@]}"; do
|
||||
splitpair "$htdmapping" dest src
|
||||
[ -n "$dest" ] || dest=html
|
||||
case "$dest" in
|
||||
html) [ -n "$src" ] || src=www;;
|
||||
*) [ -n "$src" ] || src="$dest";;
|
||||
esac
|
||||
withpath "$src" || src="$confdir/$src"
|
||||
withpath "$dest" || dest="$HTDOCSBASE/$dest"
|
||||
estep "$src --> $dest"
|
||||
cpdirnovcs "$src" "$dest"
|
||||
# par défaut, le propriétaire est root. est-ce nécessaire?
|
||||
#chown -R www-data: "$dest"
|
||||
done
|
||||
elif [ -d "$wwwdir" ]; then
|
||||
estep "$wwwdir --> $HTDOCSDIR"
|
||||
cpdirnovcs "$wwwdir" "$HTDOCSDIR"
|
||||
# par défaut, le propriétaire est root. est-ce nécessaire?
|
||||
#chown -R www-data: "$HTDOCSDIR"
|
||||
fi
|
||||
eend
|
||||
fi
|
||||
|
||||
|
@ -587,6 +700,30 @@ s#@@ca@@#$APACHESSLCERTSDIR/$(basename "$ca")#g
|
|||
eend
|
||||
fi
|
||||
|
||||
# Mettre à jour la configuration réseau
|
||||
if [ -z "$onecms" -a -n "$netconf" -a -f "$confdir/network.conf" ]; then
|
||||
local -a ips brs; local host etc_networks
|
||||
eval "$(
|
||||
source "$confdir/network.conf"
|
||||
set_array_cmd ips
|
||||
set_array_cmd brs
|
||||
echo_setv host "$host"
|
||||
echo_setv etc_networks "$etc_networks"
|
||||
)"
|
||||
etitled "Vérification de la configuration du réseau"
|
||||
if [ -n "$FULLCONF" ]; then
|
||||
if [ ${#ips[*]} -gt 0 -o ${#brs[*]} -gt 0 -o -n "$hosts" ]; then
|
||||
network_config "$host" ips brs && modified=1
|
||||
fi
|
||||
[ -n "$etc_networks" ] && network_update_etc_networks "$etc_networks"
|
||||
else
|
||||
if [ ${#ips[*]} -gt 0 ]; then
|
||||
network_config_partial ips && modified=1
|
||||
fi
|
||||
fi
|
||||
eend
|
||||
fi
|
||||
|
||||
if [ -n "$modified" ]; then
|
||||
[ -n "$rehash" ] && elinedots "Hashage des certificats" c_rehash
|
||||
if [ -n "$restart" ]; then
|
||||
|
@ -604,7 +741,7 @@ function apache_autoconf_localhosts() {
|
|||
--one-site: onesite= \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
|
||||
__apache_autoconf_setup || return 1
|
||||
__apache_autoconf_no_require_apache=1 __apache_autoconf_setup || return 1
|
||||
|
||||
# Configuration
|
||||
autoconfdir="$1"; shift
|
||||
|
@ -711,27 +848,48 @@ function __template_updatef_dhost() {
|
|||
[ -n "$ips" ] || __template_set_var ips ""
|
||||
}
|
||||
|
||||
# toujours placer une variable dépendante AVANT la variable maitre
|
||||
# syntaxe: var[:depvars,...][=desc]
|
||||
APACHECONFIG_TEMPLATE_STATIC_VARS=(
|
||||
hostname aliases host
|
||||
certsdir caname
|
||||
host:hostname,aliases="hôte pour lequel ce template a été créé.
|
||||
# les variables hostname et aliases sont automatiquement générées.
|
||||
# utiliser @@dhost@@ pour déployer dynamiquement avec le nom d'hôte courant."
|
||||
certsdir="répertoire par défaut contenant les certificats à déployer"
|
||||
caname="nom de l'autorité par défaut"
|
||||
)
|
||||
APACHECONFIG_TEMPLATE_DYNAMIC_VARS=(
|
||||
ips_namevirtualhosts ips_listens ips
|
||||
dhostname daliases dhost
|
||||
admin configdir
|
||||
ips:ips_namevirtualhosts,ips_listens="liste d'adresses de la forme ip[:port], séparées par un espace.
|
||||
# ces adresses sont celles sur lesquelles apache doit écouter. ce paramètre n'a
|
||||
# de sens que sur squeeze. en effet, la configuration par défaut sur jessie rend
|
||||
# ce paramétrage inutile."
|
||||
dhost:dhostname,daliases="hôte pour lequel les fichiers doivent être déployés.
|
||||
# les variables dhostname et daliases sont automatiquement générées.
|
||||
# cette variable n'a besoin d'être modifiée que si host=@@dhost@@ ci-dessous"
|
||||
admin="mail de l'administrateur du serveur"
|
||||
configdir="répertoire dans lequel le template a été généré"
|
||||
)
|
||||
APACHECONFIG_TEMPLATE_NOWRITE_VARS=(configdir)
|
||||
APACHECONFIG_TEMPLATE_USER_VARS=(
|
||||
FULLCONF="Est-on en mode configuration complète?"
|
||||
HTDMAPPINGS="Mapping des répertoires destination dans /var/www vers le répertoire local, e.g. html:www"
|
||||
)
|
||||
APACHECONFIG_TEMPLATE_NOWRITE_VARS=(hostname aliases dhostname daliases configdir)
|
||||
|
||||
function __apacheconfig_initsrcdirs() {
|
||||
if check_sysinfos "$@" -d debian -v jessie+; then
|
||||
TEMPLATECTL_SRCDIRS=(apacheconfig.d8)
|
||||
else
|
||||
TEMPLATECTL_SRCDIRS=(apacheconfig)
|
||||
fi
|
||||
}
|
||||
function apacheconfig_initvars() {
|
||||
DEFAULT_ADMIN=supervision-gdrsi@listes.univ-reunion.fr
|
||||
DEFAULT_CERTSDIR=1507-renater
|
||||
DEFAULT_CANAME=1507-DigiCertCA.crt
|
||||
set_defaults apacheconfig
|
||||
|
||||
TEMPLATE_STATIC_VARS=("${APACHECONFIG_TEMPLATE_STATIC_VARS[@]}")
|
||||
TEMPLATE_DYNAMIC_VARS=("${APACHECONFIG_TEMPLATE_DYNAMIC_VARS[@]}")
|
||||
TEMPLATE_NOWRITE_VARS=("${APACHECONFIG_TEMPLATE_NOWRITE_VARS[@]}")
|
||||
template_build_vars TEMPLATE_STATIC_VARS TEMPLATE_NOWRITE_VARS "${APACHECONFIG_TEMPLATE_STATIC_VARS[@]}"
|
||||
template_build_vars TEMPLATE_DYNAMIC_VARS TEMPLATE_NOWRITE_VARS "${APACHECONFIG_TEMPLATE_DYNAMIC_VARS[@]}"
|
||||
template_build_vars TEMPLATE_USER_VARS "" "${APACHECONFIG_TEMPLATE_USER_VARS[@]}"
|
||||
__TEMPLATE_DEFAULTF_host=__template_defaultf_host
|
||||
__TEMPLATE_UPDATEF_host=__template_updatef_host
|
||||
__TEMPLATE_DEFAULTF_ips=__template_defaultf_ips
|
||||
|
@ -740,7 +898,7 @@ function apacheconfig_initvars() {
|
|||
__TEMPLATE_UPDATEF_dhost=__template_updatef_dhost
|
||||
|
||||
TEMPLATECTL_NAME=apacheconfig
|
||||
TEMPLATECTL_SRCDIRS=(apacheconfig)
|
||||
__apacheconfig_initsrcdirs
|
||||
TEMPLATECTL_CONFIG="$TEMPLATECTL_NAME"
|
||||
TEMPLATECTL_DEFAULTS=(
|
||||
admin="$DEFAULT_ADMIN"
|
||||
|
@ -751,11 +909,14 @@ function apacheconfig_initvars() {
|
|||
}
|
||||
|
||||
function apacheconfig_loadconf() {
|
||||
local config modified
|
||||
local destdir="$1" autocreate
|
||||
local config modified autocreate
|
||||
local destdir="$1" nohideconfig="$2"
|
||||
|
||||
# valeurs par défaut
|
||||
is_defined HTDMAPPINGS || HTDMAPPINGS=(html:www)
|
||||
|
||||
__template_set_destdir destdir autocreate "$TEMPLATECTL_NAME" || return 1
|
||||
setx config=templatectl_config "$destdir"
|
||||
setx config=templatectl_config "$destdir" ${nohideconfig:+nohideconfig}
|
||||
modified=
|
||||
templatectl_loadvars "$config" && modified=1
|
||||
|
||||
|
@ -779,7 +940,8 @@ function apacheconfig_sysinfos() {
|
|||
__template_set_var sysname "$sysname"
|
||||
__template_set_var sysdist "$sysdist"
|
||||
__template_set_var sysver "$sysver"
|
||||
#check_sysinfos --vars sysname sysdist sysver bits "${templatectl_suffix[@]}
|
||||
# mettre à jour la source en fonction du système cible
|
||||
__apacheconfig_initsrcdirs --vars sysname sysdist sysver bits
|
||||
|
||||
upvars sysname "$sysname" sysdist "$sysdist" sysver "$sysver" bits "$bits" \
|
||||
custom_sysinfos "$custom_sysinfos"
|
||||
|
@ -789,6 +951,7 @@ function apacheconfig_deploy() {
|
|||
local destdir="$1" certsdir="$2"; shift; shift
|
||||
local config="$1" oneconf="$2" onemodule="$3"; onesite="$4"; shift; shift; shift; shift
|
||||
local custom_sysinfos="$1" sysname="$2" sysdist="$3" sysver="$4" bits="$5"; shift; shift; shift; shift; shift
|
||||
local netconf="$1"; shift
|
||||
|
||||
local -a args
|
||||
args=(--ignore "$(basename -- "$config")")
|
||||
|
@ -796,6 +959,7 @@ function apacheconfig_deploy() {
|
|||
[ -n "$onemodule" ] && array_add args --one-module "$(basename -- "$onemodule")"
|
||||
[ -n "$onesite" ] && array_add args --one-site "$(basename -- "$onesite")"
|
||||
[ -n "$custom_sysinfos" ] && array_add args --sysname "$sysname" --sysdist "$sysdist" --sysver "$sysver" --bits "$bits"
|
||||
[ -n "$netconf" ] && array_add args --network-config
|
||||
array_add args "$destdir" "$certsdir"
|
||||
for __name in "${TEMPLATE_DYNAMIC_VARS[@]}"; do
|
||||
array_add args "$__name=${!__name}"
|
||||
|
@ -803,6 +967,21 @@ function apacheconfig_deploy() {
|
|||
apache_autoconf "${args[@]}" "$@"
|
||||
}
|
||||
|
||||
function apacheconfig_qs() {
|
||||
# fonction pour simplifier l'utilisation de apacheconfig_deploy pour un
|
||||
# répertoire spécifique
|
||||
# $1=destdir $2=certsdir $3=netconf
|
||||
local destdir="$1" certsdir="$2" netconf="$3"
|
||||
local config modified destdir autocreate
|
||||
apacheconfig_initvars
|
||||
apacheconfig_loadconf "$1"
|
||||
apacheconfig_deploy \
|
||||
"$destdir" "$2" \
|
||||
"$config" "" "" "" \
|
||||
"" "" "" "" "" \
|
||||
"$3"
|
||||
}
|
||||
|
||||
function apacheconfig_localhosts() {
|
||||
local destdir="$1" certsdir="$2"; shift; shift
|
||||
local onesite="$1"; shift
|
||||
|
@ -815,3 +994,241 @@ function apacheconfig_localhosts() {
|
|||
done
|
||||
apache_autoconf_localhosts "${args[@]}" "$@"
|
||||
}
|
||||
|
||||
function __mrr_joinurl() {
|
||||
# joindre chaque élément de $1..@ par /, en évitant les slashes en double
|
||||
local i url
|
||||
for i in "$@"; do
|
||||
[ -n "$i" ] || continue
|
||||
if [ -n "$url" ]; then
|
||||
url="${url%/}/${i#/}"
|
||||
else
|
||||
url="$i"
|
||||
fi
|
||||
done
|
||||
[ -n "$url" ] && echo "$url"
|
||||
}
|
||||
function __mrr_has_proxy() {
|
||||
# vérifier que les options $1 contiennent 'P'
|
||||
local -a options
|
||||
array_split options "$1" ","
|
||||
array_contains options P
|
||||
}
|
||||
function legacy_mkRewriteRules() {
|
||||
# $1=infile, $2=thishost, $3=outfile, $4=htmlfile, $5=proxy_enabled?
|
||||
local infile="$1" thishost="$2" outfile="$3" htmlfile="$4" proxy_enabled="$5"
|
||||
local -a rules; local rule prefix index done current
|
||||
local tmpinfile tmpoutfile
|
||||
local src dest host suffix options prot proxy_acls usrc trail noslash proxy_url proxy_use
|
||||
|
||||
if [ -z "$infile" -o "$infile" == - ]; then
|
||||
infile=/dev/stdin
|
||||
elif [ -z "$outfile" ]; then
|
||||
local outdir="$(dirname -- "$infile")"
|
||||
outfile="$(basename -- "$infile")"
|
||||
if [[ "$outfile" == *rewrite*.rules ]]; then
|
||||
outfile="${outfile/rewrite/RewriteRules}"
|
||||
outfile="${outfile/.rules/.conf}"
|
||||
else
|
||||
outfile="$outfile-RewriteRules.conf"
|
||||
fi
|
||||
outfile="$outdir/$outfile"
|
||||
fi
|
||||
[ -n "$outfile" -a "$outfile" != - ] || outfile=/dev/stdout
|
||||
|
||||
if [ -z "$thishost" -o -z "$proxy_enabled" ]; then
|
||||
# le cas échéant, lire les paramètres manquant depuis le fichier
|
||||
if [ "$infile" == /dev/stdin ]; then
|
||||
ac_set_tmpfile tmpinfile
|
||||
cat >"$tmpinfile"
|
||||
infile="$tmpinfile"
|
||||
fi
|
||||
eval "$(awkrun -f <"$infile" '
|
||||
/^[^#]/ { exit 0 }
|
||||
/^#+ *host *=/ { sub(/^#+ *host *= */, ""); sub(/ *$/, ""); print "thishost=" qval($0); next }
|
||||
/^#+ *enable_proxy *=/ { sub(/^#+ *enable_proxy *= */, ""); sub(/ *$/, ""); print "proxy_enabled=" qval($0); next }
|
||||
')"
|
||||
fi
|
||||
[ -n "$thishost" ] || thishost="$(myhost)"
|
||||
normyesval proxy_enabled
|
||||
|
||||
if [ -n "$htmlfile" ]; then
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<!-- -*- coding: utf-8 mode: html -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>'"$thishost</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>$thishost</h2>
|
||||
<ul>" >"$htmlfile"
|
||||
fi
|
||||
|
||||
ac_set_tmpfile tmpoutfile
|
||||
array_from_lines rules "$(<"$infile" filter_comment)"
|
||||
prefix=
|
||||
for rule in "${rules[@]}"; do
|
||||
if beginswith "$rule" ^; then
|
||||
# Collecter les préfixe pour la règle suivante
|
||||
prefix="${prefix:+$prefix
|
||||
}${rule#^}"
|
||||
continue
|
||||
elif beginswith "$rule" =; then
|
||||
# ligne litérale
|
||||
echo "${rule#=}" >>"$tmpoutfile"
|
||||
continue
|
||||
fi
|
||||
|
||||
local IFS=:; set -- $rule; unset IFS
|
||||
index=1
|
||||
done=
|
||||
while [ -z "$done" ]; do
|
||||
current="$1"; shift
|
||||
while [ "${current%\\}" != "$current" ]; do
|
||||
current="${current%\\}:$1"; shift
|
||||
done
|
||||
case $index in
|
||||
1) src="$current";;
|
||||
2) dest="$current";;
|
||||
3) host="$current";;
|
||||
4) suffix="$current";;
|
||||
5) options="$current";;
|
||||
6) prot="${current:-http}";;
|
||||
7) proxy_acls="$current";;
|
||||
*) done=1;;
|
||||
esac
|
||||
index=$(($index + 1))
|
||||
done
|
||||
|
||||
# mettre en forme prefix s'il est défini
|
||||
[ -n "$prefix" ] && prefix="$prefix
|
||||
"
|
||||
|
||||
[ "$thishost" == "$host" ] && host=
|
||||
|
||||
usrc="$src"
|
||||
|
||||
trail=1
|
||||
if endswith "$src" '$'; then
|
||||
trail=
|
||||
usrc="${src%$}"
|
||||
fi
|
||||
|
||||
noslash=
|
||||
if endswith "$suffix" '$'; then
|
||||
noslash=1
|
||||
suffix="${suffix%$}"
|
||||
fi
|
||||
if endswith "$dest" '$'; then
|
||||
noslash=1
|
||||
dest="${dest%$}"
|
||||
fi
|
||||
|
||||
proxy_url=
|
||||
proxy_use=
|
||||
|
||||
if endswith "$dest" .woa; then
|
||||
# lien vers une application
|
||||
if [ -n "$host" ]; then
|
||||
# sur un autre hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(__mrr_joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix")${trail:+\$1} [L${options:+,$options}]" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url __mrr_joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix"
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$tmpoutfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(__mrr_joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix" "\$1") [L${options:+,$options}]" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url __mrr_joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix/"
|
||||
fi
|
||||
else
|
||||
# sur le même hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(__mrr_joinurl /cgi-bin/WebObjects "$dest" "$suffix")${trail:+\$1} [L,P${options:+,$options}]" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url __mrr_joinurl "$prot://$thishost/cgi-bin/WebObjects" "$dest" "$suffix"
|
||||
proxy_use=1
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$tmpoutfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(__mrr_joinurl /cgi-bin/WebObjects "$dest" "$suffix" "\$1") [L,P${options:+,$options}]" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url __mrr_joinurl "$prot://$thishost/cgi-bin/WebObjects" "$dest" "$suffix/"
|
||||
proxy_use=1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# lien vers une url
|
||||
if [ -n "$host" ]; then
|
||||
# sur un autre hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(__mrr_joinurl "$prot://$host" "$dest" "$suffix")${trail:+\$1} [L${options:+,$options}]" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url __mrr_joinurl "$prot://$host" "$dest" "$suffix"
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$tmpoutfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(__mrr_joinurl "$prot://$host" "$dest" "$suffix" "\$1") [L${options:+,$options}]" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url __mrr_joinurl "$prot://$host" "$dest" "$suffix/"
|
||||
fi
|
||||
else
|
||||
# sur le même hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(__mrr_joinurl / "$dest" "$suffix")${trail:+\$1}${options:+ [$options]}" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url __mrr_joinurl "http://$thishost" "$dest" "$suffix"
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$tmpoutfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(__mrr_joinurl / "$dest" "$suffix" "\$1")${options:+ [$options]}" >>"$tmpoutfile"
|
||||
setx url __mrr_joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url __mrr_joinurl "http://$thishost" "$dest" "$suffix/"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
__mrr_has_proxy "$options" && proxy_use=1
|
||||
if [ -n "$proxy_enabled" -a -n "$proxy_use" ]; then
|
||||
if [ "$proxy_acls" == "None" ]; then
|
||||
:
|
||||
elif [ -z "$proxy_acls" ]; then
|
||||
echo "\
|
||||
<Proxy $proxy_url*>
|
||||
AddDefaultCharset off
|
||||
Order Deny,Allow
|
||||
Allow from all
|
||||
</Proxy>" >>"$tmpoutfile"
|
||||
else
|
||||
echo "\
|
||||
<Proxy $proxy_url*>
|
||||
AddDefaultCharset off
|
||||
Order Allow,Deny
|
||||
Allow from $proxy_acls
|
||||
</Proxy>" >>"$tmpoutfile"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "" >>"$tmpoutfile"
|
||||
if [ -n "$htmlfile" ]; then
|
||||
echo "<li><a href=\"$url\">$url</a></li>" >>"$htmlfile"
|
||||
fi
|
||||
|
||||
# Réinitialiser les préfixes pour chaque règle
|
||||
prefix=
|
||||
done
|
||||
|
||||
local modified
|
||||
if testupdated "$tmpoutfile" "$outfile"; then
|
||||
cat "$tmpoutfile" >"$outfile"
|
||||
modified=1
|
||||
fi
|
||||
|
||||
if [ -n "$htmlfile" ]; then
|
||||
echo '</ul>
|
||||
</body>
|
||||
</html>' >>"$htmlfile"
|
||||
fi
|
||||
|
||||
[ -n "$tmpinfile" ] && ac_clean "$tmpinfile"
|
||||
ac_clean "$tmpoutfile"
|
||||
[ -n "$modified" ]
|
||||
}
|
||||
|
|
|
@ -2464,6 +2464,7 @@ function awkdef() {
|
|||
# pour un tableau values qui contiendra deux valeurs: value1 et value2
|
||||
# Avec l'option -f, des fonctions supplémentaires sont définies. Elles sont
|
||||
# décrites dans le module awk.
|
||||
[ -z "$__ULIB_NO_DISABLE_SET_X" ] && [[ $- == *x* ]] && { set +x; local __ULIB_AWKDEF_SET_X=1; } # désactiver set -x pour cette fonction
|
||||
|
||||
if [ "${1:0:3}" == "-f" ]; then
|
||||
shift
|
||||
|
@ -2541,6 +2542,8 @@ function awkdef() {
|
|||
rawecho "$__ad_arg"
|
||||
done
|
||||
fi
|
||||
|
||||
[ -n "$__ULIB_AWKDEF_SET_X" ] && set -x; return 0
|
||||
}
|
||||
function lawkrun() {
|
||||
# wrapper pour lancer awk avec un script préparé par awkdef. Les définitions et
|
||||
|
|
|
@ -288,6 +288,8 @@ function parse_opts() {
|
|||
# flags_ contient la liste des flags pour les options: '' pour une option
|
||||
# simple, ':' pour option avec argument obligatoire, '::' pour option avec
|
||||
# argument facultatif
|
||||
[ -z "$__ULIB_NO_DISABLE_SET_X" ] && [[ $- == *x* ]] && { set +x; local __ULIB_PARSE_OPTS_SET_X=1; } # désactiver set -x pour cette fonction
|
||||
|
||||
local -a options_ names_ flags_ destargs_
|
||||
local opts_ longopts_
|
||||
__po_parse_optdescs "$@" || shift $?
|
||||
|
@ -297,8 +299,11 @@ function parse_opts() {
|
|||
__po_process_options "$@"
|
||||
else
|
||||
[ -n "$destargs_" ] && setv "$destargs_" "$args_"
|
||||
[ -n "$__ULIB_SET_X" ] && set -x
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ -n "$__ULIB_PARSE_OPTS_SET_X" ] && set -x; return 0
|
||||
}
|
||||
|
||||
function parse_args_check() {
|
||||
|
@ -308,9 +313,15 @@ function parse_args_check() {
|
|||
# Exemple d'utilisation:
|
||||
# args=(...)
|
||||
# parse_args_check "$@" || return; set -- "${args[@]}"
|
||||
parse_opts "${PRETTYOPTS[@]}" "${args[@]}" @ args -- "$@" && return 0
|
||||
[ -z "$__ULIB_NO_DISABLE_SET_X" ] && [[ $- == *x* ]] && { set +x; local __ULIB_PARSE_ARGS_SET_X=1; } # désactiver set -x pour cette fonction
|
||||
if parse_opts "${PRETTYOPTS[@]}" "${args[@]}" @ args -- "$@"; then
|
||||
[ -n "$__ULIB_PARSE_ARGS_SET_X" ] && set -x
|
||||
return 0
|
||||
else
|
||||
eerror "$args"
|
||||
[ -n "$__ULIB_PARSE_ARGS_SET_X" ] && set -x
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
function parse_args() {
|
||||
# Simplifier l'utilisation de parse_opts(). En entrée, le tableau args doit être
|
||||
|
@ -320,7 +331,9 @@ function parse_args() {
|
|||
# Exemple d'utilisation:
|
||||
# args=(...)
|
||||
# parse_args_check "$@"; set -- "${args[@]}"
|
||||
[ -z "$__ULIB_NO_DISABLE_SET_X" ] && [[ $- == *x* ]] && { set +x; local __ULIB_PARSE_ARGS_SET_X=1; } # désactiver set -x pour cette fonction
|
||||
parse_opts "${PRETTYOPTS[@]}" "${args[@]}" @ args -- "$@" || die "$args"
|
||||
[ -n "$__ULIB_PARSE_ARGS_SET_X" ] && set -x; return 0
|
||||
}
|
||||
|
||||
HELP_DESC=
|
||||
|
|
|
@ -6,24 +6,22 @@ uprovide base.num
|
|||
function isnum() {
|
||||
# retourner vrai si $1 est une valeur numérique entière (positive ou négative)
|
||||
[ ${#1} -gt 0 ] || return 1
|
||||
local v="$1"
|
||||
v="${v#-}"
|
||||
local v="${1#-}"
|
||||
[ ${#v} -gt 0 ] || return 1
|
||||
v="${v//[0-9]/}"
|
||||
[ -z "$v" ]
|
||||
}
|
||||
function ispnum() {
|
||||
# retourner vrai si $1 est une valeur numérique entière positive
|
||||
[ ${#1} -gt 0 ] || return 1
|
||||
local v="$1"
|
||||
v="${v//[0-9]/}"
|
||||
[ -z "$v" ]
|
||||
[ -z "${1//[0-9]/}" ]
|
||||
}
|
||||
function isrnum() {
|
||||
# retourner vrai si $1 est une valeur numérique réelle (positive ou négative)
|
||||
# le séparateur décimal peut être . ou ,
|
||||
[ ${#1} -gt 0 ] || return 1
|
||||
local v="$1"
|
||||
v="${v#-}"
|
||||
local v="${1#-}"
|
||||
[ ${#v} -gt 0 ] || return 1
|
||||
v="${v//./}"
|
||||
v="${v//,/}"
|
||||
v="${v//[0-9]/}"
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
uprovide base.string
|
||||
urequire base.core
|
||||
|
||||
# IMPORTANT: aucune des fonctions suivantes ne met en échappement les valeur des
|
||||
# patterns. Ainsi, si un pattern contient des caractères interdits comme \ ou $,
|
||||
# il faut d'abord le traiter avec _qval()
|
||||
|
||||
function straddp() {
|
||||
# ajouter le préfixe $1 à $2*
|
||||
local p="$1"; shift
|
||||
|
|
137
lib/ulib/debian
137
lib/ulib/debian
|
@ -176,20 +176,40 @@ function network_fix_confbrs() {
|
|||
|
||||
function __network_fix_confips() {
|
||||
local -a confips ipsuffixes ifaces ips
|
||||
local confip iface gateway ip suffix mainip
|
||||
local confip iface gateway network ip suffix mainip
|
||||
|
||||
local mainiface="$1"
|
||||
|
||||
# recenser les interfaces et créer les tableaux __IFACE_ipspecs
|
||||
for confip in "${__nfc_confips[@]}"; do
|
||||
network_parse_confip "$confip" iface gateway ipsuffixes
|
||||
[ -n "$iface" ] || iface="$mainiface"
|
||||
array_addu ifaces "$iface"
|
||||
eval "local ${iface}_gateway; local -a ${iface}_ipsuffixes"
|
||||
if [ -n "$iface" ]; then
|
||||
network="${iface}_network"
|
||||
if ! array_contains ifaces "$iface"; then
|
||||
array_add ifaces "$iface"
|
||||
eval "local ${iface}_gateway $network; local -a ${iface}_ipsuffixes"
|
||||
fi
|
||||
if [ -z "${!network}" -a -n "${ipsuffixes[0]}" ]; then
|
||||
setv "$network" "$(ipcalc_network "${ipsuffixes[0]}")"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# puis construire la liste des adresses IP associées à chaque interface
|
||||
for confip in "${__nfc_confips[@]}"; do
|
||||
network_parse_confip "$confip" iface gateway ipsuffixes
|
||||
# si aucune interface n'est spécifiée, sélectionner celle correspondant
|
||||
# à la même adresse de réseau. sinon prendre $mainiface
|
||||
if [ -z "$iface" ]; then
|
||||
network="$(ipcalc_network "${ipsuffixes[0]}")"
|
||||
local ip_iface ip_network
|
||||
for ip_iface in "${ifaces[@]}"; do
|
||||
ip_network="${ip_iface}_network"
|
||||
if [ "${!ip_network}" == "$network" ]; then
|
||||
iface="$ip_iface"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
[ -n "$iface" ] || iface="$mainiface"
|
||||
# si la passerelle a déjà été spécifiée, la récupérer
|
||||
local tmpgw="${iface}_gateway"
|
||||
|
@ -356,6 +376,7 @@ function __network_set_confips() {
|
|||
array_from_lines ifaces "$(__network_valid_ifaces)"
|
||||
for iface in "${ifaces[@]}"; do
|
||||
__network_set_gateway "$iface"
|
||||
[ -n "$gateway" ] || gateway=-
|
||||
__network_set_confip "$iface" "$gateway" || continue
|
||||
array_add confips "$confip"
|
||||
done
|
||||
|
@ -462,6 +483,7 @@ BEGIN {
|
|||
have_iface = 0
|
||||
have_method = 0 # static ou dhcp
|
||||
have_gateway = ipsuffixes[1] == "dhcp" || gateway == ""
|
||||
if (gateway == "none" || gateway == "-") gateway = ""
|
||||
array_new(have_ips)
|
||||
array_new(have_ip_ups)
|
||||
array_new(have_ip_downs)
|
||||
|
@ -692,6 +714,8 @@ function network_interfaces_add_confip() {
|
|||
local nifile="${4:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
local mainip netmask method
|
||||
|
||||
[ "$gateway" == "none" -o "$gateway" == "-" ] && gateway=
|
||||
|
||||
network_parse_ipsuffix "${ipsuffixes[0]}" mainip netmask
|
||||
if [ "$mainip" == "dhcp" ]; then
|
||||
mainip=
|
||||
|
@ -928,7 +952,9 @@ $ip$TAB$host $hostname" "$tmpfile"
|
|||
}
|
||||
|
||||
function network_config() {
|
||||
# (Re)configurer le réseau sur l'hôte courant.
|
||||
# (Re)configurer le réseau sur l'hôte courant. Des efforts sont faits pour
|
||||
# ne mettre à jour les fichiers que si c'est nécessaire. Si un des arguments
|
||||
# $1..$6 n'est pas spécifié, il est ignoré.
|
||||
# $1 (host) est le nom d'hôte.
|
||||
# $2 (confips) est le nom d'un tableau contenant la configuration des
|
||||
# adresses ips pour les interfaces.
|
||||
|
@ -939,9 +965,12 @@ function network_config() {
|
|||
# son interface. En principe, l'interface principale est le premier bridge
|
||||
# défini ou la première interface définie.
|
||||
# $5 (reset_interfaces) spécifie de ne pas chercher à mettre à jour le
|
||||
# fichier /etc/network/interfaces, mais de le recréer depuis zéro.
|
||||
# fichier /etc/network/interfaces, mais de le recréer depuis zéro. la valeur
|
||||
# 'force' spécifie de recréer le fichier même si ce n'est pas nécessaire à
|
||||
# priori.
|
||||
# $6 (oldhost) est le nom d'hôte actuel, avant la modification
|
||||
# Si un des arguments n'est pas spécifié, il est ignoré.
|
||||
# $7(=/etc/network/interfaces) est le fichier à mettre à jour
|
||||
#
|
||||
# Le tableau confips doit contenir des définitions d'une des formes
|
||||
# suivantes:
|
||||
# [[iface][//gateway]:]address[/suffix],...
|
||||
|
@ -952,6 +981,7 @@ function network_config() {
|
|||
# interface, seule la première spécification d'adresse IP tient compte de
|
||||
# l'argument gateway. Les autres spécifications définissent des adresses IP
|
||||
# supplémentaires pour l'interface.
|
||||
#
|
||||
# Le tableau brs doit contenir des définitions de la forme suivante:
|
||||
# br:ifaces,...
|
||||
# br est le nom du bridge, e.g. br0. ifaces est une liste d'interfaces
|
||||
|
@ -967,6 +997,7 @@ function network_config() {
|
|||
local -a confbrs; array_copy confbrs __nc_confbrs
|
||||
local mainiface="$4" reset_interfaces="$5" oldhost="$6"
|
||||
local modified
|
||||
local nifile="${7:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
|
||||
network_fix_confs confbrs confips "$mainiface"
|
||||
|
||||
|
@ -1001,6 +1032,8 @@ function network_config() {
|
|||
|
||||
# vérifier si une modification est nécessaire
|
||||
local modify
|
||||
[ "$reset_interfaces" == force ] && modify=1
|
||||
if [ -z "$modify" ]; then
|
||||
for confbr in "${confbrs[@]}"; do
|
||||
network_parse_confbr "$confbr" br ifaces
|
||||
if ! network_interfaces_check_confbr "$br" iface; then
|
||||
|
@ -1008,6 +1041,7 @@ function network_config() {
|
|||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ -z "$modify" ]; then
|
||||
for confip in "${confips[@]}"; do
|
||||
network_parse_confip "$confip" iface gateway ipsuffixes
|
||||
|
@ -1022,13 +1056,17 @@ function network_config() {
|
|||
if [ -n "$modify" ]; then
|
||||
# faire une copie de travail
|
||||
local interfaces; ac_set_tmpfile interfaces
|
||||
cat "$__DEBIAN_NETWORK_INTERFACES" >"$interfaces"
|
||||
cat "$nifile" >"$interfaces"
|
||||
|
||||
if [ -n "$reset_interfaces" ]; then
|
||||
local source_itfd
|
||||
check_sysinfos -d debian -v jessie+ && source_itfd=1
|
||||
echo >"$interfaces" "\
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
${source_itfd:+
|
||||
source /etc/network/interfaces.d/*
|
||||
}
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
@ -1059,21 +1097,21 @@ iface lo inet loopback
|
|||
|
||||
# Fin de traitement
|
||||
if [ -n "$__DEBIAN_NETWORK_DEVEL_SHOW_MODIFS" ]; then
|
||||
if testdiff "$interfaces" "$__DEBIAN_NETWORK_INTERFACES"; then
|
||||
uecho "Setting $__DEBIAN_NETWORK_INTERFACES to:"
|
||||
if testdiff "$interfaces" "$nifile"; then
|
||||
uecho "Setting $nifile to:"
|
||||
cat "$interfaces" | sed 's/^/ /g' 1>&2
|
||||
else
|
||||
uecho "$__DEBIAN_NETWORK_INTERFACES: pas de modifications"
|
||||
uecho "$nifile: pas de modifications"
|
||||
fi
|
||||
elif testdiff "$interfaces" "$__DEBIAN_NETWORK_INTERFACES"; then
|
||||
__network_backup "$__DEBIAN_NETWORK_INTERFACES"
|
||||
elif testdiff "$interfaces" "$nifile"; then
|
||||
__network_backup "$nifile"
|
||||
if show_debug; then
|
||||
edebug "Setting $__DEBIAN_NETWORK_INTERFACES to:"
|
||||
edebug "Setting $nifile to:"
|
||||
cat "$interfaces" | sed 's/^/ /g' 1>&2
|
||||
else
|
||||
estep "$__DEBIAN_NETWORK_INTERFACES"
|
||||
estep "$nifile"
|
||||
fi
|
||||
cat "$interfaces" >"$__DEBIAN_NETWORK_INTERFACES"
|
||||
cat "$interfaces" >"$nifile"
|
||||
modified=1
|
||||
fi
|
||||
ac_clean "$interfaces"
|
||||
|
@ -1112,3 +1150,68 @@ iface lo inet loopback
|
|||
[ -z "$modified" ] && return 10
|
||||
return 0
|
||||
}
|
||||
|
||||
function network_config_partial() {
|
||||
# une version allégée de network_config() qui ne permet que de rajouter des
|
||||
# adresses IPs en plus de celles qui sont déjà configurées.
|
||||
# $1(=confips) est le nom d'un tableau contenant la configuration des
|
||||
# adresses ips pour les interfaces.
|
||||
# $2(=/etc/network/interfaces) est le fichier à mettre à jour
|
||||
local -a __ncp_newconfips; array_copy __ncp_newconfips "${1:-confips}"
|
||||
local nifile="${2:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
|
||||
local -a confips confbrs
|
||||
network_set_confips
|
||||
network_set_confbrs
|
||||
network_fix_confs
|
||||
|
||||
array_extend confips __ncp_newconfips
|
||||
network_config "" confips confbrs "" "" "" "$nifile" || return
|
||||
|
||||
# des modifications ont eu lieu, tenter de configurer les nouvelles adresses
|
||||
# d'abord calculer les adresses ips qui sont activées
|
||||
network_set_confips
|
||||
local -a ips
|
||||
local ipsuffix ip suffix
|
||||
for confip in "${confips[@]}"; do
|
||||
network_parse_confip "$confip" iface gateway ipsuffixes
|
||||
for ipsuffix in "${ipsuffixes[@]}"; do
|
||||
network_parse_ipsuffix "$ipsuffix" ip suffix
|
||||
array_addu ips "$ip"
|
||||
done
|
||||
done
|
||||
# puis lister les commandes correspondant aux adresses ips non activées
|
||||
local -a ups; local up
|
||||
array_from_lines ups "$(awkrun <"$nifile" -f ips[@] '
|
||||
$1 == "up" && $2 == "ip" && $3 == "addr" && $4 == "add" {
|
||||
ip = $5; sub(/(\/[0-9.]+)?$/, "", ip) # enlever suffixe
|
||||
if (! in_array(ip, ips)) {
|
||||
$1 = ""
|
||||
print
|
||||
}
|
||||
}')"
|
||||
if [ ${#ups[*]} -gt 0 ]; then
|
||||
etitle "Configuration des nouvelles adresses"
|
||||
for up in "${ups[@]}"; do
|
||||
estep "$up"
|
||||
eval "$up"
|
||||
done
|
||||
eend
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function network_update_etc_networks() {
|
||||
# écraser le contenu du fichier /etc/networks avec la chaine $1
|
||||
# si $1 est vide, initialiser le fichier avec un contenu par défaut.
|
||||
local contents="$1" TAB=$'\t'
|
||||
[ -n "$contents" ] || contents="\
|
||||
default${TAB}${TAB}0.0.0.0
|
||||
loopback${TAB}127.0.0.0
|
||||
link-local${TAB}169.254.0.0"
|
||||
if [ "$(</etc/networks)" != "$contents" ]; then
|
||||
__network_backup /etc/networks
|
||||
echo "$contents" >/etc/networks
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -83,6 +83,32 @@ function ipcalc_netmask() {
|
|||
return 0
|
||||
}
|
||||
|
||||
function ipcalc_network() {
|
||||
# Calculer l'adresse de réseau correspondant à l'adresse ip $1. Le masque
|
||||
# de sous-réseau peut-être indiqué dans l'adresse ip avec le suffixe /n ou
|
||||
# /x.x.x.x ou donné dans l'argument $2. Seuls les suffixes 0, 8, 16, 24, 32
|
||||
# sont supportés.
|
||||
# Retourner 1 si un erreur s'est produite, par exemple si l'adresse ou le
|
||||
# suffixe sont invalides ou non supportés.
|
||||
[ -n "$1" ] || return
|
||||
local ip mask
|
||||
|
||||
ipcalc_splitipmask "$1" ip mask
|
||||
[ -n "$mask" ] || mask="$2"
|
||||
[ -n "$mask" ] || mask=24
|
||||
|
||||
ip="$(ipcalc_checkip "$ip")" || return
|
||||
mask="$(ipcalc_checkmask "$mask")" || return
|
||||
|
||||
case "$mask" in
|
||||
0) echo "0.0.0.0";;
|
||||
8) ip="${ip%.*.*.*}"; echo "$ip.0.0.0";;
|
||||
16) ip="${ip%.*.*}"; echo "$ip.0.0";;
|
||||
24) ip="${ip%.*}"; echo "$ip.0";;
|
||||
32) echo "$ip";;
|
||||
esac
|
||||
}
|
||||
|
||||
function ipcalc_broadcast() {
|
||||
# Calculer l'adresse de broadcast correspondant à l'adresse ip $1. Le masque
|
||||
# de sous-réseau peut-être indiqué dans l'adresse ip avec le suffixe /n ou
|
||||
|
|
|
@ -888,8 +888,7 @@ function runs_initworkdir() {
|
|||
>"$RUNSEXPORTDIR/varsfile"
|
||||
>"$RUNSEXPORTDIR/localuser"
|
||||
>"$RUNSEXPORTDIR/localroot"
|
||||
>"$RUNSEXPORTDIR/remoteuser"
|
||||
>"$RUNSEXPORTDIR/remoteroot"
|
||||
>"$RUNSEXPORTDIR/remote"
|
||||
|
||||
# synchronisation ulib
|
||||
# comme on copie runs et uinst, il faut copier ulib et pyulib comme pour nutools: dans le répertoire lib/
|
||||
|
@ -917,6 +916,7 @@ exit 0
|
|||
cd "$(dirname "$0")"
|
||||
'"$args_def"'
|
||||
if [ -s remote ]; then
|
||||
export RUNS_REMOTE_SET_Y=1
|
||||
[ -f remote-needs-root ] && args=("${args[@]}" -s)
|
||||
"${args[@]}" -r remote || exit 1
|
||||
fi
|
||||
|
@ -1628,6 +1628,13 @@ function runs_action_run() {
|
|||
__vars=("${__vars[@]}" "$(set_var_cmd "$__name" "$__value")")
|
||||
done
|
||||
|
||||
if [ -n "$RUNS_REMOTE_SET_Y" ]; then
|
||||
# par défaut, sur l'hôte distant, utiliser un niveau
|
||||
# d'interaction plus bas que runs
|
||||
# ainsi, (rruns) ==> (uinst -y) et (rruns -i) ==> (uinst)
|
||||
set_interaction -y
|
||||
fi
|
||||
|
||||
urequire uinst udir prefixes uinc
|
||||
# Il faut définir UINST, chemin vers le script uinst.
|
||||
UINST="$RUNSSRCDIR/uinst"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -419,15 +419,42 @@ function template_srcdir() {
|
|||
fi
|
||||
}
|
||||
|
||||
function template_build_vars() {
|
||||
# Initialiser les tableaux $1 et $2 avec la description des variables $3..@
|
||||
# les descriptions sont de la forme var[:depvars,...]=desc
|
||||
# $1 reçoit les noms (depvars... var) parce que les variables dépendantes
|
||||
# doivent toujours être placées AVANT la variable maitre
|
||||
# $2 reçoit les noms (depvars...)
|
||||
# pour chaque description, une variable __TEMPLATE_DESC_var est créée avec
|
||||
# la valeur desc
|
||||
local __t_destvs="$1"; shift
|
||||
local __t_destnw="$1"; shift
|
||||
local -a __t_depvars
|
||||
local __t_vardesc __t_var __t_depvar __t_desc
|
||||
for __t_vardesc in "$@"; do
|
||||
splitvar "$__t_vardesc" __t_depvar __t_desc
|
||||
splitpair "$__t_depvar" __t_var __t_depvar
|
||||
array_split __t_depvars "$__t_depvar" ,
|
||||
for __t_depvar in "${__t_depvars[@]}"; do
|
||||
array_addu "$__t_destvs" "$__t_depvar"
|
||||
[ -n "$__t_destnw" ] && array_addu "$__t_destnw" "$__t_depvar"
|
||||
done
|
||||
array_del "$__t_destvs" "$__t_var"
|
||||
array_add "$__t_destvs" "$__t_var"
|
||||
eval "__TEMPLATE_DESC_$__t_var=\"\$__t_desc\""
|
||||
done
|
||||
}
|
||||
|
||||
function templatectl_config() {
|
||||
# Obtenir le chemin vers le fichier de configuration pour le répertoire $1
|
||||
# Si $2==nohideconfig, utiliser le nom CONFIG.conf, sinon utiliser par défaut
|
||||
# .CONFIG sauf si le fichier CONFIG.conf existe
|
||||
# Obtenir le chemin vers le fichier de configuration pour le répertoire $1 Si
|
||||
# l'un des fichiers CONFIG.conf ou .CONFIG existent déjà, prendre ceux-là.
|
||||
# Sinon, si $2==nohideconfig, utiliser le nom CONFIG.conf, sinon utiliser
|
||||
# .CONFIG
|
||||
local config="$(basename -- "$TEMPLATECTL_CONFIG")"
|
||||
if [ -f "$1/$config.conf" -o "$2" == nohideconfig ]; then
|
||||
echo "$1/$config.conf"
|
||||
else
|
||||
echo "$1/.$config"
|
||||
if [ -f "$1/$config.conf" ]; then echo "$1/$config.conf"
|
||||
elif [ -f "$1/.$config" ]; then echo "$1/.$config"
|
||||
elif [ "$2" == nohideconfig ]; then echo "$1/$config.conf"
|
||||
else echo "$1/.$config"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -449,6 +476,8 @@ function templatectl_loadvars() {
|
|||
# devraient pas être écrits dans le fichier des variables, sauf si elles
|
||||
# reçoivent une valeur explicite de la part de l'utilisateur. Ce tableau est
|
||||
# mis à jour lors de l'analyse du tableau TEMPLATECTL_VARS
|
||||
# - TEMPLATE_USER_VARS contient une liste de noms de tableaux qui sont définis
|
||||
# en plus et qui peuvent être utilisés par des scripts annexes
|
||||
local -a __template_vars __dynamic_vars
|
||||
local __t_var __t_name __t_value
|
||||
|
||||
|
@ -469,6 +498,11 @@ function templatectl_loadvars() {
|
|||
done
|
||||
array_contains TEMPLATE_DYNAMIC_VARS configdir && __template_set_var configdir "$configdir"
|
||||
|
||||
is_defined TEMPLATE_USER_VARS || TEMPLATE_USER_VARS=()
|
||||
for __t_var in "${TEMPLATE_USER_VARS[@]}"; do
|
||||
is_defined "$__t_var" || array_new "$__t_var"
|
||||
done
|
||||
|
||||
local __t_modified=1
|
||||
for __t_var in "${TEMPLATECTL_VARS[@]}"; do
|
||||
splitvar "$__t_var" __t_name __t_value
|
||||
|
@ -479,20 +513,33 @@ function templatectl_loadvars() {
|
|||
|
||||
function templatectl_writevars() {
|
||||
# Ecrire les variables dans le fichier $1
|
||||
local __t_var
|
||||
local __t_var __t_desc
|
||||
echo "# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8" >"$1"
|
||||
for __t_var in "${TEMPLATE_USER_VARS[@]}"; do
|
||||
__t_desc="__TEMPLATE_DESC_$__t_var"
|
||||
[ -n "${!__t_desc}" ] && echo "# ${!__t_desc}" >>"$1"
|
||||
if is_array "$__t_var"; then
|
||||
set_array_cmd "$__t_var" >>"$1"
|
||||
else
|
||||
echo_setv "$__t_var" "${!__t_var}" >>"$1"
|
||||
fi
|
||||
done
|
||||
if [ ${#TEMPLATE_DYNAMIC_VARS[*]} -gt 0 ]; then
|
||||
echo "__dynamic_vars=(" >>"$1"
|
||||
for __t_var in "${TEMPLATE_DYNAMIC_VARS[@]}"; do
|
||||
array_contains TEMPLATE_NOWRITE_VARS "$__t_var" && continue
|
||||
echo_setv "$__t_var=${!__t_var}" >>"$1"
|
||||
__t_desc="__TEMPLATE_DESC_$__t_var"
|
||||
[ -n "${!__t_desc}" ] && echo "# ${!__t_desc}" >>"$1"
|
||||
echo_setv "$__t_var" "${!__t_var}" >>"$1"
|
||||
done
|
||||
echo ")" >>"$1"
|
||||
fi
|
||||
echo "__template_vars=(# ne pas modifier" >>"$1"
|
||||
for __t_var in "${TEMPLATE_STATIC_VARS[@]}"; do
|
||||
array_contains TEMPLATE_NOWRITE_VARS "$__t_var" && continue
|
||||
echo_setv "$__t_var=${!__t_var}" >>"$1"
|
||||
__t_desc="__TEMPLATE_DESC_$__t_var"
|
||||
[ -n "${!__t_desc}" ] && echo "# ${!__t_desc}" >>"$1"
|
||||
echo_setv "$__t_var" "${!__t_var}" >>"$1"
|
||||
done
|
||||
echo ")" >>"$1"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# -*- coding: utf-8 mode: text -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
Ce répertoire peut contenir les fichiers et répertoires suivants, qui sont tous
|
||||
optionnels:
|
||||
|
||||
confs.conf
|
||||
Liste des configurations qu'il faut activer. Si un fichier de configuration
|
||||
existe mais n'est pas mentionnée dans ce fichier, ou si ce fichier n'existe
|
||||
pas, aucune modification n'est effectuée. Ce fichier contient une liste de
|
||||
ligne de configuration.
|
||||
Si une configuration est de la forme -conf, elle est désactivée. Si une
|
||||
configuration est de la forme +conf, elle est activée. Cette syntaxe permet
|
||||
de supporter les configurations dont le nom commencerait par '-'
|
||||
IMPORTANT: Ce fichier n'est supporté qu'à partir de debian jessie.
|
||||
|
||||
modules.conf
|
||||
Liste des modules qu'il faut activer. Si un module existe mais n'est pas
|
||||
mentionné dans ce fichier, ou si ce fichier n'existe pas, aucune
|
||||
modification n'est effectuée.
|
||||
Si un module est de la forme -module, il est désactivé. Si un module est de
|
||||
la forme +module, il est activé. Cette syntaxe permet de supporter les
|
||||
modules dont le nom commencerait par '-'
|
||||
|
||||
sites.conf
|
||||
Liste des sites qu'il faut activer. Si ce fichier n'existe pas, tous les
|
||||
sites existant sont activés. Si un site existe mais ne figure pas dans ce
|
||||
fichier, il est désactivé.
|
||||
|
||||
confs/
|
||||
Répertoire des configurations à installer. Les fichiers de ce répertoire
|
||||
sont de la forme CONF.conf et sont installés dans le répertoire
|
||||
/etc/apache2/conf-available. Il faut mentionner la configuration dans le
|
||||
fichier confs.conf pour l'activer.
|
||||
IMPORTANT: Ce répertoire n'est supporté qu'à partir de debian jessie.
|
||||
|
||||
modules/
|
||||
Répertoire des configurations de modules à installer. Les fichiers de ce
|
||||
répertoire sont de la forme MODULE.conf et sont installés dans le répertoire
|
||||
/etc/apache2/mods-available. Il faut mentioner le module dans le fichier
|
||||
modules.conf pour l'activer.
|
||||
|
||||
sites/
|
||||
Répertoire des sites à installer. Les fichiers de ce répertoire sont de la
|
||||
forme SITE.conf pour les sites écoutant en clair, et SITE.ssl.conf pour les
|
||||
sites écoutant en https.
|
||||
Pour chaque site SITE.ssl.conf, un fichier SITE-certs.conf doit exister dans
|
||||
certsconf/. Pour chaque fichier SITE.ssl.conf, les balises @@ca@@, @@cert@@
|
||||
et @@key@@ sont remplacés par les valeurs des variables ca, cert et key
|
||||
définies dans le fichier correspondant SITE-certs.conf
|
||||
|
||||
cgi-bin/
|
||||
Répertoire des scripts cgi
|
||||
|
||||
www/
|
||||
Répertoire des fichiers du serveur web
|
||||
|
||||
certsconf/
|
||||
Répertoire qui contient la configuration pour les certificats à installer.
|
||||
Les fichiers de ce répertoire sont de la forme SITE-certs.conf et chacun
|
||||
d'eux correspond à un fichier SITE.ssl.conf dans sites/
|
||||
|
||||
RewriteRules/
|
||||
Répertoire qui contient la configuration de réécriture. Tous les fichiers
|
||||
RewriteRules*.conf de ce répertoire sont copiés dans /etc/apache2
|
||||
|
||||
Tous les autres fichiers sont copiés tels quels dans /etc/apache2. Notamment,
|
||||
apache2.conf est le fichier de configuration principal d'apache et ports.conf le
|
||||
fichier de configuration des ports d'écoute.
|
||||
|
||||
## Configuration TLS
|
||||
|
||||
Le site https://mozilla.github.io/server-side-tls/ssl-config-generator/ contient
|
||||
des informations sur la façon de configurer ssl côté serveur pour la sécurité et
|
||||
les navigateurs modernes
|
||||
|
||||
Voir les détails sur https://wiki.mozilla.org/Security/Server_Side_TLS
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
# Cette variable est utilisée par la fonction refcerts() du script runs. C'est
|
||||
# le nom d'un répertoire à chercher dans RUNSMODULESPATH qui contient les
|
||||
# certificats à installer sur le serveur.
|
||||
certsdir=@@certsdir@@
|
||||
|
||||
# Fichier contenant les certificats racines qui valident le certificat à
|
||||
# installer, ainsi que les certificats qui sont rencontrés dans le dialogue avec
|
||||
# d'autres serveurs web
|
||||
ca=@@caname@@
|
||||
|
||||
# Certificat et clé privée à installer
|
||||
cert=
|
||||
key=
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Utiliser 'udir --help-vars' pour une description de la signification des
|
||||
# variables suivantes:
|
||||
udir_desc="Fichiers à déployer sur @@host@@ dans le répertoire des cgi-bins"
|
||||
udir_note="Il est possible de déployer les modifications dans ce répertoire avec 'uinst -y'"
|
||||
udir_types=(uinst:rsync)
|
||||
uinc=release
|
||||
uinc_options=()
|
||||
uinc_args=()
|
||||
configure_variables=(dest)
|
||||
configure_dest_for=()
|
||||
config_scripts=()
|
||||
install_profiles=false
|
||||
workdir_rsync_options=()
|
||||
workdir_excludes=()
|
||||
workdir_includes=()
|
||||
copy_files=true
|
||||
rsync_options=()
|
||||
destdir=root@@@host@@:CGIBINDIR
|
||||
srcdir=.
|
||||
files=()
|
||||
owner=root:
|
||||
modes=(u=rwX,g=rX,o=rX)
|
||||
root_scripts=()
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
echo "Content-Type: text/plain"
|
||||
echo ""
|
||||
echo "OK"
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
<IfModule mod_ssl.c>
|
||||
# cf https://wiki.mozilla.org/Security/Server_Side_TLS
|
||||
|
||||
# Choisir un des profils. Clients les plus anciens pouvant se connecter:
|
||||
# modern: Firefox 27, Chrome 30, Windows 7 IE 11, Edge, Opera 17, Safari 9, Android 5.0, Java 8
|
||||
# intermediate: Firefox 1, Chrome 1, IE 7, Opera 5, Safari 1, Windows XP IE8, Android 2.3, Java 7
|
||||
# old: Windows XP IE6, Java 6
|
||||
#Define SSL_CONFIG_MODERN
|
||||
#Define SSL_CONFIG_INTERMEDIATE
|
||||
#Define SSL_CONFIG_OLD
|
||||
|
||||
# Faut-il activer HSTS?
|
||||
#Define SSL_CONFIG_HSTS
|
||||
</IfModule>
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Liste des modules à activer. Syntaxe:
|
||||
# module ou +module pour activer un module
|
||||
# -module pour le désactiver
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Configuration du réseau sur le serveur. Ce fichier est traité différemment
|
||||
# selon le mode de configuration.
|
||||
# - En mode complet, ce fichier définit le nom d'hôte ainsi que toutes les
|
||||
# interfaces, ponts et adresses. La variable host et les tableaux ips et brs
|
||||
# sont pris en compte.
|
||||
# - En mode partiel, seuls le tableau ips est pris en compte: il est utilisé
|
||||
# pour définir des adresses ips supplémentaires à configurer sur le serveur.
|
||||
|
||||
# Liste des adresses IPs à configurer. Chaque élément est de la forme
|
||||
# [IFACE:]dhcp ou [[IFACE][//GATEWAY]:]IP[/SUFFIX]
|
||||
ips=()
|
||||
|
||||
# Liste des ponts à configurer. Chaque élément est de la forme BR:IFACES
|
||||
# BR est le nom du pont, e.g. br0. IFACES est une liste d'interfaces séparées
|
||||
# par une virgule. e.g. br0:eth0,eth1
|
||||
brs=()
|
||||
|
||||
# Nom d'hôte pleinement qualifié. Si ce paramètre est spécifié, les fichiers
|
||||
# /etc/hosts, /etc/hostname et /etc/mailname sont mis à jour.
|
||||
host=
|
||||
|
||||
# Contenu du fichier /etc/networks
|
||||
etc_networks=
|
|
@ -7,16 +7,8 @@ Listen 80
|
|||
|
||||
<IfModule ssl_module>
|
||||
Listen 443
|
||||
#NameVirtualHost IP:443
|
||||
#Listen IP:443
|
||||
#@@ips_namevirtualhosts@@
|
||||
#@@ips_listens@@
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
Listen 443
|
||||
#NameVirtualHost IP:443
|
||||
#Listen IP:443
|
||||
#@@ips_namevirtualhosts@@
|
||||
#@@ips_listens@@
|
||||
</IfModule>
|
|
@ -0,0 +1,2 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Liste des sites à activer. Syntaxe:
|
||||
# site ou +site pour activer un site
|
||||
# -site pour le désactiver
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Liste de paquets système à installer, e.g. php5 ou libapache2-mod-jk
|
||||
# Chaque package doit être indiqué sur une ligne à part
|
||||
#libapache2-mod-jk
|
||||
#libapache2-mod-auth-cas
|
||||
#php5-mysql
|
||||
#php5-ldap
|
||||
#php5-gmp
|
||||
#php5-gd
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
# Cette variable est utilisée par la fonction refcerts() du script runs. C'est
|
||||
# le nom d'un répertoire à chercher dans RUNSMODULESPATH qui contient les
|
||||
# certificats à installer sur le serveur.
|
||||
certsdir=@@certsdir@@
|
||||
|
||||
# Fichier contenant les certificats racines qui valident le certificat à
|
||||
# installer, ainsi que les certificats qui sont rencontrés dans le dialogue avec
|
||||
# d'autres serveurs web
|
||||
ca=@@caname@@
|
||||
|
||||
# Certificat et clé privée à installer
|
||||
cert=
|
||||
key=
|
|
@ -0,0 +1,31 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:syntax=apache:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
ServerName SITE.TLD
|
||||
ServerAlias SITE SITE.local
|
||||
ServerAdmin @@admin@@
|
||||
|
||||
DocumentRoot /var/www/SITE
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/SITE_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/SITE_access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
</VirtualHost>
|
|
@ -1,54 +1,27 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
# -*- coding: utf-8 mode: conf -*- vim:syntax=apache:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
<IfModule mod_ssl.c>
|
||||
<VirtualHost _default_:443>
|
||||
ServerName @@host@@
|
||||
ServerAlias @@aliases@@
|
||||
ServerName SITE.TLD
|
||||
ServerAlias SITE SITE.local
|
||||
ServerAdmin @@admin@@
|
||||
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
DocumentRoot /var/www/SITE
|
||||
|
||||
# Pour les serveurs qui ont le module mod_WebObjects:
|
||||
# mod_WebObjects et ScriptAlias ne peuvent pas gérer le même préfixe. Pour
|
||||
# utiliser des cgi-bin avec WebObjects, il faut soit changer le préfixe de
|
||||
# ScriptAlias, soit changer le préfixe de WebObjectsAlias dans le fichier
|
||||
# mod-webobjects.conf
|
||||
# Sinon, il suffit de commenter les lignes suivantes:
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/ssl_error.log
|
||||
ErrorLog ${APACHE_LOG_DIR}/SITE_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/SITE_access.log combined
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
|
||||
|
||||
<LocationMatch "/cgi-bin/WebObjects/.*">
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</LocationMatch>
|
||||
|
||||
<Location /WebObjects>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
|
||||
# SSL Engine Switch:
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
|
@ -56,7 +29,7 @@
|
|||
|
||||
# A self-signed (snakeoil) certificate can be created by installing
|
||||
# the ssl-cert package. See
|
||||
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||
# /usr/share/doc/apache2/README.Debian.gz for more info.
|
||||
# If both key and certificate are stored in the same file, only the
|
||||
# SSLCertificateFile directive is needed.
|
||||
SSLCertificateFile @@cert@@
|
||||
|
@ -99,21 +72,6 @@
|
|||
#SSLVerifyClient require
|
||||
#SSLVerifyDepth 10
|
||||
|
||||
# Access Control:
|
||||
# With SSLRequire you can do per-directory access control based
|
||||
# on arbitrary complex boolean expressions containing server
|
||||
# variable checks and other lookup directives. The syntax is a
|
||||
# mixture between C and Perl. See the mod_ssl documentation
|
||||
# for more details.
|
||||
#<Location />
|
||||
#SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
|
||||
# and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
|
||||
# and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
|
||||
# and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
|
||||
# and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
|
||||
# or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
|
||||
#</Location>
|
||||
|
||||
# SSL Engine Options:
|
||||
# Set various options for the SSL engine.
|
||||
# o FakeBasicAuth:
|
||||
|
@ -134,10 +92,6 @@
|
|||
# because the extraction step is an expensive operation and is usually
|
||||
# useless for serving static content. So one usually enables the
|
||||
# exportation for CGI and SSI requests only.
|
||||
# o StrictRequire:
|
||||
# This denies access when "SSLRequireSSL" or "SSLRequire" applied even
|
||||
# under a "Satisfy any" situation, i.e. when it applies access is denied
|
||||
# and no other module can change it.
|
||||
# o OptRenegotiate:
|
||||
# This enables optimized SSL connection renegotiation handling when SSL
|
||||
# directives are used in per-directory context.
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Utiliser 'udir --help-vars' pour une description de la signification des
|
||||
# variables suivantes:
|
||||
udir_desc="Fichiers à déployer dans le répertoire des documents web"
|
||||
udir_note="Il est possible de déployer les modifications dans ce répertoire avec 'uinst -y'"
|
||||
udir_types=(uinst:rsync)
|
||||
uinc=release
|
||||
uinc_options=()
|
||||
uinc_args=()
|
||||
configure_variables=(dest)
|
||||
configure_dest_for=()
|
||||
config_scripts=()
|
||||
install_profiles=false
|
||||
workdir_rsync_options=()
|
||||
workdir_excludes=()
|
||||
workdir_includes=()
|
||||
copy_files=true
|
||||
rsync_options=(--delete-after)
|
||||
destdir=root@@@host@@:HTDOCSBASE/SITE
|
||||
srcdir=.
|
||||
files=()
|
||||
owner=www-data:
|
||||
modes=(u=rwX,g=rX,o=rX)
|
||||
root_scripts=()
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -0,0 +1,17 @@
|
|||
worker.list=prod,dev
|
||||
|
||||
worker.prod.port=8009
|
||||
worker.prod.host=@@prod_host@@
|
||||
worker.prod.type=ajp13
|
||||
worker.prod.lbfactor=1
|
||||
worker.prod.connection_pool_timeout=600
|
||||
worker.prod.socket_keepalive=1
|
||||
worker.prod.socket_timeout=60
|
||||
|
||||
worker.dev.port=8009
|
||||
worker.dev.host=@@dev_host@@
|
||||
worker.dev.type=ajp13
|
||||
worker.dev.lbfactor=1
|
||||
worker.dev.connection_pool_timeout=600
|
||||
worker.dev.socket_keepalive=1
|
||||
worker.dev.socket_timeout=60
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Utiliser 'udir --help-vars' pour une description de la signification des
|
||||
# variables suivantes:
|
||||
udir_desc="Fichiers à déployer sur @@host@@ dans le répertoire des documents web"
|
||||
udir_note="Il est possible de déployer les modifications dans ce répertoire avec 'uinst -y'"
|
||||
udir_types=(uinst:rsync)
|
||||
uinc=release
|
||||
uinc_options=()
|
||||
uinc_args=()
|
||||
configure_variables=(dest)
|
||||
configure_dest_for=()
|
||||
config_scripts=()
|
||||
install_profiles=false
|
||||
workdir_rsync_options=()
|
||||
workdir_excludes=()
|
||||
workdir_includes=()
|
||||
copy_files=true
|
||||
rsync_options=()
|
||||
destdir=root@@@host@@:HTDOCSDIR
|
||||
srcdir=.
|
||||
files=()
|
||||
owner=www-data:
|
||||
modes=(u=rwX,g=rX,o=rX)
|
||||
root_scripts=()
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -1,10 +1,6 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
source /etc/ulib &&
|
||||
urequire DEFAULTS ||
|
||||
exit 1
|
||||
OENC="$UTF8"
|
||||
source /etc/ulibauto || exit 1
|
||||
|
||||
PRIHOST=
|
||||
PUBHOST=
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<IfModule mod_ssl.c>
|
||||
# cf https://wiki.mozilla.org/Security/Server_Side_TLS
|
||||
<IfDefine SSL_CONFIG_MODERN>
|
||||
# modern configuration not supported. same as SSL_CONFIG_INTERMEDIATE below
|
||||
SSLProtocol all -SSLv2 -SSLv3
|
||||
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
|
||||
SSLHonorCipherOrder on
|
||||
</IfDefine>
|
||||
<IfDefine !SSL_CONFIG_MODERN>
|
||||
<IfDefine SSL_CONFIG_INTERMEDIATE>
|
||||
# intermediate configuration, tweak to your needs
|
||||
SSLProtocol all -SSLv2 -SSLv3
|
||||
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
|
||||
SSLHonorCipherOrder on
|
||||
SSLCompression off
|
||||
SSLSessionTickets off
|
||||
</IfDefine>
|
||||
<IfDefine !SSL_CONFIG_INTERMEDIATE>
|
||||
<IfDefine SSL_CONFIG_OLD>
|
||||
# old configuration, tweak to your needs
|
||||
SSLProtocol all -SSLv2
|
||||
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP
|
||||
SSLHonorCipherOrder on
|
||||
SSLCompression off
|
||||
SSLSessionTickets off
|
||||
</IfDefine>
|
||||
<IfDefine !SSL_CONFIG_OLD>
|
||||
# default debian configuration
|
||||
|
||||
# SSL Cipher Suite:
|
||||
# List the ciphers that the client is permitted to negotiate.
|
||||
# See the mod_ssl documentation for a complete list.
|
||||
# enable only secure ciphers:
|
||||
SSLCipherSuite HIGH:MEDIUM:!ADH
|
||||
# Use this instead if you want to allow cipher upgrades via SGC facility.
|
||||
# In this case you also have to use something like
|
||||
# SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128
|
||||
# see http://httpd.apache.org/docs/2.2/ssl/ssl_howto.html.en#upgradeenc
|
||||
#SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
|
||||
|
||||
# enable only secure protocols: SSLv3 and TLSv1, but not SSLv2
|
||||
SSLProtocol all -SSLv2
|
||||
</IfDefine>
|
||||
</IfDefine>
|
||||
</IfDefine>
|
||||
|
||||
#
|
||||
# Pseudo Random Number Generator (PRNG):
|
||||
# Configure one or more sources to seed the PRNG of the SSL library.
|
||||
# The seed data should be of good random quality.
|
||||
# WARNING! On some platforms /dev/random blocks if not enough entropy
|
||||
# is available. This means you then cannot use the /dev/random device
|
||||
# because it would lead to very long connection times (as long as
|
||||
# it requires to make more entropy available). But usually those
|
||||
# platforms additionally provide a /dev/urandom device which doesn't
|
||||
# block. So, if available, use this one instead. Read the mod_ssl User
|
||||
# Manual for more details.
|
||||
#
|
||||
SSLRandomSeed startup builtin
|
||||
SSLRandomSeed startup file:/dev/urandom 512
|
||||
SSLRandomSeed connect builtin
|
||||
SSLRandomSeed connect file:/dev/urandom 512
|
||||
|
||||
##
|
||||
## SSL Global Context
|
||||
##
|
||||
## All SSL configuration in this context applies both to
|
||||
## the main server and all SSL-enabled virtual hosts.
|
||||
##
|
||||
|
||||
#
|
||||
# Some MIME-types for downloading Certificates and CRLs
|
||||
#
|
||||
AddType application/x-x509-ca-cert .crt
|
||||
AddType application/x-pkcs7-crl .crl
|
||||
|
||||
# Pass Phrase Dialog:
|
||||
# Configure the pass phrase gathering process.
|
||||
# The filtering dialog program (`builtin' is a internal
|
||||
# terminal dialog) has to provide the pass phrase on stdout.
|
||||
SSLPassPhraseDialog builtin
|
||||
|
||||
# Inter-Process Session Cache:
|
||||
# Configure the SSL Session Cache: First the mechanism
|
||||
# to use and second the expiring timeout (in seconds).
|
||||
# (The mechanism dbm has known memory leaks and should not be used).
|
||||
#SSLSessionCache dbm:${APACHE_RUN_DIR}/ssl_scache
|
||||
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
|
||||
SSLSessionCacheTimeout 300
|
||||
|
||||
# Semaphore:
|
||||
# Configure the path to the mutual exclusion semaphore the
|
||||
# SSL engine uses internally for inter-process synchronization.
|
||||
SSLMutex file:${APACHE_RUN_DIR}/ssl_mutex
|
||||
|
||||
# Allow insecure renegotiation with clients which do not yet support the
|
||||
# secure renegotiation protocol. Default: Off
|
||||
#SSLInsecureRenegotiation on
|
||||
|
||||
# Whether to forbid non-SNI clients to access name based virtual hosts.
|
||||
# Default: Off
|
||||
#SSLStrictSNIVHostCheck On
|
||||
</IfModule>
|
|
@ -1,103 +0,0 @@
|
|||
<IfModule mod_ssl.c>
|
||||
# cf https://wiki.mozilla.org/Security/Server_Side_TLS
|
||||
<IfDefine SSL_CONFIG_MODERN>
|
||||
# modern configuration not supported. same as SSL_CONFIG_INTERMEDIATE below
|
||||
SSLProtocol all -SSLv2 -SSLv3
|
||||
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
|
||||
SSLHonorCipherOrder on
|
||||
</IfDefine>
|
||||
<IfDefine !SSL_CONFIG_MODERN>
|
||||
<IfDefine SSL_CONFIG_INTERMEDIATE>
|
||||
# intermediate configuration, tweak to your needs
|
||||
SSLProtocol all -SSLv2 -SSLv3
|
||||
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
|
||||
SSLHonorCipherOrder on
|
||||
SSLCompression off
|
||||
SSLSessionTickets off
|
||||
</IfDefine>
|
||||
<IfDefine !SSL_CONFIG_INTERMEDIATE>
|
||||
<IfDefine SSL_CONFIG_OLD>
|
||||
# old configuration, tweak to your needs
|
||||
SSLProtocol all -SSLv2
|
||||
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP
|
||||
SSLHonorCipherOrder on
|
||||
SSLCompression off
|
||||
SSLSessionTickets off
|
||||
</IfDefine>
|
||||
<IfDefine !SSL_CONFIG_OLD>
|
||||
# default debian configuration
|
||||
|
||||
# SSL Cipher Suite:
|
||||
# List the ciphers that the client is permitted to negotiate.
|
||||
# See the mod_ssl documentation for a complete list.
|
||||
# enable only secure ciphers:
|
||||
SSLCipherSuite HIGH:MEDIUM:!ADH
|
||||
# Use this instead if you want to allow cipher upgrades via SGC facility.
|
||||
# In this case you also have to use something like
|
||||
# SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128
|
||||
# see http://httpd.apache.org/docs/2.2/ssl/ssl_howto.html.en#upgradeenc
|
||||
#SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
|
||||
|
||||
# enable only secure protocols: SSLv3 and TLSv1, but not SSLv2
|
||||
SSLProtocol all -SSLv2
|
||||
</IfDefine>
|
||||
</IfDefine>
|
||||
</IfDefine>
|
||||
|
||||
#
|
||||
# Pseudo Random Number Generator (PRNG):
|
||||
# Configure one or more sources to seed the PRNG of the SSL library.
|
||||
# The seed data should be of good random quality.
|
||||
# WARNING! On some platforms /dev/random blocks if not enough entropy
|
||||
# is available. This means you then cannot use the /dev/random device
|
||||
# because it would lead to very long connection times (as long as
|
||||
# it requires to make more entropy available). But usually those
|
||||
# platforms additionally provide a /dev/urandom device which doesn't
|
||||
# block. So, if available, use this one instead. Read the mod_ssl User
|
||||
# Manual for more details.
|
||||
#
|
||||
SSLRandomSeed startup builtin
|
||||
SSLRandomSeed startup file:/dev/urandom 512
|
||||
SSLRandomSeed connect builtin
|
||||
SSLRandomSeed connect file:/dev/urandom 512
|
||||
|
||||
##
|
||||
## SSL Global Context
|
||||
##
|
||||
## All SSL configuration in this context applies both to
|
||||
## the main server and all SSL-enabled virtual hosts.
|
||||
##
|
||||
|
||||
#
|
||||
# Some MIME-types for downloading Certificates and CRLs
|
||||
#
|
||||
AddType application/x-x509-ca-cert .crt
|
||||
AddType application/x-pkcs7-crl .crl
|
||||
|
||||
# Pass Phrase Dialog:
|
||||
# Configure the pass phrase gathering process.
|
||||
# The filtering dialog program (`builtin' is a internal
|
||||
# terminal dialog) has to provide the pass phrase on stdout.
|
||||
SSLPassPhraseDialog builtin
|
||||
|
||||
# Inter-Process Session Cache:
|
||||
# Configure the SSL Session Cache: First the mechanism
|
||||
# to use and second the expiring timeout (in seconds).
|
||||
# (The mechanism dbm has known memory leaks and should not be used).
|
||||
#SSLSessionCache dbm:${APACHE_RUN_DIR}/ssl_scache
|
||||
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
|
||||
SSLSessionCacheTimeout 300
|
||||
|
||||
# Semaphore:
|
||||
# Configure the path to the mutual exclusion semaphore the
|
||||
# SSL engine uses internally for inter-process synchronization.
|
||||
SSLMutex file:${APACHE_RUN_DIR}/ssl_mutex
|
||||
|
||||
# Allow insecure renegotiation with clients which do not yet support the
|
||||
# secure renegotiation protocol. Default: Off
|
||||
#SSLInsecureRenegotiation on
|
||||
|
||||
# Whether to forbid non-SNI clients to access name based virtual hosts.
|
||||
# Default: Off
|
||||
#SSLStrictSNIVHostCheck On
|
||||
</IfModule>
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:syntax=apache:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# If you just change the port or add more ports here, you will likely also
|
||||
# have to change the VirtualHost statement in
|
||||
# /etc/apache2/sites-enabled/000-default
|
||||
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
|
||||
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
|
||||
# README.Debian.gz
|
||||
|
||||
NameVirtualHost *:80
|
||||
Listen *:80
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
# If you add NameVirtualHost *:443 here, you will also have to change
|
||||
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
|
||||
# to <VirtualHost *:443>
|
||||
# Server Name Indication for SSL named virtual hosts is currently not
|
||||
# supported by MSIE on Windows XP.
|
||||
#NameVirtualHost IP:443
|
||||
#Listen IP:443
|
||||
#@@ips_namevirtualhosts@@
|
||||
#@@ips_listens@@
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
#NameVirtualHost IP:443
|
||||
#Listen IP:443
|
||||
#@@ips_namevirtualhosts@@
|
||||
#@@ips_listens@@
|
||||
</IfModule>
|
|
@ -1,29 +0,0 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:syntax=apache:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# If you just change the port or add more ports here, you will likely also
|
||||
# have to change the VirtualHost statement in
|
||||
# /etc/apache2/sites-enabled/000-default
|
||||
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
|
||||
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
|
||||
# README.Debian.gz
|
||||
|
||||
NameVirtualHost *:80
|
||||
Listen *:80
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
# If you add NameVirtualHost *:443 here, you will also have to change
|
||||
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
|
||||
# to <VirtualHost *:443>
|
||||
# Server Name Indication for SSL named virtual hosts is currently not
|
||||
# supported by MSIE on Windows XP.
|
||||
#NameVirtualHost IP:443
|
||||
#Listen IP:443
|
||||
#@@ips_namevirtualhosts@@
|
||||
#@@ips_listens@@
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
#NameVirtualHost IP:443
|
||||
#Listen IP:443
|
||||
#@@ips_namevirtualhosts@@
|
||||
#@@ips_listens@@
|
||||
</IfModule>
|
|
@ -0,0 +1,51 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName @@host@@
|
||||
ServerAlias @@aliases@@
|
||||
ServerAdmin @@admin@@
|
||||
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
# Pour les serveurs qui ont le module mod_WebObjects:
|
||||
# mod_WebObjects et ScriptAlias ne peuvent pas gérer le même préfixe. Pour
|
||||
# utiliser des cgi-bin avec WebObjects, il faut soit changer le préfixe de
|
||||
# ScriptAlias, soit changer le préfixe de WebObjectsAlias dans le fichier
|
||||
# mod-webobjects.conf
|
||||
# Sinon, il suffit de commenter les lignes suivantes:
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# Pour les serveurs qui ont le module mod_WebObjects:
|
||||
<LocationMatch "/cgi-bin/WebObjects/.*">
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</LocationMatch>
|
||||
<Location /WebObjects>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
</VirtualHost>
|
|
@ -1,51 +0,0 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName @@host@@
|
||||
ServerAlias @@aliases@@
|
||||
ServerAdmin @@admin@@
|
||||
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
# Pour les serveurs qui ont le module mod_WebObjects:
|
||||
# mod_WebObjects et ScriptAlias ne peuvent pas gérer le même préfixe. Pour
|
||||
# utiliser des cgi-bin avec WebObjects, il faut soit changer le préfixe de
|
||||
# ScriptAlias, soit changer le préfixe de WebObjectsAlias dans le fichier
|
||||
# mod-webobjects.conf
|
||||
# Sinon, il suffit de commenter les lignes suivantes:
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# Pour les serveurs qui ont le module mod_WebObjects:
|
||||
<LocationMatch "/cgi-bin/WebObjects/.*">
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</LocationMatch>
|
||||
<Location /WebObjects>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
</VirtualHost>
|
|
@ -0,0 +1,190 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
<VirtualHost _default_:443>
|
||||
ServerName @@host@@
|
||||
ServerAlias @@aliases@@
|
||||
ServerAdmin @@admin@@
|
||||
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
# Pour les serveurs qui ont le module mod_WebObjects:
|
||||
# mod_WebObjects et ScriptAlias ne peuvent pas gérer le même préfixe. Pour
|
||||
# utiliser des cgi-bin avec WebObjects, il faut soit changer le préfixe de
|
||||
# ScriptAlias, soit changer le préfixe de WebObjectsAlias dans le fichier
|
||||
# mod-webobjects.conf
|
||||
# Sinon, il suffit de commenter les lignes suivantes:
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/ssl_error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
|
||||
|
||||
<LocationMatch "/cgi-bin/WebObjects/.*">
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</LocationMatch>
|
||||
|
||||
<Location /WebObjects>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
|
||||
# SSL Engine Switch:
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
SSLEngine on
|
||||
|
||||
# A self-signed (snakeoil) certificate can be created by installing
|
||||
# the ssl-cert package. See
|
||||
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||
# If both key and certificate are stored in the same file, only the
|
||||
# SSLCertificateFile directive is needed.
|
||||
SSLCertificateFile @@cert@@
|
||||
SSLCertificateKeyFile @@key@@
|
||||
|
||||
# Server Certificate Chain:
|
||||
# Point SSLCertificateChainFile at a file containing the
|
||||
# concatenation of PEM encoded CA certificates which form the
|
||||
# certificate chain for the server certificate. Alternatively
|
||||
# the referenced file can be the same as SSLCertificateFile
|
||||
# when the CA certificates are directly appended to the server
|
||||
# certificate for convinience.
|
||||
SSLCertificateChainFile @@ca@@
|
||||
|
||||
# Certificate Authority (CA):
|
||||
# Set the CA certificate verification path where to find CA
|
||||
# certificates for client authentication or alternatively one
|
||||
# huge file containing all of them (file must be PEM encoded)
|
||||
# Note: Inside SSLCACertificatePath you need hash symlinks
|
||||
# to point to the certificate files. Use the provided
|
||||
# Makefile to update the hash symlinks after changes.
|
||||
#SSLCACertificatePath /etc/ssl/certs/
|
||||
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
|
||||
|
||||
# Certificate Revocation Lists (CRL):
|
||||
# Set the CA revocation path where to find CA CRLs for client
|
||||
# authentication or alternatively one huge file containing all
|
||||
# of them (file must be PEM encoded)
|
||||
# Note: Inside SSLCARevocationPath you need hash symlinks
|
||||
# to point to the certificate files. Use the provided
|
||||
# Makefile to update the hash symlinks after changes.
|
||||
#SSLCARevocationPath /etc/apache2/ssl.crl/
|
||||
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
|
||||
|
||||
# Client Authentication (Type):
|
||||
# Client certificate verification type and depth. Types are
|
||||
# none, optional, require and optional_no_ca. Depth is a
|
||||
# number which specifies how deeply to verify the certificate
|
||||
# issuer chain before deciding the certificate is not valid.
|
||||
#SSLVerifyClient require
|
||||
#SSLVerifyDepth 10
|
||||
|
||||
# Access Control:
|
||||
# With SSLRequire you can do per-directory access control based
|
||||
# on arbitrary complex boolean expressions containing server
|
||||
# variable checks and other lookup directives. The syntax is a
|
||||
# mixture between C and Perl. See the mod_ssl documentation
|
||||
# for more details.
|
||||
#<Location />
|
||||
#SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
|
||||
# and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
|
||||
# and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
|
||||
# and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
|
||||
# and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
|
||||
# or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
|
||||
#</Location>
|
||||
|
||||
# SSL Engine Options:
|
||||
# Set various options for the SSL engine.
|
||||
# o FakeBasicAuth:
|
||||
# Translate the client X.509 into a Basic Authorisation. This means that
|
||||
# the standard Auth/DBMAuth methods can be used for access control. The
|
||||
# user name is the `one line' version of the client's X.509 certificate.
|
||||
# Note that no password is obtained from the user. Every entry in the user
|
||||
# file needs this password: `xxj31ZMTZzkVA'.
|
||||
# o ExportCertData:
|
||||
# This exports two additional environment variables: SSL_CLIENT_CERT and
|
||||
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
|
||||
# server (always existing) and the client (only existing when client
|
||||
# authentication is used). This can be used to import the certificates
|
||||
# into CGI scripts.
|
||||
# o StdEnvVars:
|
||||
# This exports the standard SSL/TLS related `SSL_*' environment variables.
|
||||
# Per default this exportation is switched off for performance reasons,
|
||||
# because the extraction step is an expensive operation and is usually
|
||||
# useless for serving static content. So one usually enables the
|
||||
# exportation for CGI and SSI requests only.
|
||||
# o StrictRequire:
|
||||
# This denies access when "SSLRequireSSL" or "SSLRequire" applied even
|
||||
# under a "Satisfy any" situation, i.e. when it applies access is denied
|
||||
# and no other module can change it.
|
||||
# o OptRenegotiate:
|
||||
# This enables optimized SSL connection renegotiation handling when SSL
|
||||
# directives are used in per-directory context.
|
||||
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
|
||||
<FilesMatch "\.(cgi|shtml|phtml|php)$">
|
||||
SSLOptions +StdEnvVars
|
||||
</FilesMatch>
|
||||
<Directory /usr/lib/cgi-bin>
|
||||
SSLOptions +StdEnvVars
|
||||
</Directory>
|
||||
|
||||
# SSL Protocol Adjustments:
|
||||
# The safe and default but still SSL/TLS standard compliant shutdown
|
||||
# approach is that mod_ssl sends the close notify alert but doesn't wait for
|
||||
# the close notify alert from client. When you need a different shutdown
|
||||
# approach you can use one of the following variables:
|
||||
# o ssl-unclean-shutdown:
|
||||
# This forces an unclean shutdown when the connection is closed, i.e. no
|
||||
# SSL close notify alert is send or allowed to received. This violates
|
||||
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
|
||||
# this when you receive I/O errors because of the standard approach where
|
||||
# mod_ssl sends the close notify alert.
|
||||
# o ssl-accurate-shutdown:
|
||||
# This forces an accurate shutdown when the connection is closed, i.e. a
|
||||
# SSL close notify alert is send and mod_ssl waits for the close notify
|
||||
# alert of the client. This is 100% SSL/TLS standard compliant, but in
|
||||
# practice often causes hanging connections with brain-dead browsers. Use
|
||||
# this only for browsers where you know that their SSL implementation
|
||||
# works correctly.
|
||||
# Notice: Most problems of broken clients are also related to the HTTP
|
||||
# keep-alive facility, so you usually additionally want to disable
|
||||
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
|
||||
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
|
||||
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
|
||||
# "force-response-1.0" for this.
|
||||
BrowserMatch "MSIE [2-6]" \
|
||||
nokeepalive ssl-unclean-shutdown \
|
||||
downgrade-1.0 force-response-1.0
|
||||
# MSIE 7 and newer should be able to use keepalive
|
||||
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
|
||||
|
||||
# cf https://wiki.mozilla.org/Security/Server_Side_TLS
|
||||
<IfDefine SSL_CONFIG_HSTS>
|
||||
<IfModule mod_headers.c>
|
||||
# HSTS (15768000 seconds = 6 months)
|
||||
Header always set Strict-Transport-Security "max-age=15768000"
|
||||
</IfModule>
|
||||
</IfDefine>
|
||||
</VirtualHost>
|
||||
</IfModule>
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -76,6 +76,8 @@ function urequire() {
|
|||
# Le module DEFAULTS est traité de façon particulière: si le fichier associé
|
||||
# n'est pas trouvé, charger base, pretty, sysinfos et compat à la place
|
||||
# Si un module n'est pas trouvé, quitter le script avec die()
|
||||
[ -z "$__ULIB_NO_DISABLE_SET_X" ] && [[ $- == *x* ]] && { set +x; local __ULIB_UREQUIRE_SET_X=1; }; if [ -n "$__ULIB_UREQUIRE_SET_X" ]; then [ -n "$__ULIB_UREQUIRE_SET_X_RL1" ] || local __ULIB_UREQUIRE_SET_X_RL1; local __ULIB_UREQUIRE_SET_X_RL2=$RANDOM; [ -n "$__ULIB_UREQUIRE_SET_X_RL1" ] || __ULIB_UREQUIRE_SET_X_RL1=$__ULIB_UREQUIRE_SET_X_RL2; fi # désactiver set -x de manière réentrante
|
||||
|
||||
local __u_module __u_ulibdir __u_found
|
||||
[ -n "$*" ] || set DEFAULTS
|
||||
|
||||
|
@ -106,6 +108,8 @@ function urequire() {
|
|||
fi
|
||||
[ -n "$__u_found" ] || die "Unable to find $__u_module in ${ULIBDIR[*]}"
|
||||
done
|
||||
|
||||
[ -n "$__ULIB_UREQUIRE_SET_X" -a "$__ULIB_UREQUIRE_SET_X_RL1" == "$__ULIB_UREQUIRE_SET_X_RL2" ] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ function uprovide() {
|
|||
__ULIB_FORCE_RELOAD=
|
||||
|
||||
function urequire() {
|
||||
[ -z "$__ULIB_NO_DISABLE_SET_X" ] && [[ $- == *x* ]] && { set +x; local __ULIB_UREQUIRE_SET_X=1; }; if [ -n "$__ULIB_UREQUIRE_SET_X" ]; then [ -n "$__ULIB_UREQUIRE_SET_X_RL1" ] || local __ULIB_UREQUIRE_SET_X_RL1; local __ULIB_UREQUIRE_SET_X_RL2=$RANDOM; [ -n "$__ULIB_UREQUIRE_SET_X_RL1" ] || __ULIB_UREQUIRE_SET_X_RL1=$__ULIB_UREQUIRE_SET_X_RL2; fi # désactiver set -x de manière réentrante
|
||||
|
||||
local __u_module __u_ulibdir __u_found
|
||||
[ -n "$*" ] || set DEFAULTS
|
||||
|
||||
|
@ -91,6 +93,8 @@ function urequire() {
|
|||
fi
|
||||
[ -n "$__u_found" ] || die "Unable to find $__u_module in ${ULIBDIR[*]}"
|
||||
done
|
||||
|
||||
[ -n "$__ULIB_UREQUIRE_SET_X" -a "$__ULIB_UREQUIRE_SET_X_RL1" == "$__ULIB_UREQUIRE_SET_X_RL2" ] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
209
mkRewriteRules
209
mkRewriteRules
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
urequire DEFAULTS apache.tools
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Créer un fichier de redirections pour Apache à partir d'un certain
|
||||
|
@ -82,23 +82,9 @@ Dans les exemples donnés ci-dessus, $URL est l'\''url générée par la réécr
|
|||
et $proxy_acls la valeur du champ proxy_acls spécifiée ci-dessus.'
|
||||
}
|
||||
|
||||
function joinurl() {
|
||||
# joindre chaque élément de $1..@ par /, en évitant les slashes en double
|
||||
local i url
|
||||
for i in "$@"; do
|
||||
[ -n "$i" ] || continue
|
||||
if [ -n "$url" ]; then
|
||||
url="${url%/}/${i#/}"
|
||||
else
|
||||
url="$i"
|
||||
fi
|
||||
done
|
||||
[ -n "$url" ] && echo "$url"
|
||||
}
|
||||
|
||||
proxy_enabled=
|
||||
infile=
|
||||
outfile="RewriteRules.conf"
|
||||
outfile=
|
||||
htmlfile=
|
||||
host=
|
||||
parse_opts "${PRETTYOPTS[@]}" \
|
||||
|
@ -109,187 +95,20 @@ parse_opts "${PRETTYOPTS[@]}" \
|
|||
-w: htmlfile= \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
|
||||
[ -n "$infile" ] || die "Il faut spécifier le fichier de règles"
|
||||
[ -f "$infile" ] || die "Fichier de règles non trouvé: $(ppath "$infile")"
|
||||
|
||||
thishost="$1"
|
||||
[ -n "$thishost" ] || die "Il faut spécifier l'hôte pour lequel créer le fichier de configuration"
|
||||
|
||||
function has_proxy() {
|
||||
# vérifier que les options $1 contiennent 'P'
|
||||
local options
|
||||
array_split options "$1" ","
|
||||
array_contains options P
|
||||
}
|
||||
|
||||
if [ -n "$htmlfile" ]; then
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<!-- -*- coding: utf-8 mode: html -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>'"$thishost</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>$thishost</h2>
|
||||
<ul>" >"$htmlfile"
|
||||
if [ -n "$infile" ]; then infiles=("$infile")
|
||||
else array_lsfiles infiles . "*rewrite*.rules"
|
||||
fi
|
||||
|
||||
>"$outfile"
|
||||
array_from_lines rules "$(<"$infile" filter_comment)"
|
||||
prefix=
|
||||
for rule in "${rules[@]}"; do
|
||||
if beginswith "$rule" ^; then
|
||||
# Collecter les préfixe pour la règle suivante
|
||||
prefix="${prefix:+$prefix
|
||||
}${rule#^}"
|
||||
continue
|
||||
elif beginswith "$rule" =; then
|
||||
# ligne litérale
|
||||
echo "${rule#=}" >>"$outfile"
|
||||
continue
|
||||
[ ${#infiles[*]} -gt 0 ] || die "Il faut spécifier le fichier de règles avec -f"
|
||||
for infile in "${infiles[@]}"; do
|
||||
if [ -f "$infile" ]; then
|
||||
estep "$(ppath "$infile")"
|
||||
legacy_mkRewriteRules "$infile" "$thishost" "$outfile" "$htmlfile" "$proxy_enabled"
|
||||
else
|
||||
eerror "$(ppath "$infile"): fichier introuvable"
|
||||
fi
|
||||
|
||||
IFS=:; set -- $rule; unset IFS
|
||||
index=1
|
||||
done=
|
||||
while [ -z "$done" ]; do
|
||||
current="$1"; shift
|
||||
while endswith "$current" "\\"; do
|
||||
current="${current%\\}:$1"; shift
|
||||
# réinitialiser pour ne pas écraser un fichier existant
|
||||
outfile=
|
||||
htmlfile=
|
||||
done
|
||||
case $index in
|
||||
1) src="$current";;
|
||||
2) dest="$current";;
|
||||
3) host="$current";;
|
||||
4) suffix="$current";;
|
||||
5) options="$current";;
|
||||
6) prot="${current:-http}";;
|
||||
7) proxy_acls="$current";;
|
||||
*) done=1;;
|
||||
esac
|
||||
index=$(($index + 1))
|
||||
done
|
||||
|
||||
# mettre en forme prefix s'il est défini
|
||||
[ -n "$prefix" ] && prefix="$prefix
|
||||
"
|
||||
|
||||
if [ "$thishost" == "$host" ]; then
|
||||
host=
|
||||
fi
|
||||
|
||||
usrc="$src"
|
||||
|
||||
trail=1
|
||||
if endswith "$src" '$'; then
|
||||
trail=
|
||||
usrc="${src%$}"
|
||||
fi
|
||||
|
||||
noslash=
|
||||
if endswith "$suffix" '$'; then
|
||||
noslash=1
|
||||
suffix="${suffix%$}"
|
||||
fi
|
||||
if endswith "$dest" '$'; then
|
||||
noslash=1
|
||||
dest="${dest%$}"
|
||||
fi
|
||||
|
||||
proxy_url=
|
||||
proxy_use=
|
||||
|
||||
if endswith "$dest" .woa; then
|
||||
# lien vers une application
|
||||
if [ -n "$host" ]; then
|
||||
# sur un autre hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix")${trail:+\$1} [L${options:+,$options}]" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix"
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$outfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix" "\$1") [L${options:+,$options}]" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix/"
|
||||
fi
|
||||
else
|
||||
# sur le même hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl /cgi-bin/WebObjects "$dest" "$suffix")${trail:+\$1} [L,P${options:+,$options}]" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url joinurl "$prot://$thishost/cgi-bin/WebObjects" "$dest" "$suffix"
|
||||
proxy_use=1
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$outfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(joinurl /cgi-bin/WebObjects "$dest" "$suffix" "\$1") [L,P${options:+,$options}]" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url joinurl "$prot://$thishost/cgi-bin/WebObjects" "$dest" "$suffix/"
|
||||
proxy_use=1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# lien vers une url
|
||||
if [ -n "$host" ]; then
|
||||
# sur un autre hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl "$prot://$host" "$dest" "$suffix")${trail:+\$1} [L${options:+,$options}]" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url joinurl "$prot://$host" "$dest" "$suffix"
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$outfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(joinurl "$prot://$host" "$dest" "$suffix" "\$1") [L${options:+,$options}]" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url joinurl "$prot://$host" "$dest" "$suffix/"
|
||||
fi
|
||||
else
|
||||
# sur le même hôte
|
||||
if [ -n "$noslash" ]; then
|
||||
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl / "$dest" "$suffix")${trail:+\$1}${options:+ [$options]}" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc"
|
||||
setx proxy_url joinurl "http://$thishost" "$dest" "$suffix"
|
||||
else
|
||||
echo "${prefix}RewriteRule ^/$src\$ /$src/" >>"$outfile"
|
||||
echo "${prefix}RewriteRule ^/$src/(.*) $(joinurl / "$dest" "$suffix" "\$1")${options:+ [$options]}" >>"$outfile"
|
||||
setx url joinurl "http://$thishost" "$usrc/"
|
||||
setx proxy_url joinurl "http://$thishost" "$dest" "$suffix/"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
has_proxy "$options" && proxy_use=1
|
||||
if [ -n "$proxy_enabled" -a -n "$proxy_use" ]; then
|
||||
if [ "$proxy_acls" == "None" ]; then
|
||||
:
|
||||
elif [ -z "$proxy_acls" ]; then
|
||||
echo "\
|
||||
<Proxy $proxy_url*>
|
||||
AddDefaultCharset off
|
||||
Order Deny,Allow
|
||||
Allow from all
|
||||
</Proxy>" >>"$outfile"
|
||||
else
|
||||
echo "\
|
||||
<Proxy $proxy_url*>
|
||||
AddDefaultCharset off
|
||||
Order Allow,Deny
|
||||
Allow from $proxy_acls
|
||||
</Proxy>" >>"$outfile"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "" >>"$outfile"
|
||||
if [ -n "$htmlfile" ]; then
|
||||
echo "<li><a href=\"$url\">$url</a></li>" >>"$htmlfile"
|
||||
fi
|
||||
|
||||
# Réinitialiser les préfixes pour chaque règle
|
||||
prefix=
|
||||
done
|
||||
|
||||
if [ -n "$htmlfile" ]; then
|
||||
echo '</ul>
|
||||
</body>
|
||||
</html>' >>"$htmlfile"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue