• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

mime type for DoH?

General pfSense Questions
mime doh access-list acl squidproxy
2
6
355
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    JonathanLee
    last edited by JonathanLee Jan 12, 2025, 5:49 AM Jan 10, 2025, 11:01 PM

    Hello fellow Netgate Community Members,

    I have this hair brained idea to stop playing wackamole and use the mime type to block DoH

    For example:
    acl deny_rep_mime_flashvideo rep_mime_type video/flv

    I have this hair brained idea to use the media type and get rid of the endless list.

    Could this work?

    acl deny_rep_mime_doh rep_mime_type application/dns-message

    and if this works could the same be done with pfblocking?

    https://www.iana.org/assignments/media-types/media-types.xhtml

    This lists mime types for doh with rfc 8484 and 8427 so technically could I just create a mime block for DoH and stop creating endless lists?

    https://www.iana.org/assignments/media-types/application/dns-message
    https://www.iana.org/assignments/media-types/application/dns+json

    https://wiki.squid-cache.org/ConfigExamples/BlockingMimeTypes

    The same DNS query for "www.example.com", using the POST method would
    be:

    :method = POST
    :scheme = https
    :authority = dnsserver.example.net
    :path = /dns-query
    accept = application/dns-message
    content-type = application/dns-message
    content-length = 33

    Make sure to upvote

    1 Reply Last reply Reply Quote 0
    • J
      JonathanLee
      last edited by Jan 10, 2025, 11:13 PM

      @JonathanLee said in mime type for DoH?:

      acl deny_rep_mime_doh rep_mime_type application/dns-message

      "(RFC 4027 published April 2005, subtype last updated April 2005)

      MIME media type name: application

      MIME subtype name: dns

      Required parameters: None.

      Optional parameters: None."

      so it is a MIME type..

      Make sure to upvote

      J 1 Reply Last reply Jan 10, 2025, 11:22 PM Reply Quote 0
      • J
        johnpoz LAYER 8 Global Moderator @JonathanLee
        last edited by johnpoz Jan 10, 2025, 11:22 PM Jan 10, 2025, 11:22 PM

        @JonathanLee so your doing mitm on all your ssl traffic? I don't think you can see the mime types unless your doing a ssl bump with squid or what do they call it now peek and splice or has its name changed again.

        But your not going to be able to see that info unless your doing mitm..

        And sure you could prob accomplish that on something you can control what it trusts, but devices like phones and such that are more likely to be using doh when you really don't want them to is much harder to accomplish a mitm with.

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

        J 1 Reply Last reply Jan 10, 2025, 11:26 PM Reply Quote 1
        • J
          JonathanLee @johnpoz
          last edited by Jan 10, 2025, 11:26 PM

          @johnpoz its all ssl intercept with certificates installed on them, the wackamole is getting old with it. I am think this might help.

          acl deny_rep_mime_doh rep_mime_type application/dns-message
          acl deny_rep_mime_doh rep_mime_type text/dns
          acl deny_rep_mime_doh rep_mime_type application/dns+json
          http_reply_access deny deny_rep_mime_doh
          

          Make sure to upvote

          J 1 Reply Last reply Jan 11, 2025, 12:41 AM Reply Quote 0
          • J
            johnpoz LAYER 8 Global Moderator @JonathanLee
            last edited by Jan 11, 2025, 12:41 AM

            @JonathanLee have fun - so you have mitm work for your phones and such? Those are the sort of devices that I would think would most likely be using doh, or iot type devices.

            I can easy disable doh on my browser on my OS, etc. or easy get it to trust a mitm cert in the browser. But applications are sometimes don't use what you might set in the trust store in your OS, etc.

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.7.2, 24.11

            J 1 Reply Last reply Jan 11, 2025, 1:42 AM Reply Quote 0
            • J
              JonathanLee @johnpoz
              last edited by JonathanLee Jan 11, 2025, 1:48 AM Jan 11, 2025, 1:42 AM

              @johnpoz I have it broke up like this

              # This file is automatically generated by pfSense
              # Do not edit manually !
              
              http_port 192.168.1.1:3128 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=100MB cert=/usr/local/etc/squid/serverkey.pem cafile=/usr/local/share/certs/ca-root-nss.crt capath=/usr/local/share/certs/ cipher=EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:HIGH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS tls-dh=prime256v1:/etc/dh-parameters.2048 options=NO_SSLv3,SINGLE_DH_USE,SINGLE_ECDH_USE
              
              http_port 127.0.0.1:3128 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=100MB cert=/usr/local/etc/squid/serverkey.pem cafile=/usr/local/share/certs/ca-root-nss.crt capath=/usr/local/share/certs/ cipher=EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:HIGH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS tls-dh=prime256v1:/etc/dh-parameters.2048 options=NO_SSLv3,SINGLE_DH_USE,SINGLE_ECDH_USE
              
              https_port 127.0.0.1:3129 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=100MB cert=/usr/local/etc/squid/serverkey.pem cafile=/usr/local/share/certs/ca-root-nss.crt capath=/usr/local/share/certs/ cipher=EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:HIGH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS tls-dh=prime256v1:/etc/dh-parameters.2048 options=NO_SSLv3,SINGLE_DH_USE,SINGLE_ECDH_USE
              
              icp_port 0
              digest_generation off
              dns_v4_first on
              pid_filename /var/run/squid/squid.pid
              cache_effective_user squid
              cache_effective_group proxy
              error_default_language en
              icon_directory /usr/local/etc/squid/icons
              visible_hostname Lee_Family.home.arpa
              cache_mgr jonathanlee571@gmail.com
              access_log /nvme/LOGS_Optane/Squid_Logs/access.log
              cache_log /nvme/LOGS_Optane/Squid_Logs/cache.log
              cache_store_log none
              netdb_filename /nvme/LOGS_Optane/Squid_Logs/netdb.state
              pinger_enable on
              pinger_program /usr/local/libexec/squid/pinger
              sslcrtd_program /usr/local/libexec/squid/security_file_certgen -s /var/squid/lib/ssl_db -M 4MB -b 2048
              tls_outgoing_options cafile=/usr/local/share/certs/ca-root-nss.crt
              tls_outgoing_options capath=/usr/local/share/certs/
              tls_outgoing_options options=NO_SSLv3,SINGLE_DH_USE,SINGLE_ECDH_USE
              tls_outgoing_options cipher=EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:HIGH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS
              sslcrtd_children 50
              
              logfile_rotate 10
              debug_options rotate=10
              shutdown_lifetime 3 seconds
              # Allow local network(s) on interface(s)
              acl localnet src  192.168.1.0/27
              forwarded_for delete
              via off
              httpd_suppress_version_string on
              uri_whitespace strip
              
              acl block_hours time 00:30-05:00
              ssl_bump terminate all block_hours
              http_access deny all block_hours
              icp_port 0
              htcp_port 0
              snmp_port 0
              icp_access deny all
              htcp_access deny all
              snmp_access deny all
              acl getmethod method GET
              acl to_ipv6 dst ipv6
              acl from_ipv6 src ipv6
              
              #tls_outgoing_options cipher=HIGH:MEDIUM:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS
              tls_outgoing_options options=NO_SSLv3,NO_TLSv1,NO_TLSv1_1,NO_TICKET,SINGLE_DH_USE,SINGLE_ECDH_USE
              #tls_outgoing_options default-ca=on
              
              acl HttpAccess dstdomain '/usr/local/pkg/http.access'
              acl windowsupdate dstdomain '/usr/local/pkg/windowsupdate'
              #acl rewritedoms dstdomain '/usr/local/pkg/desdom'
              
              #store_id_program /usr/local/libexec/squid/storeid_file_rewrite /var/squid/storeid/storeid_rewrite.txt
              #store_id_children 10 startup=5 idle=1 concurrency=0
              #always_direct allow all
              #store_id_access deny connect
              #store_id_access deny !getmethod
              #store_id_access allow rewritedoms
              #store_id_access deny all
              
              refresh_all_ims on
              reload_into_ims on
              max_stale 20 years
              minimum_expiry_time 0
              
              refresh_pattern -i windowsupdate.com/.*.(cab|exe|ms[i|u|f|p]|[ap]sf|wm[v|a]|dat|zip|psf) 43200 80% 129600 reload-into-ims
              refresh_pattern -i microsoft.com/.*.(cab|exe|ms[i|u|f|p]|[ap]sf|wm[v|a]|dat|zip|psf) 43200 80% 129600 reload-into-ims
              refresh_pattern -i windows.com/.*.(cab|exe|ms[i|u|f|p]|[ap]sf|wm[v|a]|dat|zip|psf) 43200 80% 129600 reload-into-ims
              refresh_pattern -i microsoft.com.akadns.net/.*.(cab|exe|ms[i|u|f|p]|[ap]sf|wm[v|a]|dat|zip|psf) 43200 80% 129600 reload-into-ims
              refresh_pattern -i deploy.akamaitechnologies.com/.*.(cab|exe|ms[i|u|f|p]|[ap]sf|wm[v|a]|dat|zip|psf) 43200 80% 129600 reload-into-ims
              refresh_pattern -i windowsupdate.com/..(cab|exe|msi|msu|msf|asf|wma|wmv)|dat|zip)$ 4320 80% 43200  refresh-ims
              
              
              
              acl https_login url_regex -i ^https.*(login|Login).*
              cache deny https_login
              
              range_offset_limit 512 MB windowsupdate
              range_offset_limit 0 !windowsupdate
              quick_abort_min -1 KB
              
              cache_mem 256 MB
              maximum_object_size_in_memory 512 KB
              memory_replacement_policy lru
              cache_replacement_policy lru
              minimum_object_size 0 KB
              maximum_object_size 512 MB
              cache_dir diskd /nvme/LOGS_Optane/Squid_Cache 32000 16 256
              offline_mode off
              cache_swap_low 90
              cache_swap_high 95
              acl donotcache dstdomain '/var/squid/acl/donotcache.acl'
              cache deny donotcache
              cache allow all
              # Add any of your own refresh_pattern entries above these.
              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
              
              
              #Remote proxies
              
              
              # Setup some default acls
              # ACLs all, manager, localhost, and to_localhost are predefined.
              acl allsrc src all
              acl safeports port 21 70 80 210 280 443 488 563 591 631 777 901 8080 3128 3129 1025-65535 
              acl sslports port 443 563 8080 5223 2197
              
              acl purge method PURGE
              acl connect method CONNECT
              
              # Define protocols used for redirects
              acl HTTP proto HTTP
              acl HTTPS proto HTTPS
              
              # SslBump Peek and Splice
              # http://wiki.squid-cache.org/Features/SslPeekAndSplice
              # http://wiki.squid-cache.org/ConfigExamples/Intercept/SslBumpExplicit
              # Match against the current step during ssl_bump evaluation [fast]
              # Never matches and should not be used outside the ssl_bump context.
              #
              # At each SslBump step, Squid evaluates ssl_bump directives to find
              # the next bumping action (e.g., peek or splice). Valid SslBump step
              # values and the corresponding ssl_bump evaluation moments are:
              #   SslBump1: After getting TCP-level and HTTP CONNECT info.
              #   SslBump2: After getting TLS Client Hello info.
              #   SslBump3: After getting TLS Server Hello info.
              # These ACLs exist even when 'SSL/MITM Mode' is set to 'Custom' so that
              # they can be used there for custom configuration.
              acl step1 at_step SslBump1
              acl step2 at_step SslBump2
              acl step3 at_step SslBump3
              acl banned_hosts src '/var/squid/acl/banned_hosts.acl'
              acl blacklist dstdom_regex -i '/var/squid/acl/blacklist.acl'
              http_access allow manager localhost
              
              http_access deny manager
              http_access allow purge localhost
              http_access deny purge
              http_access deny !safeports
              http_access deny CONNECT !sslports
              
              # Always allow localhost connections
              http_access allow localhost
              
              quick_abort_min 0 KB
              quick_abort_max 0 KB
              quick_abort_pct 95
              request_body_max_size 0 KB
              delay_pools 1
              delay_class 1 2
              delay_parameters 1 -1/-1 -1/-1
              delay_initial_bucket_level 100
              delay_access 1 allow allsrc
              
              # Reverse Proxy settings
              
              deny_info TCP_RESET allsrc
              
              # Package Integration
              url_rewrite_program /usr/local/bin/squidGuard -c /usr/local/etc/squidGuard/squidGuard.conf
              url_rewrite_bypass off
              url_rewrite_children 100 startup=50 idle=50 concurrency=0
              
              # Custom options before auth
              host_verify_strict on
              
              # These hosts are banned
              http_access deny banned_hosts
              # Block access to blacklist domains
              http_access deny blacklist
              # List of domains allowed to logging in to Google services
              request_header_access X-GoogApps-Allowed-Domains deny all
              request_header_add X-GoogApps-Allowed-Domains consumer_accounts
              # Set YouTube safesearch restriction
              acl youtubedst dstdomain -n www.youtube.com m.youtube.com youtubei.googleapis.com youtube.googleapis.com www.youtube-nocookie.com
              request_header_access YouTube-Restrict deny all
              request_header_add YouTube-Restrict none youtubedst
              # Custom SSL/MITM options before auth
              acl wpad urlpath_regex ^/wpad.dat$
              acl wpad urlpath_regex ^/proxy.pac$
              acl wpad urlpath_regex ^/wpad.da$
              deny_info TCP_RESET wpad
              #deny_info 200:/etc/squid/wpad.dat wpad
              reply_header_access Content-Type deny wpad
              http_access deny wpad
              http_access deny !safeports
              http_access deny CONNECT !sslports
              #http_access allow localhost manager
              #http_access deny manager
              cachemgr_passwd disable offline_toggle reconfigure shutdown
              cachemgr_passwd redacted all
              eui_lookup on
              acl no_miss url_regex -i gateway.facebook.com/ws/realtime?
              acl no_miss url_regex -i web-chat-e2ee.facebook.com/ws/chat
              acl CONNECT method CONNECT
              acl wuCONNECT dstdomain www.update.microsoft.com
              acl wuCONNECT dstdomain sls.microsoft.com
              http_access allow CONNECT wuCONNECT localnet
              http_access allow CONNECT wuCONNECT localhost
              http_access allow CONNECT windowsupdate localnet
              http_access allow CONNECT windowsupdate localhost
              http_access allow CONNECT HttpAccess localnet
              http_access allow CONNECT HttpAccess localhost
              #http_access deny manager
              http_access deny to_ipv6
              http_access deny from_ipv6
              acl deny_rep_mime_doh rep_mime_type application/dns-message
              acl deny_rep_mime_doh rep_mime_type text/dns
              acl deny_rep_mime_doh rep_mime_type application/dns+json
              http_access deny deny_rep_mime_doh
              http_reply_access deny deny_rep_mime_doh
              
              acl BrokenButTrustedServers dstdomain '/usr/local/pkg/dstdom.broken'
              acl DomainMismatch ssl_error SQUID_X509_V_ERR_DOMAIN_MISMATCH
              sslproxy_cert_error allow BrokenButTrustedServers DomainMismatch
              sslproxy_cert_error deny all
              
              acl splice_only_ip src 192.168.1.8
              acl splice_only_ip src 192.168.1.10
              acl splice_only_ip src 192.168.1.11 
              acl splice_only_ip src 192.168.1.15
              acl splice_only_ip src 192.168.1.16
              
              acl splice_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl splice_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl splice_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl splice_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl splice_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              
              acl NoSSLIntercept ssl::server_name_regex -i '/usr/local/pkg/reg.url.nobump'
              acl NoBumpDNS dstdomain -n '/usr/local/pkg/dns.nobump'
              acl SSL_Intercept_Terminate dstdomain -n '/usr/local/pkg/url.bump'
              
              acl active_use annotate_client active=true
              
              acl bump_only_ip src 192.168.1.3
              acl bump_only_ip src 192.168.1.4 
              acl bump_only_ip src 192.168.1.5
              #acl bump_only_ip src 192.168.1.6
              acl bump_only_ip src 192.168.1.9
              acl bump_only_ip src 192.168.1.13
              
              acl bump_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl bump_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl bump_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              #acl bump_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl bump_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              acl bump_only_mac arp :RE:DA:CT:ED:MAC:ADDRESS
              
              #collapsed_forwarding on
              #negative_dns_ttl 5 minutes
              coredump_dir /nvme/LOGS_Optane/Squid_Dump
              #read_ahead_gap 64 KB
              #pipeline_prefetch 6
              #happy_eyeballs_connect_timeout 10
              #memory_pools on
              
              acl splice_group any-of https_login NoBumpDNS NoSSLIntercept
              acl splice_only_local_group all-of splice_only_mac splice_only_ip
              acl splice_main any-of splice_group splice_only_local_group
              acl bump_main all-of bump_only_mac bump_only_ip
              
              ssl_bump peek step1
              ssl_bump terminate SSL_Intercept_Terminate
              miss_access deny no_miss active_use
              ssl_bump splice splice_main active_use
              ssl_bump bump bump_main active_use
              acl activated note active_use true
              ssl_bump terminate !activated
              
              # Setup allowed ACLs
              # Allow local network(s) on interface(s)
              http_access allow localnet
              # Default block all to be sure
              http_access deny allsrc
              

              Peek first check the request
              terminate everything that goes to DoH list wackamole
              miss access is when it caches items so do not store login or chat stuff.
              splice the splice devices phones etc stuff I can not ssl intecept on and some always splice websites banks etc, bypass intercept list

              bump the bump only lists
              mark the active use acl true with note directive
              terminate anything that does not follow this just in case, I do not think anything ever gets to this acl.

              so it is broken up into a dual use set up

              ssl_bump peek step1
              ssl_bump terminate SSL_Intercept_Terminate
              miss_access deny no_miss active_use
              ssl_bump splice splice_main active_use
              ssl_bump bump bump_main active_use
              acl activated note active_use true
              ssl_bump terminate !activated

              Make sure to upvote

              1 Reply Last reply Reply Quote 0
              1 out of 6
              • First post
                1/6
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.