Commit graph

123 commits

Author SHA1 Message Date
Jinna Kiisuo 3f47d7f008 fix: PAM on Debian, enable use_first_pass by default (#3326)
Since we use Debian's PAM autoconf, pam_unix isn't disabled and remains active.
This means pam_unix triggers first and pam_kanidm should use the password it already tried to match to a local user.

This change also moves the postinst hook for PAM config correctly to the libpam-kanidm package,
since that's the one that delivers the config that needs a reinstall!
2025-02-05 10:43:45 +10:00
Firstyear 4803710026 nss/pam resolver should reauth faster (#3309)
This can have visible impacts on accounts that don't have a pam password
cached yet, but then appear to "stall" for a minute or two until it works
due to the fact that the provider was offline and waiting to reauth.

When we are still connected but our provider auth session has expired
we should reconnect faster. This reduces the timeout for reauthentication
for the provider so that it can return to the online state sooner. We
also loop when we detect the provider session is no longer authenticated
so that we can reauth immediately, rather than causing a noticable
interuption.
2024-12-21 17:22:02 +10:00
Firstyear 6b0c8be718 Ignore system users for UPG synthesiseation (#3297)
Our unix resolver would attempt the right thing to synthesise
user private groups on linux as these are an important security
boundary. However, it turns out that almost every distro has
botched their default system user accounts, and many are
installed with numeric-only UPGs that don't resolve. In the
case that later the user does attempt to fix that, because we
synthesised as UPG for the system account, the user trying to
add the UPG would now fail. In some cases this could cause
system updates to be prevented from installing.

This change limits UPG synth to user accounts only (uid > 1000)
which is the common uid boundary on unix-like platforms.
2024-12-21 17:22:02 +10:00
Firstyear 7c82c951f5 Clear invalid tokens from unix resolver (#3256) 2024-12-03 14:00:23 +10:00
Firstyear 24c95ff5ff Display account_id during success/deny paths in unixd (#3253) 2024-12-03 14:00:23 +10:00
James Hodgkinson c464f0bd9e handle missing map_group setting in config (#3242) 2024-11-29 12:13:06 +10:00
Firstyear e04d0680a4 Warn when v2 options are used in v1 unixd config (#3228)
Options like map_group would fail silently when version=2 wasn't
set in our unix config. this detects that case and warns that it
is occuring.

To prevent this in the future, we deny unknown keys in v2 so that
if (when?) we add v3, new keys will cause an error.
2024-11-22 12:14:06 +10:00
Firstyear 2dd8891d51 Harden transport in pam unixd (#3227)
In some cases if the transport drops out from underneath unixd,
it can be difficult to diagnose and leads to inconsistent errors
and output such as prompting for a password multiple times when
it can't succeed.

This makes it clearer that the transport had an error, and it
denies the inflight authsession to prevent spurious password
prompts.
2024-11-22 12:14:06 +10:00
Firstyear 78ced241eb Resolve pam services not always having a tty (#3176) 2024-11-05 11:06:57 +10:00
Firstyear 770efa80f0 Resolve incorrect handling of rhost in pam (#3171) 2024-11-03 10:13:50 +10:00
George Wu 750932b322 Change to text input and use numeric mode for TOTP prompts. (#3154)
* Change to text input and use inputmode numeric for TOTP prompts.

* Fix some typos.
2024-10-29 09:29:53 +10:00
Firstyear 2e6d940691
Remove WASM (#3148)
liberal party took over, more cuts
2024-10-26 17:19:13 +10:00
Firstyear 4c2eeeb135
Update docs, improve locking (#3141) 2024-10-25 09:42:52 +10:00
Firstyear c9bf304bc0
Improve handling of inaccesible shadow file (#3122) 2024-10-19 07:36:27 +00:00
James Hodgkinson 68119e1067
more errors for the people (#3121) 2024-10-18 23:51:45 +00:00
Firstyear dc5f40d404
20241017 unixd home (#3113) 2024-10-18 05:06:33 +00:00
Firstyear 50e513b30b
Add nss testframework and fallback when daemon offline (#3093) 2024-10-15 04:05:51 +00:00
Jinna Kiisuo 03645c8bf2
Improve deb packaging, add aarch64 (#3083)
* feat: Rebuild the deb packaging flow
fix: Add more sudo, GHA likes sudo
fix: Give build_debs.sh only the triplet argument
fix: Work around more GHA weirdness in apt sources
Drop crossbuild as it was only used by debian packaging
docs: Update book and other docs for packaging flow
feat: package kanidm_tools aka kanidm cli
docs: Update packaging docs for latest process and clarity
fix: use full triple in sdynlib variants
fix: Correct kanidm.pam asset placement
fix: Give pam & nss modules a description so the debs get it
fix: Work around wonky libssl3 naming in Ubuntu 24.04
fix: Place kanidm bin correctly :3
feat: Pin all blame on @yaleman :3
WIP: Swap out the submodule reference. Still not the final one though.
refactor: Switch kanidm-pam & kanidm-nss to mandatory deps
While in theory unixd will start and run without them, it also won't do
anything useful.
fix: explicit depends for nss & pam libs without versions
We build the debs on the ubuntu24.04 GHA runner so automatic pins
versions that are too new for 22.04. Ideally we'd run cargo-deb also on
the target images but that'll have to be a future improvement.
* refactor: Switch nss_kanidm & pam_kanidm package naming closer to debian guidance
* feat: Attempt enabling unixd by default with secure defaults
* fix: Relax config permissions so the kanidm user can read
Also, update postinst config instructions
2024-10-15 02:27:48 +00:00
Firstyear 20b2d40215
Add support for group extension (#3081) 2024-10-03 06:33:56 +00:00
Firstyear 131ff80b32
20240921 ssh keys and unix password in credential update session (#3056) 2024-10-03 05:57:18 +00:00
CEbbinghaus d109622d71
Make good on some TechDebt (#3084)
adds MissingClass & MissingAttribute OperationError kinds to more strongly type our error messages.
2024-10-03 10:48:28 +10:00
Firstyear cf63c6b98b
Complete the implementation of the posix account cache (#3041)
Allow caching and checking of shadow entries (passwords)
    Cache and serve system id's
    improve some security warnings
    prepare for multi-resolver
    Allow the kanidm provider to be not configured
    Allow group extension
2024-10-02 02:12:13 +00:00
Adam C. Stephens 1161da69ef
generate completions for elvish and fish (#3015) 2024-09-03 23:50:59 +00:00
James Hodgkinson 3eae7be0bb
OAuth2 Token Type (#3008)
* fix(OAuth2): Invalid `token_type` for token introspection
Fixes #3005

* fix(aut): `assert_eq` instead of `assert ==`

* fix(OAuth2): IANA registry access token types

* fix(OAuth2): deserialize case insensitively
2024-08-25 23:30:20 +00:00
James Hodgkinson 7c3deab2c4
enforcen den clippen (#2990)
* enforcen den clippen
* updating outdated oauth2-related docs
* sorry clippy, we tried
2024-08-21 00:32:56 +00:00
Firstyear b1099dfa3b
Foundations of pam/nss multi resolver
This starts the support for multi-resolver operation as well as a system level nss resolver.

In future we'll add the remaining support to auth system users with pam too.
2024-08-15 23:54:35 +00:00
Firstyear d19bd99c0d
Prevent bug in pam (#2960)
* Prevent bug in pam
* Pointer tidy
2024-08-09 20:12:34 +10:00
James Hodgkinson 2a7a009482
clippying all the things (#2931)
* clippying all the things
2024-07-26 07:02:37 +00:00
Firstyear 7bbb193cdf
20240725 allow connection to older servers (#2930)
Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-07-25 16:11:14 +10:00
Firstyear 0836118443
20240716 check mkdir (#2906) 2024-07-17 01:11:11 +00:00
Firstyear faef3d0a4b
Fix issues with suspend reported by himmelblau (#2911) 2024-07-17 10:33:04 +10:00
Anton Loukianov 028e7c1694
Implement home_mount_path logic (#2894) 2024-07-16 00:34:11 +00:00
James Hodgkinson eddec88429
making the internals of kanidmclientconfig public for other users (#2895)
* making the internals of kanidmclientconfig public for other users
* clippyisms
2024-07-15 10:28:23 +00:00
Firstyear 0ce333ff5a
Allow providers to be box dyn (#2794)
* Allow providers to be box dyn in kanidm_unixd
* Massive refactor
2024-06-16 22:21:25 +00:00
Joshua M. Clulow e591b5f2cc
illumos support (#2838)
* disable mimalloc on illumos, in part because it immediately segfaults,
  but also because we prefer libumem and link it into all Rust binaries

* switch from fs2 (unmaintained crate) to fs4 which provides the same
  interface and has wider platform support
2024-06-15 05:20:11 +00:00
Firstyear 9c4e8bb90a
20240611 performance (#2836)
While basking under the shade of the coolabah tree, I was overcome by an intense desire to improve the performance and memory usage of Kanidm.

This pr reduces a major source of repeated small clones, lowers default log level in testing, removes some trace fields that are both large and probably shouldn't be traced, and also changes some lto settings for release builds.
2024-06-12 16:48:49 -07:00
dependabot[bot] a3f66225de
Bump the all group with 7 updates (#2811)
* Bump the all group with 7 updates

Bumps the all group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [kanidm-hsm-crypto](https://github.com/kanidm/hsm-crypto) | `0.1.6` | `0.2.0` |
| [base64](https://github.com/marshallpierce/rust-base64) | `0.21.7` | `0.22.1` |
| [lru](https://github.com/jeromefroe/lru-rs) | `0.8.1` | `0.12.3` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.84` | `1.0.85` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.37.0` | `1.38.0` |
| [axum-auth](https://github.com/owez/axum-auth) | `0.4.1` | `0.7.0` |
| [jsonschema](https://github.com/Stranger6667/jsonschema-rs) | `0.17.1` | `0.18.0` |


Updates `kanidm-hsm-crypto` from 0.1.6 to 0.2.0
- [Commits](https://github.com/kanidm/hsm-crypto/commits)

Updates `base64` from 0.21.7 to 0.22.1
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.21.7...v0.22.1)

Updates `lru` from 0.8.1 to 0.12.3
- [Changelog](https://github.com/jeromefroe/lru-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jeromefroe/lru-rs/compare/0.8.1...0.12.3)

Updates `proc-macro2` from 1.0.84 to 1.0.85
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.84...1.0.85)

Updates `tokio` from 1.37.0 to 1.38.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.37.0...tokio-1.38.0)

Updates `axum-auth` from 0.4.1 to 0.7.0
- [Commits](https://github.com/owez/axum-auth/commits)

Updates `jsonschema` from 0.17.1 to 0.18.0
- [Release notes](https://github.com/Stranger6667/jsonschema-rs/releases)
- [Changelog](https://github.com/Stranger6667/jsonschema-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stranger6667/jsonschema-rs/compare/rust-v0.17.1...rust-v0.18.0)

---
updated-dependencies:
- dependency-name: kanidm-hsm-crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: base64
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: lru
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: axum-auth
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: jsonschema
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>

* updating for kanidm-hsm change

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-06-08 11:25:09 +00:00
James Hodgkinson 1d0a606e69
WIP: serialization and domain info setting wonkiness (#2791) 2024-05-28 11:49:30 +10:00
Firstyear 1e4f6e85ca
Revive Cookies. (#2788)
* Revive Cookies.
* change from tikv-jemalloc to mimalloc.
2024-05-23 00:45:42 +00:00
David Mulder ac9a90abf3
Fix PIN and MFA Code pam prompts (#2759)
These are currently awkward on the command line
because the ': ' is missing.

Signed-off-by: David Mulder <dmulder@samba.org>
2024-05-15 16:21:38 +00:00
James Hodgkinson 7964f55d59
strip out some debug messages unless *really* debugging. (#2767)
* kanidm cli logs on debug level - Fixes #2745
* such clippy like wow
* It's important for a wordsmith to know when to get its fixes in.
* updootin' wasms
2024-05-14 14:56:55 +10:00
James Hodgkinson f86c2c4f8c
updating text to fix typo, add more info (#2761) 2024-05-14 01:49:54 +00:00
David Mulder bec8c9058c
Windows Hello Authentication requirements (#2688)
* Add keystore to unix_user_online_auth_init

Himmelblau needs this to check whether the device
is enrolled in the domain (via the presence of
TPM keys), to know whether to attempt Windows
Hello PIN auth, or to enroll first in the domain.

Signed-off-by: David Mulder <dmulder@samba.org>

* Implement PIN setup

After enrolling in a domain, Himmelblau will
prompt the user to choose a pin, which will be
the auth value for an associated Windows Hello
TPM key. We loop here until the values match.
Otherwise no validation is performed. Validation
can be done by the id provider, and can send an
additional request to PAM if the PIN is invalid.

Signed-off-by: David Mulder <dmulder@samba.org>

* Add Pin authentication

After setting up a Windows Hello pin, users can
authentication using this pin.

Signed-off-by: David Mulder <dmulder@samba.org>
2024-04-05 08:50:37 +10:00
Firstyear c09daa4643
kanidm unixd mfa capabilities (#2672)
Improve the support for the resolver to support MFA options with pam. This enables async task spawning and cancelation via the resolver backend as well. 

Co-authored-by: David Mulder <dmulder@samba.org>
2024-03-28 01:17:21 +00:00
Firstyear fbc021f487
20240221 2489 cleanup api v1 (#2573) 2024-02-27 09:25:02 +00:00
James Hodgkinson 4efdb7208f
of course I started looking at clippy things and now I can't stop (#2560) 2024-02-21 00:52:10 +00:00
James Hodgkinson 097db70c3d
prctl compile-time fixes, also chasing lints (#2558)
* fixing up error handling for prctl calls
* minor clippy lintypoos
* making clippy happier
* clippizing a test
* more clippy-calming
* adding tpm-udev to ubuntu flows for testing
* rebuilt wasm
* moving from rg to grep because someone doesn't like nice things
* such clippy like wow
* clippy config to the rescue
2024-02-20 18:21:33 +10:00
James Hodgkinson 84b2c4956d
Removing unused constant and updating docstring for LDAP bind address (#2556) 2024-02-20 11:10:02 +10:00
Firstyear cc28fb2c4b
Re-enable HW tpm support (#2531) 2024-02-17 01:30:08 +00:00
Firstyear 62dff7565e
Add further hardening for system services (#2542) 2024-02-17 00:11:32 +00:00