galoleite
(usa Ubuntu)
Enviado em 24/08/2016 - 16:51h
Boa tarde amigos.
Tive que assumir uma responsabilidade de ultima hora aqui onde trabalho, o colega que estava trabalhando na implantação do servidor proxy autenticado recebeu uma proposta e vazou...
Não tenho muito conhecimento em linux, tenho estudado muito, pesquisado muito e estou fazendo um curso de formação para aprimorar o conhecimento, porém o projeto de implantação do proxy autenticado é super urgente e tenho que me virar nos trinta. Conto com a boa vontade de sempre da comunidade.
Cenário atual: Consegui instalar o squid3, ele esta autenticando, as regras no Iptables estão ok, só navega autenticados porem não consigo fazer as distinções de acessos aos dois grupos que devo ter aqui no meu ambiente, grupo "liberados" (com acesso total) e grupo "intermediarios" (com algumas restrições de conteúdo e futuramente de banda tb).
No momento, todos autenticados acessam tudo, inclusive os sites da lista de "sites_proibidos".
Seguindo alguns artigos e estudos, criei um único repositorio para armazenar os usuários e senhas e depois criei arquivos dos dois grupos onde adicionei devidamente casa usuario (de forma simples, um por linha) de acordo com suas permissões, mas não esta funcionando...
Segue abaixo meu squid.conf para melhor entendimento:
# Porta Squid
http_port 3128
# Nome visível do servidor
visible_hostname Proxy
# Autenticação dos usuários
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/squid_usuarios
auth_param basic children 10
# Mensagem que aparecerá na janela de autenticação
auth_param basic realm Servidor Proxy
acl autenticados proxy_auth REQUIRED
# GRUPOS #
# Liberados - acesso total
acl liberados proxy_auth "/etc/squid3/grupos/liberados"
# Intermediarios - com certas permissões
acl intermediarios proxy_auth "/etc/squid3/grupos/intermediarios"
# Arquivos com bloqueios #
#Sites proibidos
acl sites_proibidos dstdomain "/etc/squid3/acls/sites_proibidos"
acl localhost src
acl rede_interna src 10.1.1.0/24
# Acls padrões do SQUID (Aqui ele faz liberações de algumas portas)
acl SSL_ports port 443
acl SSL_ports port 2095
acl SSL_ports port 2082
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 Safe_ports port 445
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow liberados
http_access allow intermediarios !sites_proibidos
http_access deny sites_proibidos
http_access allow localhost
http_access allow autenticados
http_access allow rede_interna
http_access deny all
http_access allow purge localhost
http_access deny purge
icp_access deny all
htcp_access deny all
hierarchy_stoplist cgi-bin \?
cache_replacement_policy lru
memory_replacement_policy lru
# Arquivo de log
access_log /var/log/squid3/access.log squid
# Arquivo de cache
cache_log /var/log/squid3/cache.log
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern (cgi-bin|\?) 0 0% 0
refresh_pattern . 0 20% 4320
#Cache da memória#
#cache_mem 1024 MB
#cache_swap_low 90
#cache_swap_high 95
#Cache HD
#cache_dir ufs /var/spool/squid 4096 16 256
#maximum_object_size 512 MB
#minimum_object_size 0 KB
icp_port 3130
error_directory /usr/share/squid3/errors/Portuguese
coredump_dir /var/spool/squid3
########################################## Fim do squid.conf ############################################
Abaixo, seguem os logs do /var/log/squid3/cache.log, caso seja necessário para identificar alguma falha que eu tenha cometido na configuração até aqui:
############################### Logs Squid - /var/log/squid3/cache.log ##########################################
2016/08/24 10:28:51| Squid is already running! Process ID 2870
2016/08/24 10:29:49| Preparing for shutdown after 152 requests
2016/08/24 10:29:49| Waiting 0 seconds for active connections to finish
2016/08/24 10:29:49| Closing HTTP port [::]:3128
2016/08/24 10:29:49| Stop receiving ICP on [::]:3130
2016/08/24 10:29:49| Closing Pinger socket on FD 11
2016/08/24 10:29:49| Shutdown: NTLM authentication.
2016/08/24 10:29:49| Shutdown: Negotiate authentication.
2016/08/24 10:29:49| Shutdown: Digest authentication.
2016/08/24 10:29:49| Shutdown: Basic authentication.
2016/08/24 10:29:51| Shutting down...
2016/08/24 10:29:51| Stop sending ICP from [::]:3130
2016/08/24 10:29:51| storeDirWriteCleanLogs: Starting...
2016/08/24 10:29:51| Finished. Wrote 0 entries.
2016/08/24 10:29:51| Took 0.00 seconds ( 0.00 entries/sec).
CPU Usage: 0.368 seconds = 0.164 user + 0.204 sys
Maximum Resident Size: 120800 KB
Page faults with physical i/o: 1
Memory usage for squid via mallinfo():
total space in arena: 14584 KB
Ordinary blocks: 5290 KB 651 blks
Small blocks: 0 KB 1 blks
Holding blocks: 27420 KB 8 blks
Free Small blocks: 0 KB
Free Ordinary blocks: 9293 KB
Total in use: 32710 KB 224%
Total free: 9293 KB 64%
2016/08/24 10:29:51| Logfile: closing log stdio:/var/log/squid3/access.log
2016/08/24 10:29:51| Open FD UNSTARTED 5 DNS Socket IPv6
2016/08/24 10:29:51| Open FD READ/WRITE 6 DNS Socket IPv4
2016/08/24 10:29:51| Open FD UNSTARTED 9 Incoming ICP port
2016/08/24 10:29:51| Open FD READ/WRITE 10 Reading next request
2016/08/24 10:29:51| Open FD READ/WRITE 12 basic_ncsa_auth #1
2016/08/24 10:29:51| Open FD READ/WRITE 13 ad.doubleclick.net:443
2016/08/24 10:29:51| Squid Cache (Version 3.3.8): Exiting normally.
2016/08/24 10:29:52| Pinger exiting.
2016/08/24 10:29:57| Starting Squid Cache version 3.3.8 for i686-pc-linux-gnu...
2016/08/24 10:29:57| Process ID 2948
2016/08/24 10:29:57| Process Roles: master worker
2016/08/24 10:29:57| With 65536 file descriptors available
2016/08/24 10:29:57| Initializing IP Cache...
2016/08/24 10:29:57| DNS Socket created at [::], FD 5
2016/08/24 10:29:57| DNS Socket created at 0.0.0.0, FD 6
2016/08/24 10:29:57| Adding nameserver 192.168.1.1 from /etc/resolv.conf
2016/08/24 10:29:57| helperOpenServers: Starting 0/10 'basic_ncsa_auth' processes
2016/08/24 10:29:57| helperOpenServers: No 'basic_ncsa_auth' processes needed.
2016/08/24 10:29:57| Logfile: opening log /var/log/squid3/access.log
2016/08/24 10:29:57| WARNING: log parameters now start with a module name. Use 'stdio:/var/log/squid3/access.log'
2016/08/24 10:29:57| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2016/08/24 10:29:57| Store logging disabled
2016/08/24 10:29:57| Swap maxSize 0 + 262144 KB, estimated 20164 objects
2016/08/24 10:29:57| Target number of buckets: 1008
2016/08/24 10:29:57| Using 8192 Store buckets
2016/08/24 10:29:57| Max Mem size: 262144 KB
2016/08/24 10:29:57| Max Swap size: 0 KB
2016/08/24 10:29:57| Using Least Load store dir selection
2016/08/24 10:29:57| Set Current Directory to /var/spool/squid3
2016/08/24 10:29:57| Loaded Icons.
2016/08/24 10:29:57| HTCP Disabled.
2016/08/24 10:29:57| Pinger socket opened on FD 11
2016/08/24 10:29:57| Squid plugin modules loaded: 0
2016/08/24 10:29:57| Adaptation support is off.
2016/08/24 10:29:57| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 8 flags=9
2016/08/24 10:29:57| Accepting ICP messages on [::]:3130
2016/08/24 10:29:57| Sending ICP messages from [::]:3130
2016/08/24 10:29:57| pinger: Initialising ICMP pinger ...
2016/08/24 10:29:57| pinger: ICMP socket opened.
2016/08/24 10:29:57| pinger: ICMPv6 socket opened
2016/08/24 10:29:58| storeLateRelease: released 0 objects
2016/08/24 11:09:57| Logfile: opening log stdio:/var/log/squid3/netdb.state
2016/08/24 11:09:57| Logfile: closing log stdio:/var/log/squid3/netdb.state
2016/08/24 11:09:57| NETDB state saved; 0 entries, 0 msec
2016/08/24 11:51:37| Logfile: opening log stdio:/var/log/squid3/netdb.state
2016/08/24 11:51:37| Logfile: closing log stdio:/var/log/squid3/netdb.state
2016/08/24 11:51:37| NETDB state saved; 0 entries, 0 msec
2016/08/24 12:51:06| Logfile: opening log stdio:/var/log/squid3/netdb.state
2016/08/24 12:51:06| Logfile: closing log stdio:/var/log/squid3/netdb.state
2016/08/24 12:51:06| NETDB state saved; 0 entries, 0 msec
2016/08/24 13:49:17| Logfile: opening log stdio:/var/log/squid3/netdb.state
2016/08/24 13:49:17| Logfile: closing log stdio:/var/log/squid3/netdb.state
2016/08/24 13:49:17| NETDB state saved; 0 entries, 0 msec
2016/08/24 15:02:32| Logfile: opening log stdio:/var/log/squid3/netdb.state
2016/08/24 15:02:32| Logfile: closing log stdio:/var/log/squid3/netdb.state
2016/08/24 15:02:32| NETDB state saved; 0 entries, 0 msec
2016/08/24 15:44:34| Logfile: opening log stdio:/var/log/squid3/netdb.state
2016/08/24 15:44:34| Logfile: closing log stdio:/var/log/squid3/netdb.state
2016/08/24 15:44:34| NETDB state saved; 0 entries, 0 msec
################################################# Fim dos logs #########################################
Aproveito para tirar dúvida sobre as declarações comentadas com respeito a cache. Deixei para um segundo momento, mas se julgarem que da pra ajudar por aqui mesmo, matamos toda a bronca numa paulada só!
Desde já, agradeço a atenção dos amigos e fico no aguardo. Meio ansioso... meio desesperado... :)
Abraços!
Obs: estou configurando o serviço no Ubuntu Server 14.04.5