Skip to content

picking through the old pr#3

Open
afoxman wants to merge 103 commits into
mainfrom
authtok
Open

picking through the old pr#3
afoxman wants to merge 103 commits into
mainfrom
authtok

Conversation

@afoxman
Copy link
Copy Markdown
Owner

@afoxman afoxman commented Dec 19, 2025

No description provided.

zhihengq and others added 30 commits April 29, 2023 23:16
Add support for storing an encrypted auth token in u2f_keys.
The auth token is passed to PAM and may be used by other PAM modules.
The encryption key is derived using the FIDO2 hmac-secret extension.
Debug log whether authtok is enabled and when token descryption is
successful.
Yubico#294 (comment)
`brew` has for some time packaged libfido2. We can use those builds to
simplify our pipeline. Ensure linking to the same OpenSSL version as
libfido2 through `brew deps`.
For some reason, openssl@3 is sometimes not listed as "installed". Be
less restrictive and list all dependencies regardless of their currently
perceived state by brew.
Add preprocessor constant `DEVLIST_LEN` to replace magic number 64 in
allocations of device info list.
- Attempting to install `pkg-config` or `pkgconf` results in brew
  complaining about conflicts. Rely on whatever version already present.
- macos-14 seemingly needs an explicit libtool install.
CodeQL action v2 will be deprecated on 2024-12-05.
Under Linux the read call seems to accept NULL as a parameter:

  $ cat try.c
  #include <unistd.h>
  #include <err.h>

  int main(void)
  {
      int i = read(0, NULL, 4);

      err(1, "read");
      return 0;
  }
  $ make try
  cc     try.c   -o try
  $ ./try </dev/random
  try: read: Bad address

Such behaviour is not specified by POSIX, so we should
catch it.

Since we are at it, catching read(-1, ...) is probably a good
idea, since code that does that is arguably wrong.
Instead, use more meaningful status codes:

- PAM_SYSTEM_ERR if getpwuid_r(), gethostname(), or
  pam_modutil_{drop,regain}_priv() fails;
- PAM_BUF_ERR if memory allocation routines fails; and
- PAM_ABORT for any uncaught errors.

This commit is part of a fix for YSA-2025-01 / CVE-2025-23013.
Move PAM return value handling to get_devices_from_authfile():

If `nouserok` is set, return

- PAM_IGNORE if open() returns ENOENT;
- PAM_IGNORE if user is not found in the authfile;
- PAM_IGNORE if user is found in the but have no credentials;
- PAM_AUTHINFO_UNAVAIL otherwise.

If `nouserok` is *not* set, return

- PAM_USER_UNKNOWN if user is not found in the authfile;
- PAM_USER_UNKNOWN if user is found but have no credentials;
- PAM_AUTHINFO_UNAVAIL otherwise.

This commit is part of a fix for YSA-2025-01 / CVE-2025-23013.
This simplifies reasoning about the return value in
pam_sm_authenticate(). Function returns PAM_SUCCESS if successful,
PAM_AUTH_ERR otherwise.
dacav and others added 23 commits December 19, 2025 15:04
autoconf/automake/libtool are only needed if building from git, as the dist
tarball is not depending on autotools.

The reference to GNU Autotools has been moved under "Building from Git", since
this detail is interesting only for those who clone the project.
While fixing terminology, I noticed redundant variations of the same
logging message in strings(1).  This is not very important,
but less is more.
Ensure path is absolute if provided (the script would fail if FAKEROOT is
supplied as relative path)

Erase FAKEROOT before exiting if created with `mktemp -d`
Split options on multiple lines and sort

Invoke 'cmake --build' instead of 'make' (drop assumptions on underlying build
system)

Drop pushd/popd in favour of supplied build and source directories. Use
subshell when necessary.

Cache `nproc` into a variable
Use ninja for faster build.
Drop autoconf/automake/libtool from workflow dependencies, and add ninja.
The current revision of the script does not use any bashism
nor pipes that require 'pipefail'. We can downgrade to the plain
sh interpreter.
This fixes the following warning by libfuzzer:

  WARNING: no interesting inputs were found so far. Is the code instrumented
  for coverage?
- clone libfido2 and libcbor only if not previously done
- libcbor is patched with libfido2/fuzz/README only on first clone
- use existing corpus if available
Generate the file-level coverage summary report (`llvm-cov report`) and print
it on stdout.

Optionally generate the line-oriented coverage report (`llvm-cov show`).
This is enabled if the WITH_COVERAGE_REPORT environment variable is defined.
The report will be generated in a directory called "cov-report" under
$WORKDIR.
The release procedure assumes that gpg will not armor the detached
signature.  The assumption might turn out wrong if the user sets
the `armor` option in their ~/.gnupg/gpg.conf.
Will be removed by GitHub 2025-04-01.
Comment thread pamu2fcfg/pamu2fcfg.c
int debug;
int verbose;
int nouser;
int authtok;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

authtok covered, the rest were removed

Comment thread pamu2fcfg/pamu2fcfg.c
{ "verbose", no_argument, NULL, 'v' },
{ "username", required_argument, NULL, 'u' },
{ "nouser", no_argument, NULL, 'n' },
{ "authtok", no_argument, NULL, 'a' },
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added authtok as password, ditched the pam args

Comment thread pamu2fcfg/pamu2fcfg.c
" authenticator, defaults to the current user name\n"
" -n, --nouser Print only registration information (key handle,\n"
" public key, and options), useful for appending\n"
" -a, --authtok Read a PAM auth token (usually a password) that\n"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covered

Comment thread pamu2fcfg/pamu2fcfg.c
"\n"
"Report bugs at <" PACKAGE_BUGREPORT ">.\n";
/* clang-format on */
char *saveptr = NULL;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

Comment thread pamu2fcfg/pamu2fcfg.c
args->pam_pinverification = -1;

while ((c = getopt_long(argc, argv, "ho:i:t:rPNVdvu:n", options, NULL)) !=
while ((c = getopt_long(argc, argv, "ho:i:t:rPNVdvu:nap:", options, NULL)) !=
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covered

Comment thread pamu2fcfg/pamu2fcfg.c
case 'n':
args->nouser = 1;
break;
case 'a':
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covered as password, not authtok. removed pam stuff

Comment thread pamu2fcfg/pamu2fcfg.c
size_t enc_authtok_len = 0;

parse_args(argc, argv, &args);
if (args.authtok && args.no_user_presence) {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covered (modified)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants