Search squid archive

Re: ERROR: NAT/TPROXY lookup failed to locate original IPs on local

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rafael,
First off i'd like to thank you for the link you provided, it was really helpful.
I've successfully installed squid and routed the traffic to the proxy thanks to the diladele link, unfortunately i couldn't install websafety as ubuntu removed squid 4.1-1 from their repo and had 4.3-1, i tried with 4.3 but there were problems with websafety... so installed squid 3.5 from source with ssl enabled, I used the websafety squid.conf as reference, now i have my proxy working, and i have connected greasyspoon to it, but greasyspoon only adapts http content, how do i get it to adapt https traffic? and this is assuming the ssl_bumping works, because i don't know how to confirm if it does, i see https connections in the access.log though.

please see attached my squid.conf
cache_effective_user proxy
acl localnet src 10.0.0.0/24
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl localnet src fc00::/7
acl localnet src fe80::/10
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_port 3128 ssl-bump  generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/opt/websafety/etc/myca.pem
http_port 3126 intercept
https_port 3127 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/opt/websafety/etc/myca.pem
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all
sslcrtd_program /usr/local/squid/libexec/ssl_crtd -s /var/spool/squid_ssldb -M 4MB
acl step1 at_step SslBump1
acl step2 at_step SslBump2
acl step3 at_step SslBump3
ssl_bump peek step1 all
ssl_bump bump all
ssl_bump bump ssl_force_bump
ssl_bump splice localhost
acl ssl_error_domains dstdomain "/opt/websafety/etc/squid/ssl/error/domains.conf"
acl ssl_error_ips     dst       "/opt/websafety/etc/squid/ssl/error/ips.conf"
acl ssl_error_ips     dst       "/opt/websafety/etc/squid/ssl/error/subnets.conf"
sslproxy_cert_error allow ssl_error_domains
sslproxy_cert_error allow ssl_error_ips
shutdown_lifetime 10 seconds
adaptation_access greasyspoon allow all
visible_hostname proxy.example.lan
acl cache_exclude_domainname dstdomain "/opt/websafety/etc/squid/cache/exclude/domain_name.conf"
acl cache_exclude_domainaddr dst       "/opt/websafety/etc/squid/cache/exclude/domain_ip.conf"
acl cache_exclude_domainaddr dst       "/opt/websafety/etc/squid/cache/exclude/domain_subnet.conf"
acl cache_exclude_domainaddr dst       "/opt/websafety/etc/squid/cache/exclude/domain_range.conf"
acl cache_exclude_useraddr src "/opt/websafety/etc/squid/cache/exclude/user_ip.conf"
acl cache_exclude_useraddr src "/opt/websafety/etc/squid/cache/exclude/user_subnet.conf"
acl cache_exclude_useraddr src "/opt/websafety/etc/squid/cache/exclude/user_range.conf"
acl cache_exclude_useragent   browser -i    "/opt/websafety/etc/squid/cache/exclude/user_agent.conf"
acl cache_exclude_schedule    time          "/opt/websafety/etc/squid/cache/exclude/schedule.conf"
cache deny cache_exclude_domainname
cache deny cache_exclude_domainaddr
cache deny cache_exclude_useraddr
cache deny cache_exclude_useragent
cache deny cache_exclude_schedule
acl cache_exclude_contenttype rep_mime_type "/opt/websafety/etc/squid/cache/exclude/content_type.conf"
send_hit deny cache_exclude_contenttype
store_miss deny cache_exclude_contenttype
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320
cache_replacement_policy lru
minimum_object_size 0 KB
maximum_object_size 4096 KB
dns_timeout 30 seconds
dns_v4_first on
icap_enable on
icap_preview_enable off
icap_preview_size 2048
icap_persistent_connections on
adaptation_send_client_ip on
adaptation_send_username on
icap_service greasyspoon respmod_precache icap://127.0.0.1:1344/response bypass=0
cache_mem 256 MB
maximum_object_size_in_memory 512 KB
memory_replacement_policy lru
forwarded_for on
forward_max_tries 25


also part of my access.log
1540473704.606   1021 10.0.0.250 TAG_NONE/200 0 CONNECT 52.97.133.226:443 - HIER_NONE/- -
1540473711.552 465997 10.0.0.254 TCP_TUNNEL/200 4350 CONNECT outlook.office365.com:443 - ORIGINAL_DST/52.97.131.242 -
1540473711.552 163713 10.0.0.254 TCP_TUNNEL/200 4320 CONNECT inbox.google.com:443 - ORIGINAL_DST/216.58.223.197 -
1540473711.552 163689 10.0.0.254 TCP_TUNNEL/200 4231 CONNECT inbox.google.com:443 - ORIGINAL_DST/216.58.223.197 -

and part of my cache.log
2018/10/25 11:36:21 kid1| Accepting SSL bumped HTTP Socket connections at local=[::]:3128 remote=[::] FD 22 flags=9
2018/10/25 11:36:21 kid1| Accepting NAT intercepted HTTP Socket connections at local=[::]:3126 remote=[::] FD 23 flags=41
2018/10/25 11:36:21 kid1| Accepting NAT intercepted SSL bumped HTTPS Socket connections at local=[::]:3127 remote=[::] FD 24 flags=41
2018/10/25 11:36:22 kid1| storeLateRelease: released 0 objects
2018/10/25 11:42:08| Squid is already running!  Process ID 3497
2018/10/25 11:46:20| Squid is already running!  Process ID 3497
2018/10/25 11:46:24| Squid is already running!  Process ID 3497
2018/10/25 11:49:32 kid1| SECURITY ALERT: Host header forgery detected on local=52.97.133.178:443 remote=10.0.0.250:39627 FD 39 flags=33 (local IP does not match any domain IP)
2018/10/25 11:49:32 kid1| SECURITY ALERT: on URL: outlook.office365.com:443
2018/10/25 11:49:32 kid1| SECURITY ALERT: Host header forgery detected on local=52.97.133.178:443 remote=10.0.0.250:39628 FD 39 flags=33 (local IP does not match any domain IP)
2018/10/25 11:49:32 kid1| SECURITY ALERT: on URL: outlook.office365.com:443
2018/10/25 11:49:32 kid1| SECURITY ALERT: Host header forgery detected on local=52.97.133.178:443 remote=10.0.0.250:39629 FD 39 flags=33 (local IP does not match any domain IP)


please how do i get the adaptation to work for https traffic?
Thanks for everyones help.




Uchenna Nebedum

On Fri, Oct 19, 2018, 20:09 Rafael Akchurin <rafael.akchurin@xxxxxxxxxxxx> wrote:

Yes you can use any ICAP/eCAP server you like, just adjust the docs as required and that is it.

 

From: Uchenna Nebedum <nebeduch@xxxxxxxxx>
Sent: Friday, 19 October 2018 20:17
To: Rafael Akchurin <rafael.akchurin@xxxxxxxxxxxx>
Cc: squid-users@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: ERROR: NAT/TPROXY lookup failed to locate original IPs on local

 

Thanks a lot Rafael, I've gone through the documentation it looks to be very promising, one reservation i have is I want to use greasyspoon for icap and i see ecap is implemented already. I intend to install everything as suggested on the link, then after this change squid.conf to remove ecap connection.

Please, I hope this will work? 

 

Thanks a lot again for the link, it really explained everything well enough for a beginner.

Uchenna Nebedum

 

On Fri, Oct 19, 2018, 18:30 Rafael Akchurin <rafael.akchurin@xxxxxxxxxxxx> wrote:

Hello Uchenna,

 

May be this policy based routing with Mikrotik tutorial will be of any use

See https://docs.diladele.com/tutorials/mikrotik_transparent_squid/index.html

 

Best regards,

Rafael Akchurin

Diladele B.V.

 

 

From: squid-users <squid-users-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Uchenna Nebedum
Sent: Friday, 19 October 2018 18:42
To: squid-users@xxxxxxxxxxxxxxxxxxxxx
Subject: ERROR: NAT/TPROXY lookup failed to locate original IPs on local

 

Good Day All,

i'm new to squid and i have configured squid as an http transparent proxy with a mikrotik.

the squid server has only a single NIC, so i followed a tutorial and set up a dst-nat to squid proxy for traffic on port 80,

Chain:dstnat.

Protocol:tcp

Dst-port:80

Action:dst-nat

To Addresses:192.168.2.2 (squid proxy)

To ports:8080

but after setup, only https traffic works correctly,

http traffic client error is "This page isn't working ERR_EMPTY_RESPONSE"

squid access.log is empty then in squid cache.log these are the errors

 

```

2018/10/19 17:08:54 kid1| ERROR: NF getsockopt(ORIGINAL_DST) failed on local=192.168.2.2:8080 remote=192.168.1.254:41248 FD 10 flags=33: (92) Protocol not available
2018/10/19 17:08:54 kid1| ERROR: NAT/TPROXY lookup failed to locate original IPs on local=192.168.2.2:8080 remote=192.168.1.254:41248 FD 10 flags=33

```

please find below my squid.conf contents

 

```

acl localnet src 192.168.1.0/24   
acl SSL_ports port 443
acl Safe_ports port 80       
acl Safe_ports port 21       
acl Safe_ports port 443       
acl Safe_ports port 70       
acl Safe_ports port 210       
acl Safe_ports port 1025-65535   
acl Safe_ports port 280       
acl Safe_ports port 488       
acl Safe_ports port 591       
acl Safe_ports port 777       
acl CONNECT method CONNECT
icap_enable off
icap_service service_req reqmod_precache 1 icap://127.0.0.1:1344/REQMOD
adaptation_service_set class_req service_req
adaptation_access class_req allow all
icap_service service_resp respmod_precache 0 icap://127.0.0.1:1344/RESPMOD
adaptation_service_set class_resp service_resp
adaptation_access class_resp allow all
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access deny to_localhost
http_access allow localnet
http_access allow localhost
http_access allow all
http_port 3128
http_port 8080 transparent
 access_log daemon:/var/log/squid/access.log squid
coredump_dir /var/spool/squid
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .        0    20%    4320

```

please any help or correction would be highly appreciated, i am not even sure if the approach is correct.


--

Nebedum Uchenna

_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux