You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by shinrich <gi...@git.apache.org> on 2016/05/04 03:54:37 UTC

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

GitHub user shinrich opened a pull request:

    https://github.com/apache/trafficserver/pull/614

    TS-3485: Support ip_allow config for HTTP2

    Actually enforce the ip-level ACL checks for HTTP2 and move to the accept logic to make the decision before creating the session object.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shinrich/trafficserver ts-3485

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/614.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #614
    
----
commit adbec07a85f43c482797237e538c820b67dd1a4c
Author: Susan Hinrichs <sh...@ieee.org>
Date:   2016-05-04T01:49:30Z

    TS-3485: Support ip_allow config for HTTP2

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-217020754
  
    Looks like it needs to be clang-formatted there are a few formatting issues.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by shinrich <gi...@git.apache.org>.
Github user shinrich commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/614#discussion_r62066950
  
    --- Diff: proxy/http2/Http2SessionAccept.cc ---
    @@ -38,9 +39,22 @@ Http2SessionAccept::~Http2SessionAccept()
     void
     Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferReader *reader)
     {
    +  AclRecord *session_acl_record = NULL;
    +  sockaddr const *client_ip = netvc->get_remote_addr();
    +  IpAllow::scoped_config ipallow;
    +  if (ipallow && (((session_acl_record = ipallow->match(client_ip)) == NULL) || (session_acl_record->isEmpty()))) {
    +    ip_port_text_buffer ipb;
    +    Warning("http2 client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
    --- End diff --
    
    Actually looking more closely at both cases, both HTTP1 and HTTP2 fail if there is no record.  I'll try to push this test into the super class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by shinrich <gi...@git.apache.org>.
Github user shinrich commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-217023387
  
    Yes, planning on running clang-format and squashing before mergin.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by shinrich <gi...@git.apache.org>.
Github user shinrich commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-216918182
  
    The method checks are done in HttpTransact.  The acl_record is stored on the ProxyClientTransaction object for that later check.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-216920012
  
    Don't you need to check what is being denied at the higher level?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/614#discussion_r61987839
  
    --- Diff: proxy/http2/Http2SessionAccept.cc ---
    @@ -38,9 +39,22 @@ Http2SessionAccept::~Http2SessionAccept()
     void
     Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferReader *reader)
     {
    +  AclRecord *session_acl_record = NULL;
    +  sockaddr const *client_ip = netvc->get_remote_addr();
    +  IpAllow::scoped_config ipallow;
    +  if (ipallow && (((session_acl_record = ipallow->match(client_ip)) == NULL) || (session_acl_record->isEmpty()))) {
    +    ip_port_text_buffer ipb;
    +    Warning("http2 client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
    --- End diff --
    
    Oh so this is fail-closed when there is no config? If that is the case, then HTTP/1 should do the same thing. We should have a single function that does this check for both protocols to avoid this kind of drift.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/614#discussion_r62123967
  
    --- Diff: proxy/http2/Http2SessionAccept.cc ---
    @@ -38,19 +39,25 @@ Http2SessionAccept::~Http2SessionAccept()
     void
     Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferReader *reader)
     {
    +  sockaddr const *client_ip = netvc->get_remote_addr();
    +  const AclRecord *session_acl_record = testIpAllowPolicy(client_ip);
    +  if (!session_acl_record) {
    +    ip_port_text_buffer ipb;
    +    Warning("HTTP/2 client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
    +    netvc->do_io_close();
    +    return;
    +  } 
    --- End diff --
    
    There is an extra space at the end of this line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/614#discussion_r61987763
  
    --- Diff: proxy/http2/Http2SessionAccept.cc ---
    @@ -38,9 +39,22 @@ Http2SessionAccept::~Http2SessionAccept()
     void
     Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferReader *reader)
     {
    +  AclRecord *session_acl_record = NULL;
    +  sockaddr const *client_ip = netvc->get_remote_addr();
    +  IpAllow::scoped_config ipallow;
    +  if (ipallow && (((session_acl_record = ipallow->match(client_ip)) == NULL) || (session_acl_record->isEmpty()))) {
    +    ip_port_text_buffer ipb;
    +    Warning("http2 client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
    +    netvc->do_io_close();
    +    return;
    +  } else if (!session_acl_record) {
    --- End diff --
    
    You would get here if ``ipallow`` is false ... that doesn't seem right?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-216916522
  
    Where is the check on the method?  Each individual stream would need to be verified. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/614#discussion_r61987639
  
    --- Diff: proxy/http2/Http2SessionAccept.cc ---
    @@ -38,9 +39,22 @@ Http2SessionAccept::~Http2SessionAccept()
     void
     Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferReader *reader)
     {
    +  AclRecord *session_acl_record = NULL;
    +  sockaddr const *client_ip = netvc->get_remote_addr();
    +  IpAllow::scoped_config ipallow;
    +  if (ipallow && (((session_acl_record = ipallow->match(client_ip)) == NULL) || (session_acl_record->isEmpty()))) {
    +    ip_port_text_buffer ipb;
    +    Warning("http2 client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
    --- End diff --
    
    This is a user-visible message, so "HTTP/2" would be better.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/trafficserver/pull/614


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by shinrich <gi...@git.apache.org>.
Github user shinrich commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-216965627
  
    Just pushed another commit that moves the IP-based ip allow checking to the SessionAccept superclass.  Verified for IP-based and method-based policies.  The method-based denies will return an error header and body.  The IP-based denies just closed the connection.
    
    @bryancall I'm not following your question about checking what is denied at a higher level.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/614#discussion_r61987633
  
    --- Diff: proxy/http2/Http2SessionAccept.cc ---
    @@ -50,7 +64,7 @@ Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferRead
     
       // XXX Allocate a Http2ClientSession
    --- End diff --
    
    Looks like this "XXX" is done now?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3485: Support ip_allow config for H...

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on the pull request:

    https://github.com/apache/trafficserver/pull/614#issuecomment-217023707
  
    Besides the formatting it looks good.  I was meaning from above that you would have to check the allowed methods at the at the session level.  I missed the isEmpty() before.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---