PAMを使用してシステムサービスでGNOMEキーリングをロック解除する

PAMを使用してシステムサービスでGNOMEキーリングをロック解除する

システムサービスとして実行しているときにPAMを使用してGNOMEキーリングのロックを解除できますか?

私たちのソフトウェアはPython Keyringモジュールを使用して資格情報を保存しますが、gnome_keyring_daemonにキーリングパスワードを渡す必要があるため、RHEL / CentosでSecretService Keyringバックエンドを使用するのに問題があります。

~からhttps://pypi.org/project/keyring/:


    Install the GNOME Keyring daemon.

    Start a D-Bus session, e.g. run dbus-run-session -- sh and run the following commands inside that shell.

    Run gnome-keyring-daemon with --unlock option. The description of that option says:

        Read a password from stdin, and use it to unlock the login keyring or create it if the login keyring does not exist.

    When that command is started, enter your password into stdin and press Ctrl+D (end of data). After that the daemon will fork into background (use --foreground option to prevent that).

    Now you can use the SecretService backend of Keyring. Remember to run your application in the same D-Bus session as the daemon.

systemdサービスとして実行すると、上記のようにハードコードされたキーリングパスワードを含むスクリプトを使用してgnomeキーリング(および資格情報)にアクセスできます。

dbus-run-session -- "./unlock-keyring-run.sh"

そのうち Unlock-keyring-run.sh は次のようになります。

echo "Passw0rd" | gnome-keyring-daemon --unlock
run_my_program 

私は、PAMがsystemdサービスの起動時にGNOMEキーリングのロックを解除して、スクリプトが(安全でないように)渡す必要がないかどうか疑問に思います。コンソールからログインするときにPAMを使用してキーリングをロック解除する方法についてのドキュメントがあります。

https://wiki.gnome.org/Projects/GnomeKeyring/Pam/Manual

gnome keyring PAMディレクティブが/etc/pam.d/systemd-userで動作するかどうかを知りたいです。

ベストアンサー1

おすすめ記事