aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* pam_faillock: close the audit socket after useIker Pedrosa2024-05-231-0/+1
| | | | | | | | | | | | | | | | | | | | | * modules/pam_faillock/pam_faillock.c (check_tally): Close the audit socket when it will no longer be used. ``` Error: RESOURCE_LEAK (CWE-772): Linux-PAM-1.6.0/modules/pam_faillock/pam_faillock.c:247: open_fn: Returning handle opened by "audit_open". Linux-PAM-1.6.0/modules/pam_faillock/pam_faillock.c:247: var_assign: Assigning: "audit_fd" = handle returned from "audit_open()". Linux-PAM-1.6.0/modules/pam_faillock/pam_faillock.c:256: noescape: Resource "audit_fd" is not freed or pointed-to in "audit_log_user_message". Linux-PAM-1.6.0/modules/pam_faillock/pam_faillock.c:258: leaked_handle: Handle variable "audit_fd" going out of scope leaks the handle. 256| audit_log_user_message(audit_fd, AUDIT_RESP_ACCT_UNLOCK_TIMED, buf, 257| rhost, NULL, tty, 1); 258|-> } 259| #endif 260| opts->flags |= FAILLOCK_FLAG_UNLOCKED; ``` Resolves: https://issues.redhat.com/browse/RHEL-36475 Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
* pam_env: fix error handling in econf_read_fileDmitry V. Levin2024-05-191-4/+4
| | | | | | * modules/pam_env/pam_env.c [USE_ECONF] (econf_read_file): Make sure the returned array of strings is properly initialized when econf_getStringValue() fails to return a value.
* pam_env: fix NULL dereference on error path in econf_read_fileDmitry V. Levin2024-05-191-1/+1
| | | | | | | * modules/pam_env/pam_env.c [USE_ECONF] (econf_read_file): Handle NULL value returned by econf_getStringValue(). Resolves: https://github.com/linux-pam/linux-pam/issues/796
* Move all historic changelog files to a top-level ChangeLog.old directoryDmitry V. Levin2024-05-153-0/+0
| | | | Move all historic changelog files away to avoid confusion.
* build: do not distribute historic changelog filesDmitry V. Levin2024-05-152-7/+5
| | | | | | | | | | | | | Since 2011, ChangeLog file is generated from git log history. ChangeLog-CVS is a historic changelog file that was maintained before the project was migrated from cvs to git. CHANGELOG is another historic changelog file that was replaced by ChangeLog in 2005. modules/pam_unix/CHANGELOG is the oldest of historic changelog files, it is not maintained since 1999. All these historic changelog files are no longer relevant, so they are no longer included into release tarballs.
* libpam: make /etc/passwd checks 8 bit cleanGöran Uddeborg2024-05-131-1/+1
| | | | | | | | libpam/pam_modutil_check_user.c: explicitly convert the character read from /etc/passwd to type "char" to get the same signedness as the one compared with. Otherwise the functionality will depend on the (implementation defined) signedness of "char" on the platform built for.
* Fix CHANGELOG encodingTim Hutt2024-04-251-1/+1
| | | | | | | Dag-Erling Smørgrav's name was encoded using some encoding other than UTF-8 (that line predates the UTF-8 consensus). This changes it to use UTF-8, so that it renders properly and so that editors that guess the file is UTF-8 do not get confused about it.
* pam_umask: document details about the GECOS fieldChristoph Anton Mitterer2024-04-151-2/+4
| | | | Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
* pam_umask: minor improvements to wordingChristoph Anton Mitterer2024-04-151-6/+6
| | | | | | The previous sentence was strange to read. Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
* pam_unix: compare password hashes in constant timeChristian Göttsche2024-04-131-2/+2
| | | | | Compare the hashes in constant time as a defense-in-depth mechanism, since performance is not a priority.
* libpam: add helper to compare strings in constant timeChristian Göttsche2024-04-131-0/+14
| | | | | | | | | Add a helper function to compare two strings for equality, that performs the same amount of operations based on the first argument, regardless of the length of the second argument, or the position of the first difference. This can be used as defense-in-depth mitigation against timing attacks of password comparisons.
* Prepare for 1.6.1 releaseDmitry V. Levin2024-04-093-2/+11
| | | | | | | | * configure.ac (AC_INIT): Raise version to 1.6.1. * po/Linux-PAM.pot (Project-Id-Version): Likewise. * NEWS: Update. Resolves: https://github.com/linux-pam/linux-pam/issues/774
* po: update .pot and .po filesDmitry V. Levin2024-04-0883-602/+593
| | | | | Regenerate po/Linux-PAM.pot and po/*.po using "make -C po update-po" command. This essentially updates the line numbers and timestamps.
* configure.ac: do not check for headers that are included unconditionallyDmitry V. Levin2024-04-071-4/+1
| | | | | | | * configure.ac (AC_HEADER_STDC, AC_HEADER_TIME): Remove. (AC_CHECK_HEADERS): Remove fcntl.h, limits.h, malloc.h, sys/file.h, sys/ioctl.h, sys/time.h, syslog.h, net/if.h, termio.h, unistd.h, sys/fsuid.h, and inittypes.h.
* doc: fix pam_get_data manual regarding PAM_NO_MODULE_DATA return valueDmitry V. Levin2024-04-031-3/+2
| | | | | | | | | | | | | | pam_get_data manual page used to claim that PAM_NO_MODULE_DATA is returned not only when no module specific data is present but also when there is a corresponding data entry with NULL value. As this claim is in contradiction with the implementation and with the pam manual page, fix pam_get_data manual page. * doc/man/pam_get_data.3.xml (PAM_NO_MODULE_DATA): Sync with the implementation and with the pam manual page. Resolves: https://github.com/linux-pam/linux-pam/pull/780
* tests: check pam_get_data PAM_NO_MODULE_DATA return value semanticsDmitry V. Levin2024-04-031-2/+13
| | | | | * tests/tst-pam_get_data.c (main): Check that PAM_NO_MODULE_DATA is returned by pam_get_data iff the corresponding data is not present.
* tests: cleanup tst-pam_get_data to use test_assert.h frameworkDmitry V. Levin2024-04-031-131/+51
| | | | | * tests/tst-pam_get_data.c: Include "test_assert.h". (main): Rewrite using ASSERT_EQ() and ASSERT_NE() macros.
* tests: Add some pam_get_data testsMarco Trevisan (Treviño)2024-04-032-1/+181
| | | | The function was not tested, so add some basic testing to it.
* doc: fix uses of non-neutral gender pronounsAura Herrero Ruiz2024-04-0210-21/+21
|
* pam_start.c: do not call bindtextdomain() unless nls is enabledDmitry V. Levin2024-03-311-1/+1
| | | | | | | | | | | Call bindtextdomain() only when both the function is available and the build is configured with --enable-nls. * libpam/pam_start.c (_pam_start_internal): Guard bindtextdomain() invocation with ENABLE_NLS. Complements: v1.6.0~244 ("pam_start.c: call bindtextdomain() to expose Linux-PAM locales") Resolves: https://github.com/linux-pam/linux-pam/pull/773
* pam_env: document when the module is executedThorsten Kukuk2024-03-311-2/+19
| | | | | | | | Document that pam_env.so is only called by pam_setcred() and not by pam_authenticate() when added to the auth stack. Resolves: https://github.com/linux-pam/linux-pam/issues/680 Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
* po: update da.poAlan012024-03-311-93/+17
|
* po: update translations using Weblate (Indonesian)Andika Triwidada2024-03-311-74/+81
| | | | | | Currently translated at 87.1% (88 of 101 strings). Translate-URL: https://translate.fedoraproject.org/projects/linux-pam/master/id/
* pam_unix: allow empty passwords with non-empty hashesSergei Trofimovich2024-03-291-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before the change pam_unix has different behaviours for a user with empty password for these two `/etc/shadow` entries: nulloktest:$6$Yy4ty2jJ$bsVQWo8qlXC6UHq1/qTC3UR60ZJKmKApJ3Wj7DreAy8FxlVKtlDnplFQ7jMLVlDqordE7e4t49GvTb.aI59TP0:1:::::: nulloktest::1:::::: The entry with a hash was rejected and the entry without was accepted. The rejection happened because 9e74e90147c "pam_unix: avoid determining if user exists" introduced the following rejection check (slightly simplified): ... } else if (p[0] == '\0' && nullok) { if (hash[0] != '\0') { retval = PAM_AUTH_ERR; } We should not reject the user with a hash assuming it's non-empty. The change does that by pushing empty password check into `verify_pwd_hash()`. `NixOS` generates such hashed entries for empty passwords as if they were non-empty using the following perl code: sub hashPassword { my ($password) = @_; my $salt = ""; my @chars = ('.', '/', 0..9, 'A'..'Z', 'a'..'z'); $salt .= $chars[rand 64] for (1..8); return crypt($password, '$6$' . $salt . '$'); } Resolves: https://github.com/linux-pam/linux-pam/issues/758 Fixes: 9e74e90147c "pam_unix: avoid determining if user exists" Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
* pam_limits: fix potential use-after-free of pl->conf_fileShaleen Bathla2024-03-041-2/+10
| | | | | | | | | | When limits.d is processed, pl->conf_file consequently points to elements of filename_list array which are freed later even though it can still be used in the logging. Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com> Co-authored-by: Dmitry V. Levin <ldv@strace.io> Fixes: f6b973b92281 ("Add support for limits.d directory to pam_limits")
* pam_unix: use yp functions only if nis requestedTobias Stoeckmann2024-03-031-1/+1
| | | | | | | It can happen that yp functions are found in system but their header files are not available. In this case, do not call them. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* build: fail if requested nis headers are missingTobias Stoeckmann2024-03-031-3/+6
| | | | | | | Failing if a feature is directly requested is default by now. Do the same for --enable-nis=yes. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* conf/modules: constify read-only data arraysChristian Göttsche2024-02-224-8/+8
|
* pam_unix: drop cast to same typeChristian Göttsche2024-02-221-1/+1
|
* modules: drop redundant return at end of void functionsChristian Göttsche2024-02-223-3/+0
|
* pam_faillock: drop duplicate includeChristian Göttsche2024-02-221-1/+0
|
* modules: enclose macro parameterChristian Göttsche2024-02-226-14/+14
|
* libpamc: enclose macro parameterChristian Göttsche2024-02-221-2/+2
|
* libpam: enclose macro parametersChristian Göttsche2024-02-223-21/+21
|
* pam_unix: avoid string formatting of NULLChristian Göttsche2024-02-221-2/+3
| | | | | | | Since the struct member user might be NULL use the same condition for the value as for the preceding key. Reported-by: Yugend
* pam_xauth: untangle stringsChristian Göttsche2024-02-221-10/+13
| | | | | | | | Untangle two distinct strings to simplify their usage. Check for allocation failure of the second one. Fix double-free of the second one in the error branch in line 692. Reported-by: Yugend
* pam_xauth: sanitize variable after asprintf(3) failureChristian Göttsche2024-02-221-0/+1
| | | | | On asprintf(3) failure the value of the first argument is undefined. Set to NULL to avoid UB on cleanup.
* pam_limits: print line number in warningTobias Stoeckmann2024-02-071-1/+5
| | | | | | | The line itself is modified while parsing its content. Print the line number and file name instead so an administrator can investigate it. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* pam_limits: remove whitespaces around valueTobias Stoeckmann2024-02-061-1/+21
| | | | | | | | | Trim all whitespaces before and after value. Resolves: https://github.com/linux-pam/linux-pam/pull/760 Fixes: eec4358a49dc ("pam_limits: avoid sscanf in parse_config_file") Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* libpam_internal: introduce pam_lineTobias Stoeckmann2024-02-067-54/+71
| | | | | | | | | | | The pam_assemble_line function is renamed to pam_line_assemble and moved into libpam_internal so it can be shared across libpam and the pam_env module. Applied renaming to all other relevant functions and data structures so it is easier to locate them in files. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* pam_inline.h: Fix use of memset_explicit(3)Arseny Maslennikov2024-02-041-1/+1
| | | | | | | | | | | That function is being added to C23 with the same prototype as memset(3): void* memset_explicit(void*, int, size_t); Unlike bzero, it accepts the fill byte as an argument. Fixes: 19a292681789 ("libpam: introduce secure memory erasure helpers")
* pam_unix: try to set uid to 0 for unix_chkpwdTobias Stoeckmann2024-01-242-15/+16
| | | | | | | | | | | | | The geteuid check does not cover all cases. If a program runs with elevated capabilities like CAP_SETUID then we can still check credentials of other users. Keep logging for future analysis though. Resolves: https://github.com/linux-pam/linux-pam/issues/747 Fixes: b3020da7da38 ("pam_unix/passverify: always run the helper to obtain shadow password file entries") Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* libpam_internal: supply debug functionalityTobias Stoeckmann2024-01-2423-27/+93
| | | | | | | | | | Move function bodies from headers into dedicated object files stored in libpam_internal. This library won't be installed. Keep the debug function body in header, even though disabled when building Linux-PAM, to stay API compatible with previous versions. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* configure: fail if specified option cannot be satisfiedChristian Göttsche2024-01-221-7/+15
| | | | | | | | | | | | The options whether to build with support for libprelude, libaudit, libselinux, or libeconf are set to enable-if-available. These options also have a configure flag `--enable-foo`, which currently fall back to the feature being disabled if not available. Change these feature flags to fail if specified explicitly and the required dependencies cannot be satisfied. Prompted by #728 and #746
* pam_faildelay: add more tests to delay parserTobias Stoeckmann2024-01-211-1/+1
| | | | Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* pam_faildelay: support UINT_MAX delay on 32 bitTobias Stoeckmann2024-01-211-8/+8
| | | | | | | | Use strtoll to support up to 64 bit on 32 bit systems, although only up to 32 unsigned bits are used. The strtoul function exists but converts negative numbers to positive ones without any form of warning. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* modules: add pamc headers to the search path only when neededTobias Stoeckmann2024-01-2146-88/+50
| | | | | | | | | The pam client library libpamc is only needed if libpam_misc is in use. But libpam_misc is only used by an SELinux helper binary. Remove the libpamc includes from the search path in all other cases. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* pam_pwhistory: allocate crypt data on the heapChristian Göttsche2024-01-211-9/+26
| | | | | The struct crypt_data has the size of 32768 bytes, thus allocate it on the heap for portability.
* pam_userdb: cleanse crypt dataChristian Göttsche2024-01-211-0/+1
| | | | Clease the crypt data to avoid any potential information leakage.
* pam_unix: cleanse crypt dataChristian Göttsche2024-01-211-0/+1
| | | | | Cleanse the crypt data also in the failure branch to sanitize in case of partial data being written.