Bug 41161 - При входе не (авто)монтируется сетевая папка на сервере AD
Summary: При входе не (авто)монтируется сетевая папка на сервере AD
Status: CLOSED WORKSFORME
Alias: None
Product: Branch p10
Classification: Unclassified
Component: pam_mount (show other bugs)
Version: не указана
Hardware: x86_64 Linux
: P5 normal
Assignee: qa-team@altlinux.org
QA Contact: qa-p10@altlinux.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-19 09:38 MSK by Vera Blagoveschenskaya
Modified: 2021-10-20 10:50 MSK (History)
4 users (show)

See Also:


Attachments
logs.txt (5.06 KB, text/plain)
2021-10-19 09:38 MSK, Vera Blagoveschenskaya
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vera Blagoveschenskaya 2021-10-19 09:38:50 MSK
Created attachment 9843 [details]
logs.txt

Конфигурация стендов:
Настроено доверие между FreeIPA на p10 Alt Server x86_64 и AD на Windows server.
Клиент FreeIPA - p10 Alt Workstation x86_64

pam_mount-2.18-alt1.x86_64
cifs-utils-6.13-alt3.x86_64

1) На сервере AD создана папка, включен общий доступ, права на чтение и запись.
На FreeIPA клиенте в диспетчере файлов ввести адрес вида: smb://server/share = ОК
2) Примонтировать общую папку:
# mkdir -p /mnt/adshare && mount -v -t cifs -o user=aduser //10.88.8.226/share /mnt/adshare && l /mnt/adshare
Проверить создание/редактирование/удаление файлов = ОК
3) Настроить pam_mount и проверить автомонтирование при логине.
# cat /etc/security/pam_mount.conf.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>
    <debug enable="1" />
    <volume uid="10000-2000200000" fstype="cifs" server="10.88.8.226" path="share" mountpoint="~/share" 
    options="vers=2.0,cruid=%(USERUID),nounix,uid=%(USERUID),gid=%(USERGID),file_mode=0664,dir_mode=0775,user=%(DOMAIN_USER)" />
    <cifsmount>/sbin/mount.cifs //%(SERVER)/%(VOLUME) %(MNTPT) -o %(OPTIONS)</cifsmount>
    <cifsumount>/sbin/umount %(MNTPT)</cifsumount>
    <mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other,sec" />
    <mntoptions require="nosuid,nodev" />
    <logout wait="0" hup="no" term="no" kill="no" />
    <mkmountpoint enable="1" remove="true" />
</pam_mount>
# cat /etc/pam.d/system-auth-sss | grep pam_mount
auth            optional        pam_mount.so
session         optional        pam_mount.so

4) Перезагрузить систему и авторизоваться на клиенте пользователем из домена AD.

Результат: после входа в систему НЕ создалась папка share. Если зайти на smb://server/share, то папка появляется, но до следующего входа.

Ожидаемый результат: В домашней директории создана папка share.
Файлы доступны для создания/редактирования/удаления.

Дополнительно: 
Результат выполнения команды klist после входа:
$ klist
Ticket cache: KEYRING:persistent:1084801107:krb_ccache_k4PBNFy
Default principal: aduser1@ALTAD.TESTDOMA

Valid starting       Expires              Service principal
19.10.2021 09:24:56  19.10.2021 19:24:53  krbtgt/FREEIPA.TESTDOMAIN@ALTAD.TESTDOMA
	renew until 20.10.2021 09:24:53
19.10.2021 09:24:53  19.10.2021 19:24:53  krbtgt/ALTAD.TESTDOMA@ALTAD.TESTDOMA
	renew until 20.10.2021 09:24:53
Comment 1 Vera Blagoveschenskaya 2021-10-19 10:38:05 MSK
Доп. исследование: если привести строчку в pam_mount.conf.xml к виду

<volume uid="10000-2000200000" fstype="cifs" server="10.88.8.226" path="share" mountpoint="~/share"
    options="vers=2.0,cruid=%(USERUID),nounix,uid=%(USERUID),gid=%(USERGID),file_mode=0664,dir_mode=0775,user=%(USER)" />

То шара монтируется нормально.
Убрала из options параметр sec=krb5 и изменила user=%(USER)
Comment 2 Evgeny Sinelnikov 2021-10-20 04:41:08 MSK
Странное поведение... Хотя возникает вопрос:
- у нас, вроде, kerberos;
- а почему указан ip-адрес узла, а не его доменное имя?
- редко, в каких сетях настроена обратная зона, да и в этом случае могут быть коллизии.
Comment 3 Evgeny Sinelnikov 2021-10-20 04:53:15 MSK
Обращаю внимание на этот коммит:
https://github.com/samba-team/samba/commit/e25a9e8f4ec8034d2974a887e4f64e99a04f226a

Removed SMB (development) dialects
----------------------------------

The following SMB (development) dialects are no longer
supported: SMB2_22, SMB2_24 and SMB3_10. They are were
only supported by Windows technical preview builds.
They used to be useful in order to test against the
latest Windows versions, but it's no longer useful
to have them. If you have them explicitly specified
in your smb.conf or an the command line,
you need to replace them like this:
- SMB2_22 => SMB3_00
- SMB2_24 => SMB3_00
- SMB3_10 => SMB3_11
Note that it's typically not useful to specify
"client max protocol" or "server max protocol"
explicitly to a specific dialect, just leave
them unspecified or specify the value "default".

____________________________________



В связи с этим хочу уточнить на каком основании была выбрана и явно указан версия протокола vers=2.0?


____________________________________

В man mount.cifs по этому поводу явно указано:

vers=arg
  SMB protocol version. Allowed values are:
  · 1.0 - The classic CIFS/SMBv1 protocol.
  · 2.0 - The SMBv2.002 protocol. This was initially introduced in Windows Vista Service Pack 1, and Windows Server 2008. Note that the initial release version of Windows  Vista  spoke  a  slightly  different  dialect
    (2.000) that is not supported.
  · 2.1 - The SMBv2.1 protocol that was introduced in Microsoft Windows 7 and Windows Server 2008R2.
  · 3.0 - The SMBv3.0 protocol that was introduced in Microsoft Windows 8 and Windows Server 2012.
  · 3.02 or 3.0.2 - The SMBv3.0.2 protocol that was introduced in Microsoft Windows 8.1 and Windows Server 2012R2.
  · 3.1.1 or 3.11 - The SMBv3.1.1 protocol that was introduced in Microsoft Windows 10 and Windows Server 2016.
  · 3 - The SMBv3.0 protocol version and above.

  · default - Tries to negotiate the highest SMB2+ version supported by both the client and server.

If no dialect is specified on mount vers=default is used.  To check Dialect refer to /proc/fs/cifs/DebugData

Note too that while this option governs the protocol version used, not all features of each version are available.

The  default  since  v4.13.5 is for the client and server to negotiate the highest possible version greater than or equal to 2.1. In kernels prior to v4.13, the default was 1.0. For kernels between v4.13 and v4.13.5 the default is 3.0.
Comment 4 Evgeny Sinelnikov 2021-10-20 04:59:36 MSK
Насколько видно из лога:

окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: get_cachename_from_process_env: pathname=/proc/3854/environ
окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: get_existing_cc: default ccache is KEYRING:persistent:1084801107:krb_ccache_k4PBNFy
окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: handle_krb5_mech: getting service ticket for 10.88.8.226
окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: cifs_krb5_get_req: unable to get credentials for 10.88.8.226
окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: handle_krb5_mech: failed to obtain service ticket (-1765328377)
окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: Unable to obtain service ticket
окт 19 09:24:56 client-uwsry.freeipa.testdomain cifs.upcall[3857]: Exit status -1765328377

Билет для службы на узле 10.88.8.226 не был найден.

Так он и не может быть найден по ip-адресу. Указывать следует доменное имя узла.
Comment 5 Vera Blagoveschenskaya 2021-10-20 10:50:20 MSK
Закрываю данный issue как worksforme
Workaround описан в
https://bugzilla.altlinux.org/show_bug.cgi?id=41161#c1
Работает и с доменным именем, и с ip.