Advertisement
ujiajah1

install squid intercept mode

Sep 22nd, 2016
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.01 KB | None | 0 0
  1. chkconfig iptables off
  2.  
  3. chkconfig ip6tables off
  4.  
  5. vi /etc/selinux/config
  6.  
  7.  
  8. cd /home
  9.  
  10. wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  11.  
  12. rpm -Uvh epel-release-6.8.noarch.rpm
  13.  
  14. cd /etc/yum.repos.d
  15.  
  16. vi SQUID.repo
  17.  
  18.  
  19.  
  20. [Squid]
  21.  
  22. name=SQUID repo for CentOS Linux 6 - $basearch
  23.  
  24. #IL mirror
  25.  
  26. baseurl=http://www1.ngtech.co.il/rpm/centos/6/i686
  27.  
  28. failovermethod=priority
  29.  
  30. enabled=1
  31.  
  32. gpgcheck=0
  33.  
  34.  
  35. yum update
  36.  
  37. yum install perl-Crypt-OpenSSL-X509
  38.  
  39. yum install squid
  40.  
  41.  
  42. /usr/lib/squid/ssl_crtd -c -s /var/lib/ssl_db
  43.  
  44. chown -R squid.squid /var/lib/ssl_db
  45.  
  46.  
  47.  
  48.  
  49.  
  50. /etc/squid/squid.conf
  51.  
  52. acl localnet src 192.168.201.0/24
  53.  
  54. acl SSL_ports port 443
  55. acl Safe_ports port 80        # http
  56. acl Safe_ports port 21        # ftp
  57. acl Safe_ports port 443        # https
  58. acl Safe_ports port 70        # gopher
  59. acl Safe_ports port 210        # wais
  60. acl Safe_ports port 1025-65535    # unregistered ports
  61. acl Safe_ports port 280        # http-mgmt
  62. acl Safe_ports port 488        # gss-http
  63. acl Safe_ports port 591        # filemaker
  64. acl Safe_ports port 777        # multiling http
  65. acl CONNECT method CONNECT
  66.  
  67. http_access deny !Safe_ports
  68. http_access deny CONNECT !SSL_ports
  69.  
  70. http_access allow all
  71.  
  72. http_port 3130
  73.  
  74. http_port 3128 intercept
  75. https_port 3129 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid/ssl_cert/myca.pem key=/etc/squid/ssl_cert/myca.pem
  76.  
  77. #always_direct allow all
  78. ssl_bump server-first all
  79. #sslproxy_cert_error deny all
  80. #sslproxy_flags DONT_VERIFY_PEER
  81.  
  82. sslcrtd_program /usr/lib/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB
  83. sslcrtd_children 8 startup=1 idle=1
  84.  
  85. coredump_dir /var/spool/squid
  86.  
  87. # Add any of your own refresh_pattern entries above these.
  88. refresh_pattern ^ftp:        1440    20%    10080
  89. refresh_pattern ^gopher:    1440    0%    1440
  90. refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
  91. refresh_pattern .        0    20%    4320
  92.  
  93.  
  94. shutdown_lifetime 1 second
  95.  
  96.  
  97.  
  98.  
  99. We will first edit our /etc/pki/tls/openssl.conf file , and alter only the following
  100.  
  101. default_days    = 1365           # How long to certify for
  102. ...
  103.  
  104. [ req_distinguished_name ]
  105. countryName                     = Country Name (code)
  106. countryName_default             = DE
  107. countryName_min                 = 2
  108. countryName_max                 = 2
  109.  
  110. stateOrProvinceName             = State or Province Name (full name)
  111. stateOrProvinceName_default     = NRW
  112.  
  113. localityName                    = Locality Name (eg, city)
  114. localityName_default            = Paderborn
  115.  
  116. 0.organizationName              = Organization Name (eg, company)
  117. 0.organizationName_default      = Home.LAN
  118.  
  119. # we can do this but it is not needed normally :-)
  120. #1.organizationName             = Second Organization Name (eg, company)
  121. #1.organizationName_default     = World Wide Web Pty Ltd
  122.  
  123. organizationalUnitName          = Organizational Unit Name (eg, section)
  124. organizationalUnitName_default  = Proxy Server
  125.  
  126. commonName                      = Common Name (eg, your name or your server's hostname)
  127. # (Very Important, in order to keep mail clients and other user agents from complaining, this name must
  128. # match exactly the name that the user will be entering into their client settings.  Whether that be
  129. # domain.extension or mail.domain.extension or what.  It must be a valid DNS name pointing at your
  130. # server.
  131. commonName_default              = proxy.home.lan   # this line you need to add
  132. commonName_max                  = 64
  133.  
  134. emailAddress                    = Email Address
  135. emailAddress_default            = robert@proxy.home.lan  # this line you need to add
  136. emailAddress_max                = 64
  137.  
  138.  
  139.  
  140.  
  141.  
  142. mkdir /etc/squid/ssl_cert
  143.  
  144. chown -R squid.squid /etc/squid/ssl_cert
  145.  
  146. cd /etc/squid/ssl_cert
  147.  
  148.  
  149.  
  150. openssl req -new -newkey rsa:1024 -days 1365 -nodes -x509 -keyout myca.pem -out myca.pem
  151.  
  152.  
  153.  
  154.  
  155. openssl x509 -in myca.pem -outform DER -out myca.der
  156.  
  157.  
  158.  
  159.  
  160. mkdir /var/named/home.lan
  161.  
  162. touch /var/named/home.lan/db.home
  163.  
  164. chown -R named.named /var/named/home.lan
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement