gdm-smartcard pam config needs to be updated for Ubuntu and installed

Bug #1865226 reported by pi-rho
32
This bug affects 3 people
Affects Status Importance Assigned to Milestone
GNOME Settings Daemon
Fix Released
Unknown
gdm3 (Debian)
Fix Released
Unknown
gdm3 (Ubuntu)
Fix Released
High
Marco Trevisan (Treviño)
Focal
In Progress
High
Marco Trevisan (Treviño)
gnome-settings-daemon (Ubuntu)
Fix Released
Medium
Marco Trevisan (Treviño)
Focal
Incomplete
Medium
Marco Trevisan (Treviño)
sssd (Ubuntu)
Fix Released
Undecided
Marco Trevisan (Treviño)
Focal
In Progress
Undecided
Marco Trevisan (Treviño)

Bug Description

[ Impact ]

the pam profile for gdm-smartcard is missing. gdm refuses to login with a smartcard. Looking at ubuntu/+source/gdm3, other pam files are pregenerated into debian/ and installed from there; gdm-smartcard is left out.

[ Test case ]

1. When in GDM, insert a smartcard
2. The GDM interface should require for an user
3. The user should be set (or empty may be provided,
   depending on sssd configuration)
4. The smartcard PIN should be requested and once introduce the
   user must login.

Note that this requires configuring sssd before, a simple local configuration could require having sssd.conf filled with:

```ini
[sssd]
enable_files_domain = True
services = pam

[certmap/implicit_files/$USER]
matchrule = <SUBJECT>.*YOUR CARD IDENTIFIER*

[pam]
pam_cert_auth = True
```

The UI authentication can also be simulated via pamtester:

# Must be ran as user
sudo apt install pamtester
pamtester -v gdm-smartcard $USER authenticate

Expected output is
+ pamtester -v gdm-smartcard ubuntu authenticate
pamtester: invoking pam_start(gdm-smartcard, ubuntu, ...)
pamtester: performing operation - authenticate
PIN for Test Organization Sub Int Token:
pamtester: successfully authenticated

---

Alternatively, if no smartcard or hardware is available, this can be tested and simulated using these scripts (they will reset the system setup at each run, but it's suggested to run them in a VM, lxd container or in a test installation):
 https://gist.github.com/3v1n0/287d02ca8e03936f1c7bba992173d47a

- sudo apt install gdm3 pamtester softhsm2 openssl wget sssd gnutls-bin && \
  sudo apt-mark auto gdm3 pamtester softhsm2 openssl wget sssd gnutls-bin
- wget https://gist.github.com/3v1n0/287d02ca8e03936f1c7bba992173d47a/raw/sssd-gdm-smartcard-pam-auth-tester.sh
- wget https://gist.github.com/3v1n0/287d02ca8e03936f1c7bba992173d47a/raw/sssd-softhism2-certificates-tests.sh
- sudo bash ./sssd-gdm-smartcard-pam-auth-tester.sh

The script will generate some fake CA authority, issue some certificates, will install them in some software-based smartcards (using softhsm2) and test that they work properly to login with gdm-smartcard.

Using `WAIT` environment variable set (to any value) will make it to restart gdm at each iteration so that an user can try to access, using the username that launched the script and the pin of 123456.

[ Regression potential ]

Smartcard authentication using custom methods using via a custom configured system nss database may not work anymore.

---

ProblemType: BugDistroRelease: Ubuntu 18.04
Package: gdm3 3.28.3-0ubuntu18.04.4
ProcVersionSignature: Ubuntu 5.3.0-24.26~18.04.2-generic 5.3.10
Uname: Linux 5.3.0-24-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.11
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Feb 28 14:30:30 2020
InstallationDate: Installed on 2016-05-23 (1376 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)SourcePackage: gdm3
UpgradeStatus: No upgrade log present (probably fresh install)
mtime.conffile..etc.gdm3.Xsession: 2018-04-27T11:41:04.766901

Related branches

CVE References

Revision history for this message
pi-rho (pi-rho) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, confirmed, unsure why Debian does that instead of using the upstream ones, it would be useful to report to Debian

Changed in gdm3 (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
pi-rho (pi-rho) wrote :

reported to debian BTS, added link

Changed in gdm:
status: Unknown → New
tags: added: rls-gg-incoming
Revision history for this message
Sebastien Bacher (seb128) wrote :

comment from one of the Debian pkg-gnome maintainer

'the upstream gdm pam rules are not working out of the box due to nss not installing the NSSDB in /etc/pki/nssdb/ (which I think is a Fedoraism)'

summary: - gdm3 fails to install /etc/pam.d/gdm-smartcard
+ gdm-smartcard pam config needs to be updated for Ubuntu and installed
Revision history for this message
Steve Langasek (vorlon) wrote :

Dimitri, why is a bug task opened on pam? The description doesn't point to this being a pam bug.

Changed in pam (Ubuntu):
status: New → Invalid
Changed in gdm3 (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
tags: removed: rls-gg-incoming
Revision history for this message
Eric Desrochers (slashd) wrote :

It has been brought to my attention by a UA customer that they are suffering from which seems a similar situation:

"
Our only currently working SmartCard access from Linux, over SSSD, to AD, is on RHEL7.
I was able to get SSH access on Ubuntu 20.04LTS, after adding "ad_gpo_access_control = permissive" in sssd.conf.

Logging in locally fails (prompting for password, rather than PIN). It is also still prompting for the Password twice on all local login attempts.

RHEL7 -> Ubuntu 20.04LTS (SSH) - Success
Ubuntu 20.04LTS -> RHEL7 (SSH) - Success
Ubuntu Desktop login (GDM or CLI) - Fail
Ubuntu Desktop login via local username/pw - Success, but with 2 pw prompts.
"

Eric Desrochers (slashd)
Changed in gdm3 (Ubuntu Groovy):
importance: Low → Medium
Eric Desrochers (slashd)
Changed in gdm3 (Ubuntu Groovy):
importance: Medium → High
Changed in gdm3 (Ubuntu Focal):
status: New → Confirmed
importance: Undecided → High
Changed in gdm3 (Ubuntu Bionic):
importance: Undecided → High
Steve Langasek (vorlon)
Changed in pam (Ubuntu Bionic):
status: New → Invalid
Changed in pam (Ubuntu Focal):
status: New → Invalid
Revision history for this message
Eric Desrochers (slashd) wrote :

# git clone https://gitlab.gnome.org/GNOME/gdm.git

# find . -name "gdm-smartcard*"
./data/pam-arch/gdm-smartcard.pam
./data/pam-redhat/gdm-smartcard.pam
./data/pam-exherbo/gdm-smartcard.pam
./data/pam-lfs/gdm-smartcard.pam

It seems like Ubuntu/Debian will have to start by having a 'compatible' PAM stack config.

So far looking upstream, it seems to only be defined for 4 specific distros:
- Archlinux
- Redhat
- Exherbo
- Linux From Scratch (LFS)

Revision history for this message
Sebastien Bacher (seb128) wrote :

Right, as pointed out in previous comments the configuration as it is today isn't workin on Debian/Ubuntu systems, the first step would be to have someone understand those pam details working out those parts

Revision history for this message
Eric Desrochers (slashd) wrote :

I unfortunately don't have a smartcard device handy to test/debug/.... but if I compare with RHEL which is known to be working...

Redhat has the following configuration "gdm-smarcard" which includes "smartcard-auth", a symlink pointing to "smartcard-auth-local"

I think we should 'mimic' this (at least as a starting point) without the selinux and other RHEL specific bits.

- Eric

Changed in gdm3 (Ubuntu Focal):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :
Changed in gnome-settings-daemon (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
importance: Undecided → Medium
status: New → In Progress
no longer affects: gnome-settings-daemon (Ubuntu Bionic)
Changed in gdm3 (Ubuntu Bionic):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Sebastien Bacher (seb128) wrote :

The solution is going to require sssd which started being used in focal, we are not going to do official updates to bionic

Changed in gdm3 (Ubuntu Bionic):
status: New → Won't Fix
Changed in gnome-settings-daemon (Ubuntu Focal):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Changed in gnome-settings-daemon (Ubuntu Groovy):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

While Bionic could be maybe supported, that would likely require newer SSSD.

Maybe in such case a pam_pkcs11 based solution could be provided, but it's quite a lot of backporting work which would need SRU team to agree with.

Revision history for this message
Eric Desrochers (slashd) wrote :

Lukasz (sil2100) can we have your SRU team input on this bug with regard to Bionic/18.04lTS ?

Revision history for this message
Eric Desrochers (slashd) wrote :

(I have ping sil2100 internally for him to provide his 2 cents on this bug.)

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Though I do understand it is a bit annoying that smartcard login on bionic doesn't work, it worries me that fixing this would involve a lot of backporting. This isn't a regression and bionic has been like this from day 0, right? Do we have an understanding on how wanted this is on bionic?

I'm not saying no, but right now I wouldn't be comfortable in such a big set of changes without a rationale. I would rather recommend them to switch to focal and fixing it there. But I'd have to know more.

Mathew Hodson (mhodson)
no longer affects: pam (Ubuntu)
no longer affects: pam (Ubuntu Bionic)
no longer affects: pam (Ubuntu Focal)
no longer affects: pam (Ubuntu Groovy)
affects: gdm → ubuntu-translations
Changed in ubuntu-translations:
importance: Unknown → Undecided
no longer affects: ubuntu-translations
Changed in gdm3 (Debian):
status: Unknown → New
Changed in gdm3 (Ubuntu Groovy):
status: Confirmed → In Progress
no longer affects: gdm3 (Ubuntu Groovy)
no longer affects: gnome-settings-daemon (Ubuntu Groovy)
Changed in gdm3 (Ubuntu):
status: Confirmed → In Progress
Changed in gnome-settings-daemon (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-settings-daemon - 3.38.1-3ubuntu3

---------------
gnome-settings-daemon (3.38.1-3ubuntu3) hirsute; urgency=medium

  * debian/patches: Support smartcard reders via p11kit API (LP: #1865226)
  * debian/control: Build depend on libgck-1-dev and remove nss dependency
    (LP: #1865226)

 -- Marco Trevisan (Treviño) <email address hidden> Thu, 25 Feb 2021 04:53:56 +0100

Changed in gnome-settings-daemon (Ubuntu):
status: Fix Committed → Fix Released
Changed in gdm3 (Debian):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.6 KiB)

This bug was fixed in the package gdm3 - 3.38.2.1-2ubuntu1

---------------
gdm3 (3.38.2.1-2ubuntu1) hirsute; urgency=medium

  * Merge with debian, containing new upstream version
  * debian/control: Don't Recommend pam fprintd module, as we seed it
  * debian/patches: Refresh
  * debian/gdm3.prerm: Resync with debian
  * debian/gdm3.gdm-smartcard-*: Add user_readenv=1 in pam_env.so
  * Remaining changes with debian:
    + readme.debian: update for correct paths in ubuntu
    + control.in:
      - don't recommend desktop-base
      - build depend on libgudev-1.0-dev
      - depend on bash for config_error_dialog.patch
      - update vcs field
    + rules:
      - don't override default user/group
      - -dgdm-xsession=true to install upstream xsession script
      - override dh_installinit with --no-start to avoid session being killed
    + rules, readme.debian, gdm3.8.pod:
      use upstream custom.conf instead of daemon.conf
    + gdm3.{postinst,postrm}: rename user and group back to gdm
    + gdm3.*.pam: make pam_env read ~/.pam_environment, as we use in g-c-c
      settings
    + gdm3.install:
      - stop installing default.desktop. it adds unnecessary clutter
        ("system default") to the session chooser.
      - don't install debian/xsession
    + add run_xsession.d.patch
    + add xresources_is_a_dir.patch
      - fix loading from /etc/x11/xresources/*
    + add nvidia_prime.patch:
      - add hook to run prime-offload (as root) and prime-switch if
        nvidia-prime is installed
    + add revert_override_lang_with_accountservices.patch:
      - on ubuntu accountservices only stores the language and not the
        full locale as needed by lang.
    + add dont_set_language_env.patch:
      - don't run the set_up_session_language() function, since it
        overrides variable values set by ~/.pam_environment
    + add config_error_dialog.patch:
      - show warning dialog in case of error in ~/.profile etc. and
        don't let a syntax error make the login fail
    + add debian/patches/revert_nvidia_wayland_blacklist.patch:
      - don't blacklist nvidia for wayland
    + add gdm3.service-wait-for-drm-device-before-trying-to-start-i.patch:
      - wait for the first valid gdm device on pre-start
    + add debian/default.pa
      - disable bluetooth audio devices in pulseaudio from gdm3.
    + debian/gdm3.install
      - added details of the default.pa file
    + debian/gdm3.postinst
      - added installation of default.pa and creation of dir if it doesn't
        exist.
    + debian/greeter.dconf-defaults: don't set debian settings in the
      greeter's dconf db

gdm3 (3.38.2.1-2) experimental; urgency=medium

  * debian: Add gdm-smartcard PAM module implemented with libpam_sss.
    The implementation uses update-alternatives to provide a generic
    gdm-smartcard PAM module that can be changed using the tool.
    Potentially other systems could be used or supported (such as pam_pkcs11
    or pam_p11) by adding other modules implementing the gdm-smartcard auth
    service. (LP: #1865226, Closes: #953557)
  * debian: Add gdm-smartcard implementation using pkcs11
  * debian/gdm3.gdm-smartcard-sssd-exclusive.pam:
    - PAM co...

Read more...

Changed in gdm3 (Ubuntu):
status: In Progress → Fix Released
Mathew Hodson (mhodson)
no longer affects: gdm3 (Ubuntu Bionic)
Changed in gnome-settings-daemon (Ubuntu Focal):
importance: Undecided → Medium
Revision history for this message
Eric Desrochers (slashd) wrote :

Any idea when Focal will be completed ?

Regards,
Eric

tags: added: dt-194
Changed in gnome-settings-daemon:
status: Unknown → New
Changed in gdm3 (Ubuntu Focal):
status: Confirmed → In Progress
Changed in gnome-settings-daemon (Ubuntu Focal):
status: New → In Progress
Changed in gnome-settings-daemon:
status: New → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

There is an sssd package in focal-unapproved that points at this bug, with this d/changelog snippet:

  * debian/patches: Backport patches atches to support properly GDM smartcard
    login (LP: #1865226)
(sic)

But there is no sssd task in this bug.

I also don't see a gdm3 upload to focal unapproved, nor gnome-settings-daemon.

Can somebody please clarify this situation? What is needed in focal to fix this bug?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Also, this but is missing the SRU template, in case the sssd upload I mentioned in my previous comment is really addressing this bug.

description: updated
description: updated
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Andreas:

 - I've now added SSSD to the bug
 - I had not uploaded the remaining bits yet as I was waiting for SSSD to hit the queue first
 - GNOME settings daemon is also uploaded now to the queue
 - GDM will be uploaded soon by Jeremy

The bug has now been updated to have a proper SRU template, with all the tests required to check all the 3 packages.

Changed in sssd (Ubuntu):
status: New → In Progress
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
no longer affects: gdm3 (Ubuntu Focal)
no longer affects: gnome-settings-daemon (Ubuntu Focal)
Changed in gdm3 (Ubuntu Focal):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
importance: Undecided → High
Changed in gnome-settings-daemon (Ubuntu Focal):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
importance: Undecided → Medium
Changed in sssd (Ubuntu Focal):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: New → In Progress
Changed in gdm3 (Ubuntu Focal):
status: New → In Progress
Changed in gnome-settings-daemon (Ubuntu Focal):
status: New → In Progress
Changed in sssd (Ubuntu):
status: In Progress → Fix Released
description: updated
Revision history for this message
Chris Halse Rogers (raof) wrote :

> Smartcard authentication using custom methods using via a custom configured system nss database may not work anymore.

Do I read the gnome-settings-daemon patches correctly, and this actually just entirely drops support for auth via NSS? So the regression potential is that if someone has set up auth via a custom system nss database, this *will* break login for them?

(Unrelatedly, patches like smartcard-Use-autopointers.patch and smartcard-manager-Use-mutex-auto-lockers-when-convenient.patch are the sort of refactoring patches that we prefer not to see in SRUs. I don't think they're a blocker, but they make reviewing more difficult)

Changed in gnome-settings-daemon (Ubuntu Focal):
status: In Progress → Incomplete
Revision history for this message
Chris Halse Rogers (raof) wrote :

gdm3 looks good to me, but I haven't accepted it yet as it depends on the gnome-settings-daemon patches and I think it's best to resolve those questions before accepting gdm3 into -proposed.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

What's the status here? Questions are still unanswered after four months.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Sorry, I missed the previous comments.

> Do I read the gnome-settings-daemon patches correctly, and this actually just entirely drops support for auth via NSS? So the regression potential is that if someone has set up auth via a custom system nss database, this *will* break login for them?

Well, yes that's a regression potential that may indeed be mentioned, it's also something that we never supported though, since that required some extra setup in various places (write a gdm pam configuration, create the NSS database and configure pam-pkcs11/pam_sss). But indeed it could potentially affect someone who went through all this.

However... The SSSD side of this (lp:1905790), if one had configured a NSS database in the canonical location, it will be migrated (using this tool https://github.com/3v1n0/nss-database-pem-exporter).

So, it's quite a remote possibility but worth to mention in a clearer way (it was somewhat written already).

> Unrelatedly, patches like smartcard-Use-autopointers.patch and smartcard-manager-Use-mutex-auto-lockers-when-convenient.patch are the sort of refactoring patches that we prefer not to see in SRUs. I don't think they're a blocker, but they make reviewing more difficult

Let me know if I should drop them, one reason why they were added is that they were part of the upstream changes too, and so it made easier to ensure that we're both in the same line if problems may happen, making easier to backport patches in future if needed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.