Mengaktifkan Squid Proxy di PFSense - Proses Instalasi dan Konfigurasi

· 2 min read

Ada banyak fitur proxy Squid, Anda dapat meningkatkan keuntungan dan manfaat proxy Squid dengan mengaktifkan fitur-fitur ini. Artikel ini hanyalah kon

Pada artikel sebelumnya, kami telah menjelaskan cara memasang Bind DNS server di PFSense. Hasilnya sangat memuaskan, kecepatan internet dapat meningkat, karena Bind mampu melakukan caching DNS di database internalnya. Pada artikel ini, kami akan menjelaskan cara memasang dan men-setup Squid Proxy. Tujuannya tidak lain adalah untuk meningkatkan kecepatan akses internet, terutama saat Anda mengakses web browser seperti YouTube, Google, Microsoft, Netflix, dan lainnya.

Seperti yang kita ketahui, Squid merupakan aplikasi proxy terbaik saat ini. Hampir semua pengguna komputer mempercayai Squid untuk melakukan proxy port 80 dan 443. Tidak hanya itu, fitur-fitur yang dimiliki Squid juga sangat lengkap. Anda dapat mengatur autentikasi bagi siapa saja yang dapat mengakses Squid PFSense Anda. Selain itu, fitur anti-virus seperti clamav juga tersedia pada Squid Proxy.

Squid juga mampu memblokir situs-situs yang tidak Anda inginkan. Kemampuan memblokir Squid sudah tidak perlu diragukan lagi dan mampu memblokir ribuan bahkan ratusan situs terlarang. Banyak sekali manfaat Squid, namun manfaat yang dapat Anda rasakan secara langsung adalah dapat meningkatkan akses internet, karena Squid dapat menyimpan semua data dari situs yang pernah Anda akses. Jadi, ketika Anda membuka kembali situs tersebut, Squid dapat langsung melayani permintaan dari database-nya.


1. Membuat Sertifikat CA

Dalam artikel ini, kami akan menyiapkan proxy Squid untuk HTTP dan port HTTP. Oleh karena itu, proxy Squid memerlukan sertifikat CA saat mengonfigurasi proxy Squid. Dalam artikel ini, kami akan menunjukkan cara membuat sertifikat CA dengan nama "LANNetworks".

Untuk membuat sertifikat LANNetworks, klik System ->> Certificates, lalu pada opsi "Authorities" klik tombol "Add". Harap isi kolom sesuai dengan gambar berikut.


Squid proxy


nat forward


2. Cara Instal Paket Squid Proxy

Sama seperti aplikasi lainnya, paket proxy Squid tersedia di repositori PFSense, Anda dapat langsung menginstalnya. Untuk mulai menginstal proxy Squid, klik System ->> Package Manager ->> Available Packages. Cari paket Squid dan klik saja tombol Install. Tunggu hingga proses instalasi selesai.

Setelah itu, lanjutkan dengan melakukan pengaturan proxy Squid, klik Services ->> Squid Proxy Server. Pilih Local Cache, pada opsi "Custom refresh_patterns", ketikkan skrip di bawah ini dan langsung klik tombol (opsi lainnya biarkan saja default).

Script Custom refresh_patterns
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

dinamic update squid


Kita lanjutkan dengan klik pilihan "Umum", isi sesuai contoh di bawah ini.

Squid General Settings:

Enable Squid Proxy: Check
Keep Settings/Data: Check
Listen IP Version: IPv4
CARP Staus VIP: none
Proxy Interface(s): LAN
Outgoing Network Interface: LAN
PRoxy Port: 3128
ICP Port:
Allow Users on Interface: Check
Patch Captive Portal:
Resolve DNS IPv4 First: Check
Disable ICMP: UnCheck
Use Alternate DNS Server for the PRoxy Server: 192.168.7.1; 1.1.1.1
Extra Trusted CA: LANNetworks

Transparent Proxy Settings:

Transparent HTTP Proxy: Check
Transparent Proxy Interface(s): LAN
Bypass Proxy for Private Address Destination: UnCheck
Bypass Proxy for These Source IPs:
Bypass Proxy for These Destination IPs:

SSL Man In the Middle Filtering:

HTTPS/SSL Interception: Check
SSL/MITM Mode: Custom
SSL Intercept Interface(s): LAN
SSL Proxy Port: 3129
SSL Proxy Compatibility Mode: Modern
DHParams Key Size: 2048 (default)
CA: LANNetworks
SSL Certificate Deamon Children: 5
Remote Cert Checks:
Certificate Adapt:

Logging Settings:

Enable Access Logging: Check
Rotate Logs: 15
Log Pages Denied by Squidguard: Uncheck

Headers Handling, Language and Other Customizations:

Visible Hostname: ns5.kursor.my.id
Administrator's Email: datainchi@gmail.com
Error Language: en
X-Forwarded Header Mode: (on)
Disable VIA Header: UnCheck
URI Whitespace Characters Handling: strip
Suppress Squid Version: UnCheck

Advanced Features

Integrations:
Custom Options (Before Auth):
Custom Options (After Auth):
Custom Options (SSL/MITM):
acl splice_it ssl::server_name .microsoft.com
acl splice_it ssl::server_name .windowsupdate.com
acl splice_it ssl::server_name .akamaitechnologies.com
acl splice_it ssl::server_name .akadns.net
acl splice_it ssl::server_name .google.com
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump splice splice_it
ssl_bump bump all

3. Menyiapkan Proxy Squid Penerusan Port NAT

Tujuan pembuatan "NAT Port Forward" adalah agar semua klien yang terhubung ke server PFSense Anda langsung diarahkan ke port 3128 dan 3129, yaitu port proxy Squid untuk HTTP dan HTTPS. Kita akan membuat 2 Port Forward NAT:
  • Port Forward for HTTP, and
  • Port Forward for HTTPS
Oke, langsung saja kita mulai membuat NAT Port Forward untuk proxy Squid, caranya klik Firewall ->> NAT. Pada pilihan "Port Forward", klik tombol "Add", untuk mengisi NAT Port Forward, ikuti petunjuk gambar di bawah ini.

a. Port Forward for HTTP redirect ke 3128



port forward squid


b. Port Forward for HTTPS redirect ke 3129



ports redirect squid

4. Contoh Proxy Squid yang dihasilkan oleh PFSense

Setiap tindakan yang Anda lakukan saat mengonfigurasi proxy Squid, PFSense akan secara otomatis menyimpan konfigurasi dalam sebuah skrip. Skrip berkas konfigurasi Squid disimpan dalam direktori /usr/local/etc/squid. Anda dapat melihat semua berkas proxy Squid dalam direktori tersebut. Berkas konfigurasi utama proxy Squid bernama "squid.conf", berikut adalah contoh skrip /usr/local/etc/squid/squid.conf.

Script /usr/local/etc/squid/squid.conf
# This file is automatically generated by pfSense
# Do not edit manually !

http_port 192.168.7.1:3128 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=10MB 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:!RC4:!aNULL:!eNULL:!LOW:!3DES:!SHA1:!MD5:!EXP:!PSK:!SRP:!DSS tls-dh=prime256v1:/etc/dh-parameters.2048 options=NO_SSLv3,NO_TLSv1,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=10MB 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:!RC4:!aNULL:!eNULL:!LOW:!3DES:!SHA1:!MD5:!EXP:!PSK:!SRP:!DSS tls-dh=prime256v1:/etc/dh-parameters.2048 options=NO_SSLv3,NO_TLSv1,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=10MB 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:!RC4:!aNULL:!eNULL:!LOW:!3DES:!SHA1:!MD5:!EXP:!PSK:!SRP:!DSS tls-dh=prime256v1:/etc/dh-parameters.2048 options=NO_SSLv3,NO_TLSv1,SINGLE_DH_USE,SINGLE_ECDH_USE

tcp_outgoing_address 192.168.7.1
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 ns5.kursor.my.id
cache_mgr datainchi@gmail.com
access_log /var/squid/logs/access.log
cache_log /var/squid/logs/cache.log
cache_store_log none
netdb_filename /var/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,NO_TLSv1,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:!RC4:!aNULL:!eNULL:!LOW:!3DES:!SHA1:!MD5:!EXP:!PSK:!SRP:!DSS
sslcrtd_children 5

logfile_rotate 15
debug_options rotate=15
shutdown_lifetime 3 seconds
# Allow local network(s) on interface(s)
acl localnet src  192.168.7.0/24
forwarded_for on
uri_whitespace strip
dns_nameservers 192.168.7.1 1.1.1.1 
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

cache_mem 64 MB
maximum_object_size_in_memory 256 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
minimum_object_size 0 KB
maximum_object_size 4 MB
cache_dir ufs /var/squid/cache 100 16 256
offline_mode off
cache_swap_low 90
cache_swap_high 95
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 8282 3128 3129 1025-65535 
acl sslports port 443 563 8282 

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
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
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


# Custom options before auth


# Custom SSL/MITM options before auth
acl splice_it ssl::server_name .microsoft.com
acl splice_it ssl::server_name .windowsupdate.com
acl splice_it ssl::server_name .akamaitechnologies.com
acl splice_it ssl::server_name .akadns.net
acl splice_it ssl::server_name .google.com
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump splice splice_it
ssl_bump bump all

# Setup allowed ACLs
# Allow local network(s) on interface(s)
http_access allow localnet
# Default block all to be sure
http_access deny allsrc
Ada banyak fitur proxy Squid, Anda dapat meningkatkan keuntungan dan manfaat proxy Squid dengan mengaktifkan fitur-fitur ini. Artikel ini hanyalah konfigurasi dasar proxy Squid, Anda dapat membaca artikel lainnya untuk merasakan lebih banyak manfaat dari proxy Squid.
Subscribe on LinkedIn Mengaktifkan Squid Proxy di PFSense - Proses Instalasi dan Konfigurasi

Enclosures Link: Mengaktifkan Squid Proxy di PFSense - Proses Instalasi dan Konfigurasi

Silahkan Berkomentar, Kakak...! Bunda...!

Posting Komentar