<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I think I know what the issue is which can give us a clue to what is going on.<div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><font size="1" face="monospace, monospace">2018/10/15 15:05:45.083 kid1| RegexData.cc(71) match: aclRegexData::match: checking '<a href="http://wiki.squid-cache.org:443/" target="_blank" style="color:rgb(17,85,204)">wiki.squid-cache.org:443</a>'</font></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><font size="1" face="monospace, monospace">2018/10/15 15:05:45.084 kid1| RegexData.cc(82) match: aclRegexData::match: looking for '(^<a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl.*)%7C(squid-cache.org/SquidFaq/SquidAcl.*" target="_blank" style="color:rgb(17,85,204)">https://wiki.squid-cache.org/SquidFaq/SquidAcl.*)|(squid-cache.org/SquidFaq/SquidAcl.*</a>)'</font></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><font size="1" face="monospace, monospace">2018/10/15 15:05:45.084 kid1| Acl.cc(321) checklistMatches: ACL::ChecklistMatches: result for 'whitelist' is 0</font></div><br></div></blockquote></div><div>The above seems to be applying the regex to "<a href="http://wiki.squid-cache.org:443">wiki.squid-cache.org:443</a>" instead of to "<a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl">https://wiki.squid-cache.org/SquidFaq/SquidAcl</a>". I added the regex ".*squid-cache.org.*" to my list of regular expressions and now I see this.</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div><div><font face="monospace, monospace" size="1">2018/10/15 15:16:03.641 kid1| RegexData.cc(71) match: aclRegexData::match: checking '<a href="http://wiki.squid-cache.org:443">wiki.squid-cache.org:443</a>'</font></div><div><font face="monospace, monospace" size="1">2018/10/15 15:16:03.641 kid1| RegexData.cc(82) match: aclRegexData::match: looking for '(^https?://[^/]+/<a href="http://wiki.squid-cache.org/SquidFaq/SquidAcl.*)|(squid-cache.org.*">wiki.squid-cache.org/SquidFaq/SquidAcl.*)|(squid-cache.org.*</a>)'</font></div><div><font face="monospace, monospace" size="1">2018/10/15 15:16:03.641 kid1| RegexData.cc(93) match: aclRegexData::match: match '(^https?://[^/]+/<a href="http://wiki.squid-cache.org/SquidFaq/SquidAcl.*)|(squid-cache.org.*">wiki.squid-cache.org/SquidFaq/SquidAcl.*)|(squid-cache.org.*</a>)' found in '<a href="http://wiki.squid-cache.org:443">wiki.squid-cache.org:443</a>'</font></div><div><font face="monospace, monospace" size="1">2018/10/15 15:16:03.641 kid1| Acl.cc(321) checklistMatches: ACL::ChecklistMatches: result for 'whitelist' is 1</font></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div><br></div><div>Any idea why url_regex wouldn't try to match the full url and instead only matches on the subdomain, host domain, and port? </div><div><br></div><div>The <a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl">Squid FAQ</a> says the following:</div></div></div></div><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><strong style="color:rgb(0,0,0);font-family:Arial,"Lucida Grande",sans-serif;font-size:13.6px;text-align:left;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">url_regex</strong><span style="color:rgb(0,0,0);font-family:Arial,"Lucida Grande",sans-serif;font-size:13.6px;text-align:left;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">: URL regular expression pattern matching</span><br></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(0,0,0);font-family:Arial,"Lucida Grande",sans-serif;font-size:13.6px;text-align:left;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><strong style="text-decoration-style:initial;text-decoration-color:initial">urlpath_regex</strong><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">: URL-path regular expression pattern matching, leaves out the protocol and hostname</span></span></div></div></blockquote></div><div><br></div><div>with this example given</div><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>acl special_url url_regex ^<a href="http://www.squid-cache.org/Doc/FAQ/$">http://www.squid-cache.org/Doc/FAQ/$</a><br></div></blockquote></div><div><br></div><div>This seems to be the case between 3.3.8 (default on ubuntu 14.04) and 3.5.12 (default on ubuntu 16.04).</div><div><br></div><div>Is there another configuration that forces url_regex to match the entire url? or should I use a different acl type?</div><div><br></div><div>Best,</div><div><br></div><div class="gmail_quote"><div dir="ltr">On Mon, Oct 15, 2018 at 11:11 AM RB <<a href="mailto:ronthecon@gmail.com">ronthecon@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi Matus,</div><div><br></div><div>Thanks for responding so quickly. I uploaded my configurations here if that is more helpful: <a href="https://bit.ly/2NF4zNb" target="_blank">https://bit.ly/2NF4zNb</a></div><div><br></div><div>The config that I previously shared is called squid_corp.conf. I also noticed that if I don't use regular expressions and instead use domains, it works correctly:</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div><font color="#24292e" face="monospace, monospace" size="1"><span style="white-space:pre-wrap"># acl whitelist url_regex "/vagrant/squid_sites.txt"</span></font></div><div><span style="color:rgb(36,41,46);white-space:pre-wrap;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace" size="1">acl whitelist url_regex .<a href="http://squid-cache.org" target="_blank">squid-cache.org</a></font></span></span></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div><br></div><div><div dir="ltr" style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div dir="ltr"><div>Every time my squid.conf or my squid_sites.txt is modified, I restart the squid service</div><div><br></div></div></div></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div dir="ltr" style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div dir="ltr"><div><font face="monospace, monospace" size="1">sudo service squid3 restart</font></div></div></div></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div dir="ltr" style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div dir="ltr"><div><br></div><div>Then I use curl to test and now the url works. </div><div><br></div></div></div><blockquote style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><font face="monospace, monospace" size="1" color="#000000" style="background-color:rgb(255,255,255)"><span style="white-space:pre-wrap;float:none;display:inline">$ curl -sSL --proxy localhost:3128 -D - <a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl</a></span><span style="white-space:pre-wrap;float:none;display:inline"> -o /dev/null </span><span class="gmail-m_51934750093289444gmail-pl-k" style="box-sizing:border-box;white-space:pre-wrap">2>&1</span></font></div><div><font style="background-color:rgb(255,255,255)" color="#000000" face="monospace, monospace" size="1"><span class="gmail-m_51934750093289444gmail-pl-k" style="box-sizing:border-box;white-space:pre-wrap"><div>HTTP/1.1 200 Connection established</div><div><br></div><div>HTTP/1.1 200 OK</div><div>Date: Mon, 15 Oct 2018 14:47:33 GMT</div><div>Server: Apache/2.4.7 (Ubuntu)</div><div>Vary: Cookie,User-Agent,Accept-Encoding</div><div>Content-Length: 101912</div><div>Cache-Control: max-age=3600</div><div>Expires: Mon, 15 Oct 2018 15:47:33 GMT</div><div>Content-Type: text/html; charset=utf-8</div></span></font></div></div></div></blockquote></div><div><br></div><div>But this does not allow me to get more granular. I can only allow all subdomains and paths for the domain <a href="http://squid-cache.org" target="_blank">squid-cache.org</a> but I'm unable to only allow the regular expressions if I put them inline or put them in squid_sites.txt.</div><div><br></div><div><blockquote style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div><font color="#24292e"><span style="white-space:pre-wrap"><font face="monospace, monospace" size="1"># acl whitelist url_regex "/vagrant/squid_sites.txt"</font></span></font></div><div><span style="color:rgb(36,41,46);white-space:pre-wrap;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace" size="1">acl whitelist url_regex <span style="color:rgb(34,34,34);white-space:normal;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">^<a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl.*" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl.*</a></span></font></span></span></div><div><span style="color:rgb(36,41,46);white-space:pre-wrap;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace" size="1">acl whitelist url_regex <span style="color:rgb(34,34,34);white-space:normal;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">.*<a href="http://squid-cache.org/SquidFaq/SquidAcl.*" target="_blank">squid-cache.org/SquidFaq/SquidAcl.*</a></span></font></span></span></span></div></div></div></blockquote></div><div><br></div><div>If I put them inline like I have above, when I restarted squid it says the following</div><div><br></div></div></div></div></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><font size="1" face="monospace, monospace">2018/10/15 14:54:48 kid1| strtokFile: .*<a href="http://squid-cache.org/SquidFaq/SquidAcl.*" target="_blank">squid-cache.org/SquidFaq/SquidAcl.*</a> not found</font></div></div></div></div></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div>If I put the expressions in the squid_sites.txt the above "not found" message isn't shown and this is the debug output in /var/log/squid3/cache.log (full output <a href="https://pastebin.com/NVwRxVmQ" target="_blank">https://pastebin.com/NVwRxVmQ</a>).</div><div><br></div></div></div></div></div></div></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.083 kid1| Checklist.cc(275) matchNode: 0x7fb0068da2b8 matched=1 async=0 finished=0</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.083 kid1| Acl.cc(336) matches: ACLList::matches: checking whitelist</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.083 kid1| Acl.cc(319) checklistMatches: ACL::checklistMatches: checking 'whitelist'</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.083 kid1| RegexData.cc(71) match: aclRegexData::match: checking '<a href="http://wiki.squid-cache.org:443" target="_blank">wiki.squid-cache.org:443</a>'</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.084 kid1| RegexData.cc(82) match: aclRegexData::match: looking for '(^<a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl.*)%7C(squid-cache.org/SquidFaq/SquidAcl.*" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl.*)|(squid-cache.org/SquidFaq/SquidAcl.*</a>)'</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.084 kid1| Acl.cc(321) checklistMatches: ACL::ChecklistMatches: result for 'whitelist' is 0</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.084 kid1| Acl.cc(349) matches: whitelist mismatched.</font></div><div><font size="1" face="monospace, monospace">2018/10/15 15:05:45.084 kid1| Acl.cc(354) matches: whitelist result is false</font></div></div></div></div></div></div></div></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div>So it's failing the regular expression check. If I use grep to verify if the regex works, it does.</div><div><br></div></div></div></div></div></div></div></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><font face="monospace, monospace" size="1">$ echo <a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl</a> | grep "^<a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl.*" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl.*</a>"</font></div><div><font face="monospace, monospace" size="1"><a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl</a></font></div></div></div></div></div></div></div></div></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> are you aware that you can only see CONNECT in https requests, unless using</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">ssl_bump?</span><br></div><div><br></div><div>Ah interesting. Are you saying that my https connections will always fail unless I use ssl_bump to decrypt https to http connections? How would this work correctly in production? Does squid proxy only block urls if it detects http? How do you configure ssl_bump to work in this case? and is that viable in production?</div><div><br></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> of course it matches all, everything should match "all".</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> I more wonder why doesn't it match "http_access allow localhost"</span><br></div><div dir="ltr"><br></div><div dir="ltr">> <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">have you reloaded squid config after changing it?</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> Did squid confirm it?</span></div><div dir="ltr"><br></div></div></div><div dir="ltr"><div>Would you have an example of one entire config file that would work to whitelist an http/https url using a regular expression?<br></div><div dir="ltr"><br></div><div>Best,</div><div><br></div><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 15, 2018 at 4:49 AM Matus UHLAR - fantomas <<a href="mailto:uhlar@fantomas.sk" target="_blank">uhlar@fantomas.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">KOn 15.10.18 01:04, RB wrote:<br>
>I'm trying to deny all urls except for only whitelisted regular<br>
>expressions. I have only this regular expression in my file<br>
>"squid_sites.txt"<br>
><br>
>^<a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl.*" rel="noreferrer" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl.*</a><br>
<br>
are you aware that you can only see CONNECT in https requests, unless using<br>
ssl_bump?<br>
<br>
<br>
>acl bastion src <a href="http://10.5.0.0/1" rel="noreferrer" target="_blank">10.5.0.0/1</a><br>
>acl whitelist url_regex "/vagrant/squid_sites.txt"<br>
[...]<br>
>http_access allow manager localhost<br>
>http_access deny manager<br>
>http_access deny !Safe_ports<br>
>http_access allow localhost<br>
>http_access allow purge localhost<br>
>http_access deny purge<br>
>http_access deny CONNECT !SSL_ports<br>
><br>
>http_access allow bastion whitelist<br>
>http_access deny bastion all<br>
<br>
>I tried enabling debugging and tailing /var/log/squid3/cache.log but my<br>
>curl statement keeps matching "all".<br>
<br>
of course it matches all, everything should match "all".<br>
<br>
I more wonder why doesn't it match "http_access allow localhost"<br>
<br>
>$ curl -sSL --proxy localhost:3128 -D - "<br>
><a href="https://wiki.squid-cache.org/SquidFaq/SquidAcl" rel="noreferrer" target="_blank">https://wiki.squid-cache.org/SquidFaq/SquidAcl</a>" -o /dev/null 2>&1 | grep<br>
>Squid<br>
>X-Squid-Error: ERR_ACCESS_DENIED 0<br>
<br>
>Any ideas what I'm doing wrong?<br>
<br>
have you reloaded squid config after changing it?<br>
Did squid confirm it?<br>
<br>
-- <br>
Matus UHLAR - fantomas, <a href="mailto:uhlar@fantomas.sk" target="_blank">uhlar@fantomas.sk</a> ; <a href="http://www.fantomas.sk/" rel="noreferrer" target="_blank">http://www.fantomas.sk/</a><br>
Warning: I wish NOT to receive e-mail advertising to this address.<br>
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.<br>
It's now safe to throw off your computer.<br>
_______________________________________________<br>
squid-users mailing list<br>
<a href="mailto:squid-users@lists.squid-cache.org" target="_blank">squid-users@lists.squid-cache.org</a><br>
<a href="http://lists.squid-cache.org/listinfo/squid-users" rel="noreferrer" target="_blank">http://lists.squid-cache.org/listinfo/squid-users</a><br>
</blockquote></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div></div></div>