Page MenuHomeFreeBSD

libtacplus: Allow additional AV pairs to be configured.
ClosedPublic

Authored by des on May 26 2023, 4:39 PM.
Tags
None
Referenced Files
F106180193: D40285.diff
Thu, Dec 26, 5:24 PM
Unknown Object (File)
Nov 22 2024, 5:16 AM
Unknown Object (File)
Nov 21 2024, 6:05 AM
Unknown Object (File)
Nov 20 2024, 7:27 AM
Unknown Object (File)
Nov 7 2024, 12:34 PM
Unknown Object (File)
Nov 7 2024, 12:33 PM
Unknown Object (File)
Nov 4 2024, 10:40 AM
Unknown Object (File)
Nov 4 2024, 10:36 AM

Details

Summary
  • Replace hand-rolled input tokenizer with openpam_readlinev() which supports line continuations and has better quoting and escaping.
  • Simplify string handling by merging struct clnt_str and struct srvr_str into just struct tac_str.
  • Each server entry in the configuration file can now have up to 255 AV pairs which will be appended to the ones returned by the server in response to a successful authorization request.

This allows nss_tacplus(8) to be used with servers which do not provide identity information beyond confirming the existence of the user.

This adds a dependency on libpam, however libtacplus is currently only used by pam_tacplus(8) (which is already always used with libpam) and the very recently added nss_tacplus(8) (which is extremely niche). In the longer term it might be a good idea to split this out into a separate library.

MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51713
Build 48604: arc lint + arc unit

Event Timeline

des requested review of this revision.May 26 2023, 4:39 PM

Fix brain glitch in man page.

pauamma_gundo.com added inline comments.
lib/libtacplus/tacplus.conf.5
57–59

This is saying that "#foobar" is a valid field but "foo#bar" isn't. Is that still true with the new tokenizer? openpam_readlinev(3) leads me to openpam_readword(3), which states

If a hash character occurs within a word, however, it is preserved as-is.

which I interpret as permitting "foo#bar".

lib/libtacplus/tacplus.conf.5
57–59

Thanks for catching that, I'll check.

des marked an inline comment as done.May 29 2023, 3:03 PM
des added inline comments.
lib/libtacplus/tacplus.conf.5
57–59

OK so I think you misunderstood, it's not talking about the legality of a # character but about whether it will be seen as the start of a comment or as a regular character within a field. In both cases # starts a comment only if it is the first character on the line or is preceded by unescaped whitespace. In all other cases it is a regular character. This is unchanged. What has changed is mainly support for line continuations and improved quoting.

Shorten man page, add UPDATING entry.

This revision is now accepted and ready to land.May 29 2023, 3:39 PM
markj added inline comments.
lib/libtacplus/taclib.c
413

Presumably this should be explicit_bzero() or memset_s()?

733

Can't you write len += strlen(p); instead of having this loop?

736

Is len supposed to include the =? It looks like it does not.

737

Is srvp->navs guaranteed to be initialized? It might be nice to reset it at the beginning of the loop regardless.

853

Suppose strlen(fields[2]) == 0, i.e., the timeout was specified as "" in the config. Then we don't increment i, so below we'll compare "" with "single-connection", which doesn't seem to be the desired behaviour. In that case, I'd expect the timeout to be the default, and that we continue processing the next field.

873

Indentation here is wrong.

lib/libtacplus/taclib.c
734

xstrdup() does not fail.

des marked 7 inline comments as done.Jun 5 2023, 3:20 PM
des added inline comments.
lib/libtacplus/taclib.c
733

That's a matter of taste.

734

Yes it does.

736

It is and it does.

853

That is exactly the desired behavior. If you want the default timeout value, don't specify a timeout.

des marked 4 inline comments as done.Jun 5 2023, 3:20 PM

Incorporate review feedback.

This revision now requires review to proceed.Jun 5 2023, 3:22 PM
markj added inline comments.
UPDATING
35 ↗(On Diff #122848)

RELNOTES is a more appropriate place to document this, since the change will affect anyone upgrading to 14.0, not just users tracking main. Or, add a "Relnotes: yes" tag to the commit log message.

This revision is now accepted and ready to land.Jun 7 2023, 3:49 PM