LINUX.ORG.RU
ФорумAdmin

Winbind неправильно подтягивает UID/GID от AD

 , ,


0

3

Всем добра Есть сервер на WinServ2008R2 на ней стоят Hyper-V VMы. две из них, одинаково настроенные Ubuntu с Samba KRB5 и Winbind, настроенные по этому мануалу: https://help.ubuntu.ru/wiki/ввод_в_домен_windows

Так вот, проблема в том, что при выполнении getent passwd ubuntu мне вываливает следующее;

root@storage:/home/some# getent passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13roxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false syslog:x:104:108::/home/syslog:/bin/false _apt:x:105:65534::/nonexistent:/bin/false lxd:x:106:65534::/var/lib/lxd/:/bin/false messagebus:x:107:111::/var/run/dbus:/bin/false uuidd:x:108:112::/run/uuidd:/bin/false dnsmasq:x:109:65534:dnsmasq,,,:/var/lib/misc:/bin/false some:x:1000:1000:admin,,,:/home/some:/bin/bash sshd:x:110:65534::/var/run/sshd:/usr/sbin/nologin administrator:*:4294967295:4294967295:Administrator:/home/II/administrator:/bin/bash guest:*:4294967295:4294967295:Guest:/home/II/guest:/bin/bash krbtgt:*:4294967295:4294967295:krbtgt:/home/II/krbtgt:/bin/bash a.stadnikov:*:4294967295:4294967295:Антон Стадников:/home/II/a.stadnikov:/bin/bash k.malinin:*:4294967295:4294967295:Константин Малинин:/home/II/k.malinin:/bin/bash p.pazushkin:*:4294967295:4294967295:Павел Пазушкин:/home/II/p.pazushkin:/bin/bash a.alkhasov:*:4294967295:4294967295:Алыш Алхасов:/home/II/a.alkhasov:/bin/bash e.shamsutdinov:*:4294967295:4294967295:Эмиль Шамсутдинов:/home/II/e.shamsutdinov:/bin/bash y.chamchiyan:*:4294967295:4294967295:Юрий Чамчиян:/home/II/y.chamchiyan:/bin/bash s.gorbunova:*:4294967295:4294967295:Светлана Горбунова:/home/II/s.gorbunova:/bin/bash sh.alkhasov:*:4294967295:4294967295:Шахмурад Алхасов:/home/II/sh.alkhasov:/bin/bash e.sklyarov:*:4294967295:4294967295:Евгений Скляров:/home/II/e.sklyarov:/bin/bash domadmin:*:4294967295:4294967295:Администратор Домена:/home/II/domadmin:/bin/bash g.mazurkina:*:4294967295:4294967295:Галина Мазуркина:/home/II/g.mazurkina:/bin/bash storadmin:*:4294967295:4294967295:Администратор хранилища:/home/II/storadmin:/bin/bash o.kachalina:*:4294967295:4294967295:Ольга Качалина:/home/II/o.kachalina:/bin/bash sql_admin:*:4294967295:4294967295:Администратор SQL:/home/II/sql_admin:/bin/bash r.veliev:*:4294967295:4294967295:Рифан Велиев:/home/II/r.veliev:/bin/bash d.emelin:*:4294967295:4294967295:Дмитрий Емелин:/home/II/d.emelin:/bin/bash e.glukhova:*:4294967295:4294967295:Екатерина А. Глухова:/home/II/e.glukhova:/bin/bash a.prokhorova:*:4294967295:4294967295:Анна В. Прохорова:/home/II/a.prokhorova:/bin/bash v.kovalnogov:*:4294967295:4294967295:Владислав Николаевич Ковальногов:/home/II/v.kovalnogov:/bin/bash t.karpukhina:*:4294967295:4294967295:Тамара Владимировна Карпухина:/home/II/t.karpukhina:/bin/bash e.vershinina:*:4294967295:4294967295:Елена Петровна Вершинина:/home/II/e.vershinina:/bin/bash m.denisova:*:4294967295:4294967295:Маргарита Сергеевна Денисова:/home/II/m.denisova:/bin/bash e.korochkina:*:4294967295:4294967295:Елена Валентиновна Корочкина:/home/II/e.korochkina:/bin/bash l.olkhovskaya:*:4294967295:4294967295:Лариса Анатольевна Ольховская:/home/II/l.olkhovskaya:/bin/bash e.ryzhukhina:*:4294967295:4294967295:Екатерина Алексеевна Рыжухина:/home/II/e.ryzhukhina:/bin/bash i.rychkova:*:4294967295:4294967295:Ирина Анатольевна Рычкова:/home/II/i.rychkova:/bin/bash g.pakhomova:*:4294967295:4294967295:Гульчачак Рафиковна Пахомова:/home/II/g.pakhomova:/bin/bash t.novakh:*:4294967295:4294967295:Татьяна Валентиновна Новах:/home/II/t.novakh:/bin/bash e.martianova:*:4294967295:4294967295:Елена Александровна Мартьянова:/home/II/e.martianova:/bin/bash k.kurs:*:4294967295:4294967295:Ксения Юрьевна Курс:/home/II/k.kurs:/bin/bash t.novikova:*:4294967295:4294967295:Татьяна Анатольевна Новикова:/home/II/t.novikova:/bin/bash

Как видите, UID и GID пользователей домена одинаковы. Где я дибил?

Конфиг Samba,Winbind

[global] workgroup = II realm = II.USTU security = ADS encrypt passwords = true map acl inherit = true store dos attributes = true vfs objects = acl_xattr btrfs dns proxy = false os level = 0 domain logons = false load printers = false show add printer wizard = false printcap name = /dev/null disable spoolss = yes idmap config II :range = 10000-40000 idmap config II :backend = tdb winbind enum groups = true winbind enum users = true winbind use default domain = true templateshell = /bin/bash winbind refresh tickets = true winbind cache time = 500

Конфиг Kerberos

[libdefaults] default_realm = II.USTU 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] II.USTU = { kdc = server admin_server = server default_domain = II.USTU }

[domain_realm] .ii.ustu = II.USTU ii.ustu = II.USTU [login] krb4_convert = false krb4_get_tickets = false

Всем заранее спасибо за помощь

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

nsswitch.conf:

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

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

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

netgroup: nis

Лог Winbind

[2019/04/25 10:32:53.775857, 1, pid=1292, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_fun$ wbint_LookupSid: struct wbint_LookupSid in: struct wbint_LookupSid sid : * sid : S-1-22-2-10513 [2019/04/25 10:32:53.779662, 1, pid=1292, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_fun$ wbint_LookupSid: struct wbint_LookupSid out: struct wbint_LookupSid type : * type : SID_NAME_DOM_GRP (2) domain : * domain : * domain : 'Unix Group' name : * name : * name : '10513' result : NT_STATUS_OK [2019/04/25 10:32:53.779767, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wb$ SID 0: S-1-22-2-10513 [2019/04/25 10:32:53.779806, 10, pid=1292, effective(0, 0), real(0, 0)] ../source3/lib/idmap_cache.c:56(idmap$ Parsing value for key [IDMAP/SID2XID/S-1-22-2-10513]: value=[10513:G] [2019/04/25 10:32:53.779829, 10, pid=1292, effective(0, 0), real(0, 0)] ../source3/lib/idmap_cache.c:75(idmap$ Parsing value for key [IDMAP/SID2XID/S-1-22-2-10513]: id=[10513], endptr=[:G] [2019/04/25 10:32:53.779861, 0, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ Failed to find domain 'Unix Group'. Check connection to trusted domains! [2019/04/25 10:32:53.779918, 5, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ fill_grent failed [2019/04/25 10:32:53.779943, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ wb_request_done[2583:GETGRGID]: NT_STATUS_NO_MEMORY [2019/04/25 10:32:53.780037, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ winbind_client_response_written[2583:GETGRGID]: delivered response to client [2019/04/25 10:32:53.780345, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ process_request: Handling async request 2583:GETGRGID [2019/04/25 10:32:53.780378, 3, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ getgrgid 10513 [2019/04/25 10:32:53.780415, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wb$ idmap_cache_find_gid2sid found 10513 [2019/04/25 10:32:53.780448, 1, pid=1292, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_fun$ wbint_LookupSid: struct wbint_LookupSid in: struct wbint_LookupSid sid : * sid : S-1-22-2-10513 [2019/04/25 10:32:53.782816, 1, pid=1292, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_fun$ wbint_LookupSid: struct wbint_LookupSid out: struct wbint_LookupSid type : * type : SID_NAME_DOM_GRP (2) domain : * domain : * domain : 'Unix Group' name : * name : * name : '10513' result : NT_STATUS_OK [2019/04/25 10:32:53.782921, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wb$ SID 0: S-1-22-2-10513 [2019/04/25 10:32:53.782959, 10, pid=1292, effective(0, 0), real(0, 0)] ../source3/lib/idmap_cache.c:56(idmap$ Parsing value for key [IDMAP/SID2XID/S-1-22-2-10513]: value=[10513:G] [2019/04/25 10:32:53.782990, 10, pid=1292, effective(0, 0), real(0, 0)] ../source3/lib/idmap_cache.c:75(idmap$ Parsing value for key [IDMAP/SID2XID/S-1-22-2-10513]: id=[10513], endptr=[:G] [2019/04/25 10:32:53.783023, 0, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ Failed to find domain 'Unix Group'. Check connection to trusted domains! [2019/04/25 10:32:53.783088, 5, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ fill_grent failed [2019/04/25 10:32:53.783126, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ wb_request_done[2583:GETGRGID]: NT_STATUS_NO_MEMORY [2019/04/25 10:32:53.783251, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ winbind_client_response_written[2583:GETGRGID]: delivered response to client [2019/04/25 10:32:53.783394, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ process_request: Handling async request 2583:GETPWUID [2019/04/25 10:32:53.783435, 3, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wi$ getpwuid 11103 [2019/04/25 10:32:53.783485, 10, pid=1292, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/wb$ idmap_cache_find_uid2sid found 11103 [2019/04/25 10:32:53.783606, 1, pid=1292, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_fun$ wbint_LookupSid: struct wbint_LookupSid in: struct wbint_LookupSid sid : * sid : S-1-22-1-11103 [2019/04/25 10:32:53.786200, 1, pid=1292, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_fun$

stadnikov ()
Ответ на: комментарий от stadnikov
[global]
        realm = LAN.COMPANY.RU
        workgroup = LAN
        domain master = No
        local master = No
        os level = 0
        preferred master = No
        log file = /var/log/samba/log.%m
        max log size = 1000
        syslog = 0
        panic action = /usr/share/samba/panic-action %d
        usershare allow guests = Yes
        guest account = smbguest@file-server
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        security = ADS
        server role = member server
        unix password sync = Yes
        idmap gid = 10000-400000
        idmap uid = 10000-400000
        template shell = /bin/bash
        winbind enum groups = Yes
        winbind enum users = Yes
        dns proxy = No
        full_audit:priority = notice
        full_audit:facility = local5
        full_audit:success = connect disconnect mkdir rmdir read pread write pwrite sendfile rename unlink chmod
        full_audit:failure = connect
        full_audit:prefix = %u|%I|%S
        idmap config * : range = 10000-400000
        idmap config * : backend = rid
        store dos attributes = Yes
        map acl inherit = Yes
        admin users = "@LAN.COMPANY.RU\Администраторы домена"
        allocation roundup size = 4096
        vfs objects = acl_xattr

У меня вот такой конфиг и всё работает.

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

содержимое krb5.conf [libdefaults] default_realm = II.USTU 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] II.USTU = { kdc = server admin_server = server default_domain = II.USTU } [domain_realm] .ii.ustu = II.USTU ii.ustu = II.USTU [login] krb4_convert = false krb4_get_tickets = false

/etc/hostname: storage

/etc/hosts: 127.0.0.1 localhost 127.0.1.1 storage storage.ii.ustu 10.5.128.1 server server.ii.ustu # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters

stadnikov ()
Ответ на: Re: Исаользуй BBCODE от anonymous

krb5.conf

[libdefaults]
        default_realm = II.USTU
        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]
        II.USTU = {
                kdc = 10.5.128.1
                admin_server = 10.5.128.1
                default_domain = II.USTU
        }

[domain_realm]
        .ii.ustu = II.USTU
        ii.ustu = II.USTU
[login]
        krb4_convert = false
        krb4_get_tickets = false

/etc/hosts

127.0.0.1       localhost
127.0.1.1       storage storage.ii.ustu
10.5.128.1      server  server.ii.ustu
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

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

У вас SAMBA - это контроллер домена?

В /etc/hosts у меня форма: 127.0.1.1 storage.ii.ustu storage

В krb5.conf у меня kdc и admin_server указаны по доменным именам.

Но в этом случае должен быть прописан DNS, который разрешит доменное имя в IP.

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

Да

# /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 winbind
group:          compat winbind
shadow:         compat winbind
gshadow:        files   winbind

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

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

netgroup:       nis
stadnikov ()
Ответ на: комментарий от anonymous
● winbind.service - LSB: start Winbind daemon
   Loaded: loaded (/etc/init.d/winbind; bad; vendor preset: enabled)
   Active: active (running) since Чт 2019-04-25 16:34:04 +04; 31min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1113 ExecStart=/etc/init.d/winbind start (code=exited, status=0/SUCCESS)
    Tasks: 5
   Memory: 21.3M
      CPU: 569ms
   CGroup: /system.slice/winbind.service
           ├─1314 /usr/sbin/winbindd
           ├─1315 /usr/sbin/winbindd
           ├─1328 /usr/sbin/winbindd
           ├─1331 /usr/sbin/winbindd
           └─1332 /usr/sbin/winbindd

апр 25 16:34:01 storage systemd[1]: Starting LSB: start Winbind daemon...
апр 25 16:34:04 storage winbind[1113]:  * Starting the Winbind daemon winbind
апр 25 16:34:04 storage winbind[1113]:    ...done.
апр 25 16:34:04 storage systemd[1]: Started LSB: start Winbind daemon.
апр 25 16:34:04 storage winbindd[1314]: [2019/04/25 16:34:04.818596,  0] ../source3/winbindd/winbindd_cache.c:32
апр 25 16:34:04 storage winbindd[1314]:   initialize_winbindd_cache: clearing cache and re-creating with version
апр 25 16:34:04 storage winbindd[1314]: [2019/04/25 16:34:04.848114,  0] ../lib/util/become_daemon.c:124(daemon_
апр 25 16:34:04 storage winbindd[1314]:   STATUS=daemon 'winbindd' finished starting up and ready to serve conne
stadnikov ()

Так, Ладно, объясню.

Есть Winserv как контроллер домена, есть Ubuntu 16.04, введенная в домен, но нужна эта Ubuntu, только как файловый сервер. раньше все прекрасно работало, но в один прекрасный момент, ubuntu просто перестала правильно подтягивать ID пользователей. Хотя на саму шару зайти можно. но начальству позарез надо разделение прав на папки...

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

Решение!

Короче, народ, все фигня... Все починил.

Достаточно было заменить это:

        idmap config II :range = 1000-4294967295
        idmap config II :backend = tdb
на это:
        idmap config * : backend = tdb
        idmap config * : range = 1000-30000

и все заработало как надо. Только вот вопрос, почему именно так оно заработало.

stadnikov ()