Bug 54246 - Невозможно зашифровать с помощью парольной фразы для входа
Summary: Невозможно зашифровать с помощью парольной фразы для входа
Status: CLOSED WORKSFORME
Alias: None
Product: Sisyphus
Classification: Development
Component: fscrypt (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Andrew Savchenko
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-13 13:08 MSK by Pavel Shilov
Modified: 2025-07-19 17:43 MSK (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Shilov 2025-05-13 13:08:35 MSK
Произвел проверку на платформах обновленных до Сизиф:
* alt-workstation-11.0-x86-64

Версия пакета: 
* fscrypt-0.3.5-alt1.x86_64

Шаги воспроизведения:
1. Подключить и примонтировать Flash накопитель отформатированный в ext4:
# mkdir -p /mnt/usb/ext4
# tune2fs -O encrypt /dev/sdb1
# mount /dev/sdb1 /mnt/usb/ext4
# chmod o+w /mnt/usb/ext4
2. Произвести настройку утилиты:
# fscrypt setup
3. Произвести глобальную настройку или настройку файловой системы:
$ fscrypt setup /mnt/usb/ext4
3. Создать пустую папку для проверки:
# mkdir -p /mnt/usb/ext4/dir2
4. Запустить команду шифрования:
$ fscrypt encrypt /mnt/usb/ext4/dir2
5. Выбрать опцию 1 - Your login passphrase (pam_passphrase)

Ожидаемое поведение:
Успешная блокировка при помощи login passphrase 
$ fscrypt status /mnt/usb/ext4/dir2/ 
"/mnt/usb/ext4/dir2/" is encrypted with fscrypt.

Policy:   1c72f40285ed5ca574b1de7e90f9733b
Options:  padding:32  contents:AES_256_XTS  filenames:AES_256_CTS  policy_version:2
Unlocked: Yes

Protected with 2 protectors:
PROTECTOR         LINKED   DESCRIPTION
584a85bd48e8aff1  Yes (/)  login protector for test
e27fbc4ad7912dfe  No       custom protector "Recovery passphrase for dir2"

Фактическое поведение:
Вывод ошибки неверный пароль:
$ fscrypt encrypt /mnt/usb/ext4/dir2/ --verbose --user=test
2025/05/13 12:26:31 Reading config from "/etc/fscrypt.conf"
2025/05/13 12:26:31 creating context for user "test"
2025/05/13 12:26:31 /mnt/usb/ext4/dir2/ is on ext4 filesystem "/mnt/usb/ext4" (/dev/sdc1)
2025/05/13 12:26:31 checking whether "/mnt/usb/ext4/dir2/" is already encrypted
2025/05/13 12:26:31 checking whether filesystem /mnt/usb/ext4 supports encryption
2025/05/13 12:26:31 checking whether "/mnt/usb/ext4/dir2/" is an empty and readable directory
2025/05/13 12:26:31 creating policy for "/mnt/usb/ext4/dir2/"
2025/05/13 12:26:31 listing protectors in "/mnt/usb/ext4/.fscrypt/protectors"
2025/05/13 12:26:31 found 1 protectors
2025/05/13 12:26:31 successfully read metadata from "/mnt/usb/ext4/.fscrypt/protectors/73f05f64a8200157"
2025/05/13 12:26:31 listing protectors in "/.fscrypt/protectors"
2025/05/13 12:26:31 found 0 protectors
2025/05/13 12:26:31 adding additional ProtectorOptions
Should we create a new protector? [y/N] y
The following protector sources are available:
1 - Your login passphrase (pam_passphrase)
2 - A custom passphrase (custom_passphrase)
3 - A raw 256-bit key (raw_key)
Enter the source number for the new protector [2 - custom_passphrase]: 1          
2025/05/13 12:26:47 using source: pam_passphrase

IMPORTANT: Before continuing, ensure you have properly set up your system for
           login protectors.  See
           https://github.com/google/fscrypt#setting-up-for-login-protectors

2025/05/13 12:26:47 using name: 
2025/05/13 12:26:47 creating login protector on "/" instead of "/mnt/usb/ext4"
2025/05/13 12:26:47 listing protectors in "/.fscrypt/protectors"
2025/05/13 12:26:47 found 0 protectors
2025/05/13 12:26:47 KeyFunc(login protector for test, false)
Enter login passphrase for test: 
2025/05/13 12:26:49 Checking login token for test
2025/05/13 12:26:49 getting secret data for PAM: "Password: "
[ERROR] fscrypt encrypt: incorrect login passphrase

Исправляется если в файле /etc/pam.d/fscrypt добавить логику аутентификации:
# echo 'auth		required	pam_securetty.so'>> /etc/pam.d/fscrypt

После добавления фактическое поведение соответствует ожидаемому.
Comment 1 Pavel Shilov 2025-05-13 14:00:45 MSK
Исправляется если закомментировать логику авторизации в файле /etc/pam.d/fscrypt
#auth		required	pam_unix.so
И добавить 
auth		required	pam_securetty.so
Comment 2 Pavel Shilov 2025-05-13 14:04:07 MSK
(Ответ для Pavel Shilov на комментарий #0)

> 3. Создать пустую папку для проверки:
> # mkdir -p /mnt/usb/ext4/dir2
Ошибка папку создаем от пользователя: $ mkdir -p /mnt/usb/ext4/dir2
Comment 3 Andrew Savchenko 2025-07-19 17:43:25 MSK
(Ответ для Pavel Shilov на комментарий #1)
> Исправляется если закомментировать логику авторизации в файле
> /etc/pam.d/fscrypt
> #auth		required	pam_unix.so
> И добавить 
> auth		required	pam_securetty.so

pam_unix нужен для проверки пароля пользователя. pam_securetty ограничивает терминалы, с которых может логинится root и на обычных пользователей не влияет от слова совсем.

Если использование pam_securetty решает у Вас проблему, то значит что-то очень серьёзно сломано в Вашей системе.