You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/07/26 18:09:43 UTC

[GitHub] [trafficserver] ezelkow1 opened a new pull request, #8982: Add anonymous mmdb support

ezelkow1 opened a new pull request, #8982:
URL: https://github.com/apache/trafficserver/pull/8982

   Adds a new anonymous field for when you are using mmdbs with anonymous IP support


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ezelkow1 commented on a diff in pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
ezelkow1 commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r930500749


##########
doc/admin-guide/plugins/maxmind_acl.en.rst:
##########
@@ -78,3 +78,32 @@ Optional
 ========
 
 There is an optional ``html`` field which takes a html file that will be used as the body of the response for any denied requests if you wish to use a custom one.
+
+Anonymous
+=========
+
+There is also an optional ``anonymous`` field. This allows you to use the maxmind anonymous IP database and reference it's optional fields. These are ``ip``, ``vpn``, 

Review Comment:
   yes, meant to be used with, https://dev.maxmind.com/geoip/docs/databases/anonymous-ip?lang=en#binary-database (product page: https://www.maxmind.com/en/solutions/geoip2-enterprise-product-suite/anonymous-ip-database), the maxmind anonymous IP database. It's the same format but more barebones than the normal geo since its just a handful of fields returned with no nested structure to it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] randall commented on a diff in pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
randall commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r930441243


##########
doc/admin-guide/plugins/maxmind_acl.en.rst:
##########
@@ -78,3 +78,32 @@ Optional
 ========
 
 There is an optional ``html`` field which takes a html file that will be used as the body of the response for any denied requests if you wish to use a custom one.
+
+Anonymous
+=========
+
+There is also an optional ``anonymous`` field. This allows you to use the maxmind anonymous IP database and reference it's optional fields. These are ``ip``, ``vpn``, 

Review Comment:
   MaxMind GeoIP2 Anonymous IP database?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] brbzull0 commented on a diff in pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
brbzull0 commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r931143752


##########
plugins/experimental/maxmind_acl/mmdb.cc:
##########
@@ -497,6 +577,94 @@ Acl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp)
   return ret;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+// Returns true if entry data contains an
+// allowable non-anonymous IP.
+// False otherwise
+bool
+Acl::eval_anonymous(MMDB_entry_s *entry)
+{
+  MMDB_entry_data_s entry_data;
+  int status;
+
+  // For each value we only care if it was successful and if there was data.
+  // We can have unsuccessful gets in the instance an IP is not one of the things
+  // we are asking for, so its not an error
+  if (_anonymous_ip) {
+    status = MMDB_get_value(entry, &entry_data, "is_anonymous", NULL);
+    if ((MMDB_SUCCESS == status) && (entry_data.has_data)) {
+      if (entry_data.type == MMDB_DATA_TYPE_BOOLEAN) {
+        if (entry_data.boolean == true) {
+          TSDebug(PLUGIN_NAME, "saw is_anonymous set to true bool");
+          return false;
+        }
+      }
+    }

Review Comment:
   not an issue.
   Maybe you can have an lambda function in here to perform this field get and call it for every field, code seems similar except for the field name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ezelkow1 merged pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
ezelkow1 merged PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] randall commented on a diff in pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
randall commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r931638725


##########
doc/admin-guide/plugins/maxmind_acl.en.rst:
##########
@@ -78,3 +78,32 @@ Optional
 ========
 
 There is an optional ``html`` field which takes a html file that will be used as the body of the response for any denied requests if you wish to use a custom one.
+
+Anonymous
+=========
+
+There is also an optional ``anonymous`` field. This allows you to use the maxmind anonymous IP database and reference it's optional fields. These are ``ip``, ``vpn``, 

Review Comment:
   Sorry, I meant to say replace "maxmind anonymous IP database" with "MaxMind GeoIP2 Anonymous IP database". (adding capitalization to the company and product names).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ezelkow1 commented on a diff in pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
ezelkow1 commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r930500749


##########
doc/admin-guide/plugins/maxmind_acl.en.rst:
##########
@@ -78,3 +78,32 @@ Optional
 ========
 
 There is an optional ``html`` field which takes a html file that will be used as the body of the response for any denied requests if you wish to use a custom one.
+
+Anonymous
+=========
+
+There is also an optional ``anonymous`` field. This allows you to use the maxmind anonymous IP database and reference it's optional fields. These are ``ip``, ``vpn``, 

Review Comment:
   yes, meant to be used with, https://dev.maxmind.com/geoip/docs/databases/anonymous-ip?lang=en#binary-database, the maxmind anonymous IP database. It's the same format but more barebones than the normal geo since its just a handful of fields returned with no nested structure to it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ezelkow1 commented on a diff in pull request #8982: Add anonymous mmdb support

Posted by GitBox <gi...@apache.org>.
ezelkow1 commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r932618729


##########
plugins/experimental/maxmind_acl/mmdb.cc:
##########
@@ -497,6 +577,94 @@ Acl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp)
   return ret;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+// Returns true if entry data contains an
+// allowable non-anonymous IP.
+// False otherwise
+bool
+Acl::eval_anonymous(MMDB_entry_s *entry)
+{
+  MMDB_entry_data_s entry_data;
+  int status;
+
+  // For each value we only care if it was successful and if there was data.
+  // We can have unsuccessful gets in the instance an IP is not one of the things
+  // we are asking for, so its not an error
+  if (_anonymous_ip) {
+    status = MMDB_get_value(entry, &entry_data, "is_anonymous", NULL);
+    if ((MMDB_SUCCESS == status) && (entry_data.has_data)) {
+      if (entry_data.type == MMDB_DATA_TYPE_BOOLEAN) {
+        if (entry_data.boolean == true) {
+          TSDebug(PLUGIN_NAME, "saw is_anonymous set to true bool");
+          return false;
+        }
+      }
+    }

Review Comment:
   yea, eventually Im planning on breaking it out more like that to make it more generic (we have some internal ideas around custom maxmind databases so the hope would be to basically have this be based just on a field name in the config and could be completely arbitrary)
   
   just wanted to get this out there for now in a working state



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org