File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ if [ ! -z "$PROXY_SYSTEM" ]; then
157157 rpaf_conf=" /etc/$WEB_SYSTEM /mods-enabled/rpaf.conf"
158158 if [ -e " $rpaf_conf " ]; then
159159 rpaf_str=$( grep RPAFproxy_ips $rpaf_conf )
160+ [ -z " $rpaf_str " ] && sed -i ' s|</IfModule>|RPAFproxy_ips\n</IfModule>|' $rpaf_conf && rpaf_str=' RPAFproxy_ips'
160161 rpaf_str=" $rpaf_str $ip "
161162 sed -i " s/.*RPAFproxy_ips.*/$rpaf_str /" $rpaf_conf
162163 fi
Original file line number Diff line number Diff line change @@ -105,14 +105,17 @@ if [ ! -z "$PROXY_SYSTEM" ]; then
105105 rpaf_conf=" /etc/$WEB_SYSTEM /mods-enabled/rpaf.conf"
106106 if [ -e " $rpaf_conf " ]; then
107107 ips=$( grep RPAFproxy_ips $rpaf_conf )
108- new_ips=$( echo " $rpaf_str " | sed " s/$ip //" )
108+ new_ips=$( echo " $ips " | sed " s/ $ip //" )
109109 sed -i " s/$ips /$new_ips /g" $rpaf_conf
110+
111+ # Remove RPAFproxy_ips line when ip list is empty
112+ [ " $( grep RPAFproxy_ips $rpaf_conf | sed ' s/^[[:space:]]*//g' ) " = " RPAFproxy_ips" ] && sed -i " /RPAFproxy_ips/d" $rpaf_conf
110113 fi
111114
112115 # mod_remoteip
113116 remoteip_conf=" /etc/$WEB_SYSTEM /mods-enabled/remoteip.conf"
114117 if [ -e " $remoteip_conf " ]; then
115- sed -i " s /RemoteIPInternalProxy $ip //g " $remoteip_conf
118+ sed -i " /RemoteIPInternalProxy $ip \$ /d " $remoteip_conf
116119 fi
117120fi
118121
You can’t perform that action at this time.
0 commit comments