diff -Nur --no-dereference smeserver-mod_maxminddb-1.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79externalSSLAccessStringGeoip smeserver-mod_maxminddb-1.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79externalSSLAccessStringGeoip --- smeserver-mod_maxminddb-1.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79externalSSLAccessStringGeoip 2022-07-24 01:10:54.985000000 -0400 +++ smeserver-mod_maxminddb-1.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79externalSSLAccessStringGeoip 2022-07-25 00:58:53.699000000 -0400 @@ -1,3 +1,4 @@ + { #--------------------------------------------------------------------- # Grab ValidFromGeoIP access list property of httpd-admin @@ -5,11 +6,12 @@ # this list, as well as local networks. #--------------------------------------------------------------------- - $OUT = ''; + $OUT = '# Mod_maxminddb variable definition'; my $validFromGeoIP = ${'httpd-admin'}{'ValidFromGeoIP'}; - return unless defined $validFromGeoIP; + return "#disabled\n" unless (defined $validFromGeoIP && ($modMaxminddb{'status'}||'disabled') eq 'enabled' ); $validFromGeoIP =~ s/,/|/g; - $OUT .= " SetEnvIf MM_COUNTRY_CODE ^($validFromGeoIP) AllowCountries\n"; - $externalSSLAccess .= " env=AllowCountries"; -} + $OUT .= "\nSetEnvIf MM_COUNTRY_CODE ^($validFromGeoIP) AllowCountries\n"; + # prior apache 2.4 you could combine ip and env by doing $externalSSLAccess .= ' env=AllowCountries'; + # now you should add "Require env AllowCountries" in Files, Directory or Location section + } diff -Nur --no-dereference smeserver-mod_maxminddb-1.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/98geoipallow smeserver-mod_maxminddb-1.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/98geoipallow --- smeserver-mod_maxminddb-1.1.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/98geoipallow 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-mod_maxminddb-1.1.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/98geoipallow 2022-07-25 00:58:53.941000000 -0400 @@ -0,0 +1,23 @@ +{ + $OUT =" # Mod_maxminddb\n"; + return " #disabled\n" unless ( ($modMaxminddb{'status'}||'disabled') eq 'enabled' || defined (${'httpd-admin'}{'ValidFromGeoIP'}) ); + $haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no'; + if (($haveSSL eq 'yes') && ($port eq $httpsPort) ) { + $OUT .=" + Require ip $localAccess $externalSSLAccess + Require env AllowCountries + \n" if (-d "/etc/e-smith/web/panels/manager/" && (${'httpd-admin'}{'GeoIPManager'} || 'enabled' ) eq 'enabled' ); + $OUT .=" + Require ip $localAccess $externalSSLAccess + Require env AllowCountries + \n" if ( (${'httpd-admin'}{'GeoIPManager'} || 'enabled' ) eq 'enabled' || (${'httpd-admin'}{'GeoIPUser'} || 'enabled' ) eq 'enabled' || (${'httpd-admin'}{'GeoIPPassword'} || 'enabled' ) eq 'enabled') ; + $OUT .=" + Require ip $localAccess $externalSSLAccess + Require env AllowCountries + \n" if (-d "/etc/e-smith/web/panels/user/" && (${'httpd-admin'}{'GeoIPUser'} || 'enabled' ) eq 'enabled' ); + $OUT .=" + Require ip $localAccess $externalSSLAccess + Require env AllowCountries + \n" if (-d "/etc/e-smith/web/panels/password/" && (${'httpd-admin'}{'GeoIPPassword'} || 'enabled' ) eq 'enabled' ); + } +}