Tecnologia da Informação - TI : Proxy Server

Total de visualizações de página

Mostrando postagens com marcador Proxy Server. Mostrar todas as postagens
Mostrando postagens com marcador Proxy Server. Mostrar todas as postagens

segunda-feira, 25 de abril de 2016

Squid + SquidGuard


Squid + SquidGuard
2014/09/30
 
Configure Squid + SquidGuard to set contents filtering.
[1]Install SquidGuard.
# install from EPEL

[root@prox ~]# 
yum --enablerepo=epel -y install squidGuard
[root@prox ~]# 
mv /etc/squid/squidGuard.conf /etc/squid/squidGuard.conf.bk 

[root@prox ~]# 
vi /etc/squid/squidGuard.conf
# create new

dbhome /var/lib/squidGuard/db
logdir /var/log/squidGuard
# define 'deny' category

dest deny {
    
# define prohibited domain list in 'deny' category

    domainlist deny/domains
    
# define prohibited URL list in 'deny' category

    urllist deny/urls
    }
acl {
    default {
        
# permit all except 'deny' category

        pass !deny all
        
# the redirected URL if matches 'deny'

        redirect http://www.server.world/error.html
    }
}
[root@prox ~]# 
mkdir -p /var/lib/squidGuard/db/deny 

[root@prox ~]# 
vi /var/lib/squidGuard/db/deny/domains
# write domains you'd like to prohibit to access

yahoo.co.jp
example.com
[root@prox ~]# 
vi /var/lib/squidGuard/db/deny/urls
# write URLs you'd like to prohibit to access

www.yahoo.co.jp/deny/
www.example.com/
[root@prox ~]# 
squidGuard -C all 

[root@prox ~]# 
chown -R squid. /var/lib/squidGuard/db/deny 

[root@prox ~]# 
vi /etc/squid/squid.conf
# add follows to the end

url_rewrite_program /usr/bin/squidGuard
[root@prox ~]# 
systemctl restart squid 
[2]Try to access to the URL you set as prohibited domains in [1].

Squid + SquidClamav


Squid + SquidClamav
2015/06/03
 
Install SquidClamav and Configure Proxy Server to scan downloaded files to protect from virus.
[1]
[2]Install Clamav Server.
# install from EPEL

[root@prox ~]# 
yum --enablerepo=epel -y install clamav-server clamav-server-systemd
[root@prox ~]# 
cp /usr/share/doc/clamav-server*/clamd.conf /etc/clamd.d/squid.conf 

[root@prox ~]# 
vi /etc/clamd.d/squid.conf
# line 8: comment out

#
Example
# line 14: uncomment and change

LogFile 
/var/log/clamd.squid
# line 66: uncomment and change

PidFile 
/var/run/clamd.squid/clamd.pid
# line 70: uncomment

TemporaryDirectory /var/tmp
# line 85: uncomment and change

LocalSocket 
/var/run/clamd.squid/clamd.sock
# line 101: uncomment

TCPSocket 3310
# line 195: change

User 
squidclamav
[root@prox ~]# 
useradd -M -d /var/tmp -s /sbin/nologin squidclamav 

[root@prox ~]# 
mkdir /var/run/clamd.squid 

[root@prox ~]# 
chown squidclamav. /var/run/clamd.squid 

[root@prox ~]# 
cp /usr/share/doc/clamav-server*/clamd.sysconfig /etc/sysconfig/clamd.squid 

[root@prox ~]# 
vi /etc/sysconfig/clamd.squid
# line 1,2: uncomment and change

CLAMD_CONFIGFILE=/etc/clamd.d/
squid.conf

CLAMD_SOCKET=/var/run/
clamd.squid
/clamd.sock
[root@prox ~]# 
vi /etc/tmpfiles.d/clamd.squid.conf
# create new

d /var/run/clamd.squid 0755 squidclamav squidclamav -
[root@prox ~]# 
vi /usr/lib/systemd/system/clamd@.service
# add follows to the end

[Install]
WantedBy=multi-user.target
[root@prox ~]# 
touch /var/log/clamd.squid 

[root@prox ~]# 
chown squidclamav. /var/log/clamd.squid 

[root@prox ~]# 
chmod 600 /var/log/clamd.squid 

[root@prox ~]# 
systemctl start clamd@squid 

[root@prox ~]# 
systemctl enable clamd@squid 
[3]Install c-icap.
[root@prox ~]# 
yum -y install gcc make 

[root@prox ~]# 
curl -L -O http://downloads.sourceforge.net/project/c-icap/c-icap/0.3.x/c_icap-0.3.5.tar.gz
[root@prox ~]# 
tar zxvf c_icap-0.3.5.tar.gz 

[root@prox ~]# 
cd c_icap-0.3.5 

[root@prox c_icap-0.3.5]# 
./configure 

[root@prox c_icap-0.3.5]# 
[root@prox c_icap-0.3.5]# 
make install 

[root@prox c_icap-0.3.5]# 
cd 

[root@prox ~]# 
cp /usr/local/etc/c-icap.conf /etc 

[root@prox ~]# 
vi /etc/c-icap.conf
# line 140: change admin email

ServerAdmin 
root@server.world
# line 149: change hostname

ServerName 
prox.server.world
# line 517: add

Service squidclamav squidclamav.so
[root@prox ~]# 
vi /etc/tmpfiles.d/c-icap.conf
# create new

d /var/run/c-icap 0755 root root -
[root@prox ~]# 
vi /usr/lib/systemd/system/c-icap.service
[Unit]
Description=c-icap service
After=network.target

[Service]
Type=forking
PIDFile=/var/run/c-icap/c-icap.pid
ExecStart=/usr/local/bin/c-icap -f /etc/c-icap.conf
KillMode=process

[Install]
WantedBy=multi-user.target
[4]Install SquidClamav ( Download the latest version of it from the following link ).
http://sourceforge.net/projects/squidclamav/files/squidclamav/
[root@prox ~]# 
curl -L -O http://downloads.sourceforge.net/project/squidclamav/squidclamav/6.13/squidclamav-6.13.tar.gz 

[root@prox ~]# 
tar zxvf squidclamav-6.13.tar.gz 

[root@prox ~]# 
cd squidclamav-6.13 

[root@prox squidclamav-6.13]# 
./configure --with-c-icap 

[root@prox squidclamav-6.13]# 
[root@prox squidclamav-6.13]# 
make install 

[root@prox squidclamav-6.13]# 
[root@prox ~]# 
ln -s /usr/local/etc/squidclamav.conf /etc/squidclamav.conf 

[root@prox ~]# 
vi /etc/squidclamav.conf
# line 18: change( destination URL for redirect. Create it first )

redirect 
http://www.server.world/error.html
# line 27: change( same with clamd )

clamd_local 
/var/run/clamd.squid/clamd.sock
[5]Configure Squid.
[root@prox ~]# 
vi /etc/squid/squid.conf
# add follows to the end

icap_enable on
icap_send_client_ip on
icap_send_client_username on
icap_client_username_header X-Authenticated-User
icap_service service_req reqmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav
adaptation_access service_req allow all
icap_service service_resp respmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav
adaptation_access service_resp allow all
[root@prox ~]# 
systemctl start c-icap 

[root@prox ~]# 
systemctl enable c-icap 

[root@prox ~]# 
systemctl restart squid 
[6]It's OK all. 
Next, try to access to the site below from a ClientPC with Web browser, 
http://eicar.org/85-0-Download.html
then, click the test Virus "eicar.com" to make sure to redirect the site you configured.

Reverse Proxy Server


Reverse Proxy Server
2014/09/03
 
Configure Squid as a reverse proxy server.
[1]Configure Squid.
[root@prox ~]# 
vi /etc/squid/squid.conf
# 54: add ( allow all http access )

http_access allow all 

# And finally deny all other access to this proxy
http_access deny all
# line 63: specify backend Web server

http_port 
80 accel defaultsite=www.server.world
# line 62: uncomment

# number means ⇒ [disk cache size] [number of directories on top level] [number of directories on 2nd level]

cache_dir ufs /var/spool/squid 100 16 256
# add follows to the end

cache_peer www.server.world parent 80 0 no-query originserver
# memory cache size

cache_mem 256 MB
# define hostname

visible_hostname prox.server.world
[root@prox ~]# 
systemctl start squid 

[root@prox ~]# 
systemctl enable squid 
[2]Change settings of DNS or Routers in your LAN if need to listen HTTP access on Squid, then try to access to Squid Reverse Proxy Server from a ClientPC with Web browser like follows.

Use Basic Authentication2014/07/24


Use Basic Authentication
2014/07/24
 
Set Basic Authentication and limit squid for users to require authentication.
[1]Install a package which includes htpasswd.
[root@prox ~]# 
yum -y install httpd-tools
[2]Configure Squid to set Basic Auth.
[root@prox ~]# 
vi /etc/squid/squid.conf
acl CONNECT method CONNECT
# line 26: add follows for Basic Auth

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 5 hours
acl password proxy_auth REQUIRED
http_access allow password
# add a user : create a new file with "-c" ( add the "-c" option only for the initial registration )

[root@prox ~]# 
htpasswd -c /etc/squid/.htpasswd cent 

New password: 
# set password

Re-type new password: 
# confirm

Adding password for user cent
[root@prox ~]# 
systemctl restart squid 
Configure Proxy Client : CentOS
[3]Configure CentOS Proxy Client for Basic Auth.
[root@client ~]# 
vi /etc/profile
# add follows to the end

# username:password@proxyserver:port

MY_PROXY_URL="http://cent:password@prox.server.world:8080/"
HTTP_PROXY=$MY_PROXY_URL
HTTPS_PROXY=$MY_PROXY_URL
FTP_PROXY=$MY_PROXY_URL
http_proxy=$MY_PROXY_URL
https_proxy=$MY_PROXY_URL
ftp_proxy=$MY_PROXY_URL
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
[root@client ~]# 
source /etc/profile
# it's OK all, but it's possible to set proxy settings for each application like follows.

# for yum

[root@client ~]# 
vi /etc/yum.conf
# add follows to the end

proxy=http://prox.server.world:8080/
proxy_username=cent
proxy_password=password
# for wget

[root@client ~]# 
vi /etc/wgetrc
# add follows to the end

http_proxy = http://prox.server.world:8080/
https_proxy = http://prox.server.world:8080/
ftp_proxy = http://prox.server.world:8080/
proxy_user = cent
proxy_passwd = password
Configure Proxy Client : Windows
[4]For Windows Clients, none of specific settings, but when access to a web, proxy server requires authentication like follows, then input username and password.

Proxy Client : CentOS


Proxy Client : CentOS
2014/07/21
 
Configure Proxy Client to connect to the Proxy server.
[1]Configure proxy settings like follows on CentOS Client.
[root@client ~]# 
vi /etc/profile
# add follows to the end (set proxy settings to the environment variables)

MY_PROXY_URL="http://prox.server.world:8080/"
HTTP_PROXY=$MY_PROXY_URL
HTTPS_PROXY=$MY_PROXY_URL
FTP_PROXY=$MY_PROXY_URL
http_proxy=$MY_PROXY_URL
https_proxy=$MY_PROXY_URL
ftp_proxy=$MY_PROXY_URL
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
[root@client ~]# 
source /etc/profile
# it's OK all, but it's possible to set proxy settings for each application like follows.

# for yum

[root@client ~]# 
vi /etc/yum.conf
# add follows to the end

proxy=http://prox.server.world:8080/
# for wget

[root@client ~]# 
vi /etc/wgetrc
# add follows to the end

http_proxy = http://prox.server.world:8080/
https_proxy = http://prox.server.world:8080/
ftp_proxy = http://prox.server.world:8080/
Proxy Client : Windows
 
Configure proxy settings like follows on Windows Client.
[2]For exmaple on Firefox,
Open [Tool] - [Option] and move to [Detail] - [Network] tab.
[3]Check a box "Configure Proxy manually" and input your server's hostname or IP address. It's OK, it's possible to access to the web via proxy server.

Install Squid


Install Squid
2014/07/21
 
Install Squid to configure Proxy server.
[1]This is common forward proxy settings.
[root@prox ~]# 
yum -y install squid
[root@prox ~]# 
vi /etc/squid/squid.conf
acl CONNECT method CONNECT
# line 26: add ( define new ACL )

acl lan src 10.0.0.0/24
http_access allow localhost
# line 54: add ( allow defined ACL above )

http_access allow lan
# line 59: change

http_port 
8080
# add follows to the end

request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
# specify hostname

visible_hostname prox.server.world
# not display IP address

forwarded_for off
[root@prox ~]# 
systemctl start squid 

[root@prox ~]# 
systemctl enable squid 

Console Sony Playstation 5 Edição Slim Disk 1tb Branco + Controle Sem Fio Dualsense Ps5 Branco

https://meli.la/1pJv7oL LINK ->  https://meli.la/1pJv7oL  Características do produto Capacidade 1 TB Com Wi-Fi Sim Tipo de console De ...