{"id":163,"date":"2024-10-04T10:04:33","date_gmt":"2024-10-04T13:04:33","guid":{"rendered":"https:\/\/thiagoldaniel.com.br\/?p=163"},"modified":"2024-10-04T10:04:33","modified_gmt":"2024-10-04T13:04:33","slug":"configurar-protecao-de-geo-ip-no-apache2-proxy-reverso-ou-publicacao-de-websites","status":"publish","type":"post","link":"https:\/\/thiagoldaniel.com.br\/index.php\/2024\/10\/04\/configurar-protecao-de-geo-ip-no-apache2-proxy-reverso-ou-publicacao-de-websites\/","title":{"rendered":"Configurar Prote\u00e7\u00e3o de GEO IP no Apache2 (Proxy Reverso ou Publica\u00e7\u00e3o de Websites)."},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Apache Reverse Proxy with GeoIP<\/strong><\/h3>\n\n\n\n<p><br>O Apache pode usar os m\u00f3dulos mod_geoip ou mod_maxminddb para restringir o acesso com base no pa\u00eds de origem da requisi\u00e7\u00e3o ao servi\u00e7o.<\/p>\n\n\n\n<p>Abaixo explicamos como implementar esta modalidade de prote\u00e7\u00e3o.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">a. <strong>Instalar Modulo  GeoIP Module<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Para instalar o <strong>GeoIP<\/strong> executar o comando <code><strong>sudo apt-get install libapache2-mod-geoip geoip-database<\/strong><\/code><\/li>\n\n\n\n<li>Para instalar o <strong>GeoLite2<\/strong>: Voc\u00ea precisa instalar os modulo  <code><strong>mod_maxminddb<\/strong><\/code> <code>sudo <strong>apt-get install libmaxminddb-dev mmdb-bin<\/strong><\/code><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">b. <strong>Configurar o  Apache com GeoIP<\/strong><\/h4>\n\n\n\n<p>Ap\u00f3s instalar os m\u00f3dulos GeoIP or GeoLite2, necess\u00e1rio configurar o apache:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Habilitar os m\u00f3dulos <code><strong>sudo a2enmod geoip<\/strong><\/code><\/li>\n\n\n\n<li>Configurar o virtual host que est\u00e1 sendo exposto no proxyreverso utilizando como referencia o <strong>EXEMPLO<\/strong> abaixo:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted has-medium-font-size\"><code>&lt;VirtualHost *:80><br>    ServerName yourdomain.com<br><br>    ProxyPass \/ http:\/\/backend_server\/<br>    ProxyPassReverse \/ http:\/\/backend_server\/<br><br><strong>    GeoIPEnable On<br>    GeoIPDBFile \/usr\/share\/GeoIP\/GeoIP.dat<br><br>    SetEnvIf GEOIP_COUNTRY_CODE BR AllowCountry<br>    SetEnvIf GEOIP_COUNTRY_CODE IT AllowCountry<br>    SetEnvIf GEOIP_COUNTRY_CODE AR AllowCountry<br>    SetEnvIf GEOIP_COUNTRY_CODE MA AllowCountry<br>    SetEnvIf GEOIP_COUNTRY_CODE MX AllowCountry<\/strong><br><br>    &lt;Location \/><br>        Order deny,allow<br>        Deny from all<br>        Allow from env=AllowCountry<br>    &lt;\/Location><br>&lt;\/VirtualHost><br><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A variavel <code><strong>SetEnvIf GEOIP_COUNTRY_CODE<\/strong><\/code> permite o acesso a partir destes paises.<\/li>\n\n\n\n<li>As diretivas Order deny,allow e Deny from all bloqueiam todo o acesso, exceto para os pa\u00edses definidos em AllowCountry.<\/li>\n<\/ul>\n\n\n\n<p>Testado no Ubuntu 20.04.6.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache Reverse Proxy with GeoIP O Apache pode usar os m\u00f3dulos mod_geoip ou mod_maxminddb para restringir o acesso com base no pa\u00eds de origem da requisi\u00e7\u00e3o ao servi\u00e7o. Abaixo explicamos como implementar esta modalidade de prote\u00e7\u00e3o. a. Instalar Modulo GeoIP Module b.<\/p>\n<p class=\"link-more\"><a class=\"myButt three\" href=\"https:\/\/thiagoldaniel.com.br\/index.php\/2024\/10\/04\/configurar-protecao-de-geo-ip-no-apache2-proxy-reverso-ou-publicacao-de-websites\/\">Leia Mais&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,15,35],"tags":[36,49,16,50,37,51],"class_list":["post-163","post","type-post","status-publish","format-standard","hentry","category-apache","category-linux","category-proxy-reverso","tag-apache","tag-geoip","tag-linux","tag-proxy","tag-proxyreverso","tag-security"],"_links":{"self":[{"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/posts\/163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=163"}],"version-history":[{"count":1,"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/posts\/163\/revisions"}],"predecessor-version":[{"id":164,"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/posts\/163\/revisions\/164"}],"wp:attachment":[{"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thiagoldaniel.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}