Commit Graph

234 Commits

Author SHA1 Message Date
christos 6b2da37d70 - Create 3 new variables:
MAKELINKLIB that follows MKLINKLIB but can be overwritten by Makefiles
  MAKESTATICLIB that follows MKSTATICLIB but can be overwritten by Makefiles
  LINKINSTALL that follows MAKELINKLIB but can be overwritten by Makefiles
  These give enough control to the module Makefiles so that they don't need
  to override the default library install rules which break the debug sets.
- Remove /usr/libexec/named which duplicated /usr/lib/named
2024-04-05 01:15:59 +00:00
riastradh 5e725db5ff pam_krb5: Fix PR lib/57631.
Loose ends in the fix for NetBSD-SA2023-006 that weren't caught by
review or, somehow, by my own testing.  Evidently we need automatic
tests for this pam business.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-09-28 02:31:04 +00:00
riastradh 83df26257c pam_ksu(8): Allow homedir access during kuserok.
Otherwise, the default kuserok logic to look at ~targetuser/.k5login
would be blocked by the security measure to thwart NetBSD-SA2023-005.

(There are other ways, e.g. setting SYSTEM-K5LOGIN in /etc/krb5.conf
so the file is /etc/k5login.d/user instead of ~user/.k5login, but
that's not the default configuration and there are plenty of
deployments that rely on ~user/.k5login today.)

I reviewed libkrb5 for homedir access checks.  There are three:

1. krb5_config_parse_file_multi, called only by:
   - verify_krb5_conf -- not relevant
   - krb5_config_parse_file -- not used here as far as I can tell,
     only by libhdb ldap logic and test code in heimdal
   - krb5_set_config_files -- used here only via krb5_init_context,
     which is done at this point

2. plugin_get_hosts in krbhst.c, used to look up hosts for KDC I/O,
   which shouldn't be happening at this point, so this is almost
   certainly unreachable; also it only appears to control whether
   some old plugin API can be used, long after we have read the krb5
   config controlling which plugins are available, so this is
   probably harmless

3. krb5_kuserok, which is the one we want to allow

Note: This will have to be updated again in the next Heimdal update,
which eliminates the global homedir access flag in favour of making
the default per-context homedir access flag conditional on !issuid.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-09-07 11:27:57 +00:00
riastradh ed4af7289b pam_krb5: Refuse to operate without a key to verify tickets.
New allow_kdc_spoof overrides this to restore previous behaviour
which was vulnerable to KDC spoofing, because without a host or
service key, pam_krb5 can't distinguish the legitimate KDC from a
spoofed one.

This way, having pam_krb5 enabled isn't dangerous even if you create
an empty /etc/krb5.conf to use client SSO without any host services.

Perhaps this should use krb5_verify_init_creds(3) instead, and
thereby respect the rather obscurely named krb5.conf option
verify_ap_req_nofail like the Linux pam_krb5 does, but:

- verify_ap_req_nofail is default-off (i.e., vulnerable by default),
- changing verify_ap_req_nofail to default-on would probably affect
  more things and therefore be riskier,
- allow_kdc_spoof is a much clearer way to spell the idea,
- this patch is a smaller semantic change and thus less risky, and
- a security change with compatibility issues shouldn't have a
  workaround that might introduce potentially worse security issues
  or more compatibility issues.

Perhaps this should use krb5_verify_user(3) with secure=1 instead,
for simplicity, but it's not clear how to do that without first
prompting for the password -- which we shouldn't do at all if we
later decide we won't be able to use it anyway -- and without
repeating a bunch of the logic here anyway to pick the service name.

References about verify_ap_req_nofail:
- mit-krb5 discussion about verify_ap_req_nofail:
  https://mailman.mit.edu/pipermail/krbdev/2011-January/009778.html
- Oracle has the default-secure setting in their krb5 system:
  https://docs.oracle.com/cd/E26505_01/html/E27224/setup-148.html
  https://docs.oracle.com/cd/E26505_01/html/816-5174/krb5.conf-4.html#REFMAN4krb5.conf-4
  https://docs.oracle.com/cd/E19253-01/816-4557/gihyu/
- Heimdal issue on verify_ap_req_nofail default:
  https://github.com/heimdal/heimdal/issues/1129
2023-06-20 22:17:18 +00:00
riastradh f9fe2f8c36 pam_ksu: No need for homedir access. 2023-06-20 22:17:09 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
andvar 730fdfa601 nix double n, i or g in "ing", in comments and documentation. 2022-10-26 22:09:37 +00:00
hannken cefc293e00 Set provider to NULL -- "pam" is not a valid security key helper library.
Now ssh-agent no longer fails key addition with

    error: Cannot add provider: RSA is not an authenticator-hosted key
2022-06-15 08:31:34 +00:00
andvar 75d2abaeb1 fix various typos in comments and output/log messages. 2022-04-10 09:50:44 +00:00
christos 3682df8720 Add constrain arguments 2022-02-24 00:26:26 +00:00
rillig fba4f6e3e8 libpam: remove stray semicolon
No binary change.
2022-01-16 10:52:18 +00:00
christos 04f561bb0b Remove workaround, @rillig fixed the issue. 2021-11-01 15:56:53 +00:00
christos 637f9844ca work around lint bug 2021-11-01 12:26:18 +00:00
nia e2fa600c84 pam_exec: Convert realloc(x * y) to reallocarr.
Eliminate a now-redundant temporary variable.
2021-10-30 11:34:59 +00:00
christos 5aee859e4d cast from strchr fixed. 2021-08-11 09:12:07 +00:00
rillig 80321d1c1f libpam: clean up LINTFLAGS
Warning 346 is new, the other suppressions are not needed anymore.
2021-08-11 05:23:05 +00:00
fox 113ec9c52a lib/libpam: Fix the possible -Werror=stringop-truncation
Replace strncpy(3) with the safer strlcpy(3) and adjust the code.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@, christos@
2020-06-12 01:20:32 +00:00
rin 6ce10d32d6 Fix fallout from NO_STATIC_MODULES -> OPENPAM_STATIC_MODULES changes;
libpam.a fails to load any modules and does not work at all.

At the moment, openpam_load.c at least must be compiled with and without
OPENPAM_STATIC_MODULES for static and shared libraries, respectively.

Therefore, use CSHLIBFLAGS again, in order to build objects for static and
shared libraries separately.

This may be ugly, but seems better for me than adding further hacks in
libpam/libpam/Makefile, which is already complicated enough...
2020-05-23 00:43:33 +00:00
christos 4b08ec2333 Fix the vax build and explain why... 2020-05-01 21:58:16 +00:00
riastradh 0f6461fb7e Reverse sense of NO_STATIC_MODULES -> OPENPAM_STATIC_MODULES.
This avoids leaking NO_STATIC_MODULES into the public header, which
has led to considerable confusion and workarounds in pkgrsc.

PR security/39313
PR security/55216

ok christos
2020-04-29 02:16:56 +00:00
christos 793e7dfe1f Add debugging commented out. 2020-03-03 00:46:06 +00:00
christos a2362fee00 Redo the sshsk_sign() stuff properly, but putting the helper in libssh.so 2020-03-01 20:59:52 +00:00
christos 30dba8ff06 Add the sign client part. 2020-03-01 14:50:43 +00:00
christos 36f537f56c This takes a provider now 2020-02-27 03:25:08 +00:00
christos 53702d90ff one more level down 2020-02-27 02:56:46 +00:00
mrg 046701c57b probably fix previous: it wants mod.mk's PARSEDIR/.., not ../..,
so it picks up the libpam/Makefile.inc.
2020-02-27 00:02:56 +00:00
christos 65b3e3c5b8 Handle pam modules that are not in this subtree. 2020-02-26 19:33:30 +00:00
christos e404e1832c there is no potential overflow anymore (thanks Kamil) 2020-02-07 23:28:59 +00:00
christos 73c6a60ccf stop using sprintf and check for buffer overflow. 2020-02-07 22:13:35 +00:00
reed 030d4fb522 Simply Subsection headers
There was a formatting issue with mandoc showing the
literal "Ss" macros. I reported this bug to mandoc since groff
didn't have same formatting. It was recommended to simplify
the formatting due to the weird feature.
Note because of this for groff I didn't use the Ux macro but spelled
out UNIX literally for these subsection headers
(since the macro reset the subsection formatting which was why
the Ss macro was repeated before to reactivate it).
2019-12-23 17:51:57 +00:00
mrg 69f9039379 use GCC_NO_CAST_FUNCTION_TYPE. 2019-10-13 21:24:37 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
kre 5dc161e026 Only exclude gcc-8 warnings if the gcc we're using is gcc>=8 2019-10-10 02:39:07 +00:00
kre bab7747200 Only exclude gcc-8 warnings when the gcc we're using is gcc>=8 2019-10-10 02:35:45 +00:00
christos b15dac3ccb don't warn for strncpy wtmp fields, they are not NUL terminated. 2019-10-09 22:05:35 +00:00
christos cc33d2efa6 no error for function cast 2019-10-09 22:05:09 +00:00
mlelstv 8137552a24 Fix key loading logic and add log message when rejecting an unencrypted key. 2019-06-01 07:15:39 +00:00
christos 8ea42f66ff adjust to new libssh api. 2018-08-26 08:54:03 +00:00
joerg ed9315c55a Improve type safety by using the correct enum values. 2018-05-16 13:55:39 +00:00
christos 9cbfe7dcb3 fix and use the macro. 2018-04-07 19:28:32 +00:00
christos 04bd018918 function grew an extra argument now. 2018-04-07 13:57:12 +00:00
christos 0c048d5af5 switch everyone to openssl.old 2018-02-04 03:19:51 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
riastradh ef315f7931 Remove MKCRYPTO option.
Originally, MKCRYPTO was introduced because the United States
classified cryptography as a munition and restricted its export.  The
export controls were substantially relaxed fifteen years ago, and are
essentially irrelevant for software with published source code.

In the intervening time, nobody bothered to remove the option after
its motivation -- the US export restriction -- was eliminated.  I'm
not aware of any other operating system that has a similar option; I
expect it is mainly out of apathy for churn that we still have it.
Today, cryptography is an essential part of modern computing -- you
can't use the internet responsibly without cryptography.

The position of the TNF board of directors is that TNF makes no
representation that MKCRYPTO=no satisfies any country's cryptography
regulations.

My personal position is that the availability of cryptography is a
basic human right; that any local laws restricting it to a privileged
few are fundamentally immoral; and that it is wrong for developers to
spend effort crippling cryptography to work around such laws.

As proposed on tech-crypto, tech-security, and tech-userlevel to no
objections:

https://mail-index.netbsd.org/tech-crypto/2017/05/06/msg000719.html
https://mail-index.netbsd.org/tech-security/2017/05/06/msg000928.html
https://mail-index.netbsd.org/tech-userlevel/2017/05/06/msg010547.html

P.S.  Reviewing all the uses of MKCRYPTO in src revealed a lot of
*bad* crypto that was conditional on it, e.g. DES in telnet...  That
should probably be removed too, but on the grounds that it is bad,
not on the grounds that it is (nominally) crypto.
2017-05-21 15:28:36 +00:00
christos 6b9cab4173 Bump version 2017-05-06 19:52:25 +00:00
christos f804baf730 Adapt to the new API. 2015-04-04 02:51:10 +00:00
joerg bc885fd55c When building with clang, make warnings about NULL checks of parameters
with attribute nonnull non-fatal.
2014-10-25 00:57:59 +00:00
christos 71012c8f3e pam library has moved and new files 2014-10-24 18:27:41 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
joerg 0d337fe4e9 Remove tautological check. 2014-02-27 18:09:38 +00:00