Next steps are for home use and we will not be using them in the class. Save the code / ideas and use them later¶
Requirements
I hope that you did read the topic and will not use this in class.
Get Finnish IP blocks adderess from ipdeny.com¶
Create UFW rules for Finland (Serverlevel hardening and will not work with docker because of the way docker handles iptables/nftables rules)¶
Install GeoIP2 module For Nginx¶
Install the GeoIP2 module and the GeoIP database updater:
Configuration in /etc/nginx/nginx.conf:
Bash
geo $country {
default ZZ;
# IP ranges from MaxMind GeoIP database
}
server {
listen 80;
server_name your-domain.fi;
# Block if NOT Finland
if ($country != "FI") {
return 444; # Close connection silently
}
location / {
proxy_pass http://backend;
}
}
Install GeoIP module for Apache2¶
In /etc/apache2/apache2.conf: