support de SITE_IP
This commit is contained in:
		
							parent
							
								
									999fb7f78d
								
							
						
					
					
						commit
						f908e1ce1d
					
				
							
								
								
									
										43
									
								
								apacheconfig
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								apacheconfig
									
									
									
									
									
								
							| @ -273,6 +273,44 @@ elif [ "$action" == new-site ]; then | ||||
|         die "$host n'est pas un nom d'hôte pleinement qualifié" | ||||
|     fi | ||||
| 
 | ||||
|     hostip= | ||||
|     for i in "$clrtempl" "$ssltempl"; do | ||||
|         [ -n "$i" -a -f "$templdir/$i" ] || continue | ||||
|         quietgrep SITE_IP "$templdir/$i" && { hostip=1; break; } | ||||
|     done | ||||
|     if [ -n "$hostip" ]; then | ||||
|         # Il y a un champ SITE_IP, il faut demander à l'utilisateur l'adresse ip | ||||
|         # correspondante | ||||
|         [[ "$host" == *.* ]] && hostdomain="${host#*.}" || hostdomain= | ||||
|         pri= | ||||
|         hostip= | ||||
|         i=0 | ||||
|         while [ $i -lt ${#PUBDOMAINS[*]} ]; do | ||||
|             if [ "${PUBDOMAINS[$i]}" == "$hostdomain" ]; then | ||||
|                 pri="$VSPREFIX${host%$hostdomain}${PRIDOMAINS[$i]}" | ||||
|                 resolv_ips ips "$pri" | ||||
|                 if [ -n "$ips" ]; then | ||||
|                     hostip="${ips[0]}" | ||||
|                     break | ||||
|                 fi | ||||
|             fi | ||||
|             i=$(($i + 1)) | ||||
|         done | ||||
|         if [ -z "$hostip" ]; then | ||||
|             pri="$VSPREFIX$host" | ||||
|             resolv_ips ips "$pri" | ||||
|             [ -n "$ips" ] && hostip="${ips[0]}" | ||||
|         fi | ||||
|         if [ -n "$pri" -a -n "$hostip" ]; then | ||||
|             enote "Correspondance automatique $host --> $pri" | ||||
|             read_value "Veuillez confirmer l'adresse IP d'écoute" hostip "$hostip" N | ||||
|         else | ||||
|             enote "Vous devez saisir l'adresse IP privée correspondant à $host" | ||||
|             read_value "Veuillez entrer l'adresse IP *privée* d'écoute" hostip "" N | ||||
|         fi | ||||
|         [ -n "$hostip" ] || ewarn "Vous avez choisi de ne pas spécifier d'adresse IP d'écoute. Il faudra corriger manuellement les fichiers générés" | ||||
|     fi | ||||
| 
 | ||||
|     etitle "$host" | ||||
|     hostname="${host%%.*}" | ||||
|     clrconf="${clrtempl/SITE/$hostname}" | ||||
| @ -283,7 +321,10 @@ elif [ "$action" == new-site ]; then | ||||
|     mkdir -p "$destdir/certsconf" | ||||
|     mkdir -p "$destdir/sites" | ||||
| 
 | ||||
|     sedscript="\ | ||||
|     sedscript= | ||||
|     [ -n "$hostip" ] && sedscript="$sedscript | ||||
| s/SITE_IP/$hostip/g" | ||||
|     sedscript="$sedscript | ||||
| s/SITE.TLD/$host/g | ||||
| s/SITE/$hostname/g" | ||||
| 
 | ||||
|  | ||||
| @ -4,3 +4,12 @@ | ||||
| #DEFAULT_ADMIN=supervision-gdrsi@listes.univ-reunion.fr | ||||
| #DEFAULT_CERTSDIR=1507-renater | ||||
| #DEFAULT_CANAME=1507-DigiCertCA.crt | ||||
| 
 | ||||
| # Valeurs des domaines publics et privés ainsi que préfixe pour les adresses de | ||||
| # service. Chaque élément du tableau PUBDOMAINS doit avoir un correspondant dans | ||||
| # le tableau PRIDOMAINS. | ||||
| # Avec la configuration par défaut suivante, on considère que l'adresse | ||||
| # privée correspondant à HOST.univ-reunion.fr est vs-HOST.univ.run | ||||
| #PUBDOMAINS=(univ-reunion.fr) | ||||
| #PRIDOMAINS=(univ.run) | ||||
| #VSPREFIX=vs- | ||||
|  | ||||
| @ -884,6 +884,9 @@ function apacheconfig_initvars() { | ||||
|     DEFAULT_ADMIN=supervision-gdrsi@listes.univ-reunion.fr | ||||
|     DEFAULT_CERTSDIR=1507-renater | ||||
|     DEFAULT_CANAME=1507-DigiCertCA.crt | ||||
|     PUBDOMAINS=(univ-reunion.fr) | ||||
|     PRIDOMAINS=(univ.run) | ||||
|     VSPREFIX=vs- | ||||
|     set_defaults apacheconfig | ||||
| 
 | ||||
|     TEMPLATE_NOWRITE_VARS=("${APACHECONFIG_TEMPLATE_NOWRITE_VARS[@]}") | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user