LINUX.ORG.RU

Squid выпустить пользователей AD в мир

 


0

1

Помогите пожалуйста разобраться. Установлен samba, krb и winbind. Расшарить папки получилось отлично, комп в домен ввел, ограничить доступ к папкам тоже получилось. Поставил squid, по доке с инета настроил, но при попытке войти в инет вылазит окно авторизации. Логин и пароль ввожу но доступ не получаю. На kinit -k получа.: kinit: Cannot find KDC for realm «VPU25.LOCAL» while getting initial credentials

nsswitch.conf

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd winbind
group:          compat systemd winbind
shadow:         compat
gshadow:        files

hosts:          dns mdns4_minimal[NotFound=return]mdns4 files
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

hosts

127.0.0.1	localhost
127.0.1.1	file.vpu25.local file
192.168.5.250	file.vpu25.local file
192.168.5.251	dc_n.vpu25.local vpu25.local dc_n

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

krb5.conf

[logging]
    default = FILE:/var/log/kerberos/krb5libs.log
    kdc = FILE:/var/log/kerberos/krb5kdc.log
    admin_server = FILE:/var/log/kerberos/kadmind.log

[libdefaults]
default_realm = VPU25.LOCAL
krb4_config = /etc/krb.conf
krb4_realms = /etc/krb.realms
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
default_tgs_enctypes = rc4-hmac des-cbc-crc des-cbc-md5
default_tkt_enctypes = rc4-hmac des-cbc-crc des-cbc-md5
permitted_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 
kdc_timesync = 1
ccache_type = 4
forwardable = true
proxiable = true

v4_instance_resolve = false
v4_name_convert = {
host = {
rcmd = host
ftp = ftp
}
plain = {
something = something-else
}
}
fcc-mit-ticketflags = true

[realms]
DC_N.VPU25.LOCAL = {
kdc = 192.168.5.251
admin_server = 192.168.5.251
default_domain = VPU25.LOCAL

}

[domain_realm]
.vpu25.local = VPU25.LOCAL
vpu25.local = VPU25.LOCAL

[appdefaults]
    pam = {
      debug = false
      ticket_lifetime = 36000
      renew_lifetime = 36000
      forwardable = true
      krb4_convert = false
    } 

[login]
krb4_convert = true
krb4_get_tickets = false

sbm.conf

[global]
workgroup = VPU25
server string = File server
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
#syslog = 0
panic action = /usr/share/samba/panic-action %d
security = ads
realm = VPU25.LOCAL
encrypt passwords = yes 
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
pam password change = yes
socket options = TCP_NODELAY
idmap config * : backend = tdb
idmap config * : range = 10000-999999
idmap config VPU25 : backend = rid
idmap config VPU25 : range = 2000000-2999999
template shell = /bin/bash
winbind use default domain = yes
winbind enum groups = yes
winbind enum users = yes

#======================= Share Definitions =======================
[homes]
	create mask = 0700
	valid users = VPU25\%S,@hlam_users
	writeable = yes
	directory mask = 0700
	comment = Home Directories
	browseable = no

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[hlam]
	writeable = yes
	path = /home/VPU25/hlam
	valid users = @hlam_users

[install]
	path = /home/VPU25/install
	write list = @smb_admin
	read list = @hlam_users
	invalid users = @students
	writeable = yes

[temp]
	create mode = 777
	force create mode = 777
	writeable = yes
	path = /home/VPU25/temp
	force directory mode = 777
	write list = @students,@smb_admin,@hlam_users
	directory mode = 777

squid.conf

# Аутентификация в Active Directory
auth_param negotiate program /usr/lib/squid/negotiate_kerberos_auth -s HTTP/file.vpu25.locla@VPU25.LOCAL
auth_param negotiate children 10
auth_param negotiate keep_alive on
external_acl_type inet_medium ttl=300 negative_ttl=60 %LOGIN /usr/lib/squid/ext_kerberos_ldap_group_acl -g Internet@VPU25.LOCAL
external_acl_type inet_full ttl=300 negative_ttl=60 %LOGIN /usr/lib/squid/ext_kerberos_ldap_group_acl -g Internet_Full@VPU25.LOCAL
external_acl_type inet_low ttl=300 negative_ttl=60 %LOGIN /usr/lib/squid/ext_kerberos_ldap_group_acl -g Internet_Low@VPU25.LOCAL

# Стандартные порты
acl SSL_ports port 443
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 CONNECT method CONNECT

# Белый и черный список
acl white_list url_regex -i "/etc/squid/white_lis.txt"
acl black_list url_regex -i "/etc/squid/blacklist.txt"

# Определяем группы доступа
acl my_full external inet_full
acl my_medium external inet_medium
acl my_low external inet_low

# Перечень сетей
acl all src all
acl our_networks src 192.168.5.0/24

# Авторизация требуется ОБЯЗАТЕЛЬНО, без нее никого не пускать
acl nt_group proxy_auth REQUIRED

# Стандартные разрешения
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager

# Права доступа для наших групп пользователей
http_access allow my_low white_list
http_access deny my_low
http_access deny my_medium black_list
http_access allow my_medium
http_access allow my_full

# Разрешаем локалхост
http_access allow localhost

# Запрещаем все остальное
http_access deny all

# Ограничение пропускной способности интернет-канала
delay_pools 3
delay_class 1 1
delay_class 2 1
delay_class 3 1
delay_parameters 1 -1/-1 -1/-1
delay_parameters 2 384000/384000
delay_parameters 3 32000/32000
#delay_access 1 allow my_full
#delay_access 1 deny all
delay_access 2 allow my_medium
delay_access 2 deny all
delay_access 3 allow my_low
delay_access 3 deny all

# Порты прокси-сервера
http_port 192.168.5.250:3128
http_port 192.168.5.250:3127 transparent

# Выделяем 3,5 Гб памяти для прокси
cache_mem 3584 MB

# Выделяем место на жестком диске для хранения файлов кэша
cache_dir ufs /var/spool/squid 100 16 256

# Куда и в каком объеме будем писать логи
access_log /var/log/squid/access.log
logfile_rotate 100
coredump_dir /var/spool/squid

# Настройки кэширования
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$    3600    90%     43200
refresh_pattern .               0       20%     4320

# Запрещаем отображение версии прокси-сервера и имени
httpd_suppress_version_string on
visible_hostname PROXYSERVER

# Включаем русский язык для сообщений сервера
#error_directory /usr/share/squid/errors/Russian-1251
#error_default_language ru

# Принудительно задаем желаемый DNS-сервер
#dns_nameservers 192.168.1.3
#dns_v4_first on

В логах squid cache.log

2018/10/31 12:02:42 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 12:02:42 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:02:42 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:02:42 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 12:02:42 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:02:42 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:02:42 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 12:02:42 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:03:53 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:08 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:08 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:08 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 12:04:08 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:10 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:13 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:33 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:33 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 12:04:33 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:38 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 12:04:38 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 12:04:38 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.

access.log

1540980248.242      0 192.168.5.1 TCP_DENIED/407 4080 CONNECT aleksius.com:443 - HIER_NONE/- text/html
1540980248.243      0 192.168.5.1 TCP_DENIED/407 4080 CONNECT aleksius.com:443 - HIER_NONE/- text/html
1540980248.245      0 192.168.5.1 TCP_DENIED/407 4183 CONNECT aleksius.com:443 - HIER_NONE/- text/html
1540980250.119      0 192.168.5.1 TCP_DENIED/407 4183 CONNECT aleksius.com:443 - HIER_NONE/- text/html
1540980253.823      0 192.168.5.1 TCP_DENIED/407 4183 CONNECT aleksius.com:443 - HIER_NONE/- text/html
1540980273.483      0 192.168.5.1 TCP_DENIED/407 4102 CONNECT clients4.google.com:443 - HIER_NONE/- text/html
1540980273.486      0 192.168.5.1 TCP_DENIED/407 4205 CONNECT clients4.google.com:443 - HIER_NONE/- text/html
1540980278.264     35 192.168.5.1 TCP_DENIED/407 4317 GET http://www.gstatic.com/generate_204 - HIER_NONE/- text/html
1540980278.267      1 192.168.5.1 TCP_DENIED/407 4420 GET http://www.gstatic.com/generate_204 - HIER_NONE/- text/html

На kinit -k получа.: kinit: Cannot find KDC for realm «VPU25.LOCAL» while getting initial credentials

dns_lookup_realm = false
dns_lookup_kdc = false

??!!

То есть руками ты KDC не задал, в DNS искать его ЗАПРЕТИЛ и удивляешься, почему Kerberos не пашет?

Вот_это_поворот.jpg

Pinkbyte ★★★★★ ()
Ответ на: комментарий от Pinkbyte

Уже исправил, kinit прошло удачно. Но все равно в мир не выпускает((( Вроде что то не так с ограничениями?

2018/10/31 19:43:12 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/10/31 19:43:12 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 19:43:12 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 19:43:13 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/10/31 19:43:13 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.

kot488 ()
Ответ на: комментарий от kot488

Active Directory прописывает адреса контроллеров доменов в качестве KDC в DNS. Если у тебя нет какой-то особой причины НЕ полагаться на этот механизм - не трогай его, пусть всё работает через DNS.

Pinkbyte ★★★★★ ()
Ответ на: комментарий от kot488

Да, DNS-имена - один из ключевых моментов работы Kerberos в Active Directory. На них выписываются билеты клиенту, а так как билет на конкретное имя клиент должен запросить сам, то логично что это имя и должно использоваться в качестве адреса proxy.

Pinkbyte ★★★★★ ()
Последнее исправление: Pinkbyte (всего исправлений: 2)
Ответ на: комментарий от kot488

Билет запрашивает пользователем на доступ к СЕРВЕРУ. Имя билета - DNS-имя СЕРВЕРА. Очевидно что каждому ПОЛЬЗОВАТЕЛЮ надо прописать в качестве адреса прокси DNS-адрес СЕРВЕРА.

Pinkbyte ★★★★★ ()
Ответ на: комментарий от Pinkbyte

Прокси прописал dns имя file.vpu25.local:3128 Прокси прописал dns имя file.vpu25.local:3128 Мазила пишет Прокси-сервер отказывается принимать соединения. А как то можно проверить файл который выдала винда, proxy.keytab. Может он не корректено работает?((( В логах следующее:

192.168.5.251 TCP_DENIED/407 4081 CONNECT www.google.com:443 - HIER_NONE/- text/html
2018/11/01 11:11:54 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/11/01 11:11:54 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/11/01 11:11:54 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/11/01 11:11:56 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.
2018/11/01 11:11:56 kid1| ERROR: Negotiate Authentication validating user. Result: {result=BH, notes={message: received type 1 NTLM token; }}
2018/11/01 11:11:56 kid1| delay_pool 0 has no delay_access configured. This means that no clients will ever use it.

kot488 ()