Commit Graph

34 Commits

Author SHA1 Message Date
Nicolas Williams
5dcad4635b bx509d: Fix warnings 2022-01-14 17:59:49 -06:00
Nicolas Williams
aa8eb19b8e bx509d: Build with older libmicrohttpd (fix GH CI) 2022-01-13 15:33:04 -06:00
Luke Howard
a8ff420b16 kdc: add attribute dictionary to kdc_request_t
Add a heim_dict_t to the KDC request structure for use by pre-authentication
mechanisms and plugins.
2022-01-04 12:27:43 +11:00
Luke Howard
b27026996a base: s/addkv_{bool,number,object}/setkv
Now heim_audit_addkv() correctly supports multiple values, the other functions
that (by design) replace existing values with a single value should use the
heim_audit_setkv prefix.

A subsequent commit could add variants that support multiple values for
non-string types.
2022-01-04 09:07:10 +11:00
Nicolas Williams
e328c0e496 bx509d: Use enum MHD_Result return type 2022-01-02 21:11:40 -06:00
Nicolas Williams
53e63d9ec9 kdc: Fix bx509d/httpkadmind (b1dcc1a47) 2022-01-02 21:11:07 -06:00
Luke Howard
a9c6bc2bf2 kdc: audit "yes" boolean values as booleans
Audit boolean values that were logged as "yes" as boolean values; this will
change audit log values to "true" instead, so this patch may be omitted.
2022-01-02 15:25:52 +11:00
Luke Howard
cc0874d410 kdc: preserve value types in auditing
Preserve integer/boolean audit values as their native types; convert to strings
when logging only. This commit goes some way towards unifying the two auditing
APIs.
2022-01-02 15:25:52 +11:00
Luke Howard
d165e73fff bx509d: don't audit NULL message string
formatted can be NULL, it appeares the intention was to log msg instead
2022-01-02 15:25:52 +11:00
Nicolas Williams
fb3ea5b943 kdc: Add ret to common svc req elements
We're logging SUCCESS even when the KDC sends error replies.  That's
because we're returning success to process_request() even when we send
errors to clients.  The error we want to send to the client, and that we
succeed or fail to send it, are different statuses.

Also, further move things into `r` and out of function arguments.
2021-12-27 10:16:58 +11:00
Nicolas Williams
5f63215d0d Always perform == or != operation on cmp function result
Although not required to address bad code generation in
some versions of gcc 9 and 10, a coding style that requires
explicit comparison of the result to zero before use is
both clearer and would have avoided the generation of bad
code.

This change converts all use of cmp function usage from

```
    if (strcmp(a, b) || !strcmp(c, d)) ...
```

to

```
    if (strcmp(a, b) != 0 || strcmp(c, d)) == 0
```

for all C library cmp functions and related:

 - strcmp(), strncmp()
 - strcasecmp(), strncasecmp()
 - stricmp(), strnicmp()
 - memcmp()

Change-Id: Ic60c15e1e3a07e4faaf10648eefe3adae2543188
2021-11-24 22:30:44 -05:00
Nicolas Williams
8807a0aad9 bx509d: Use /get-tgt lifetime q-param 2021-05-06 23:13:31 -05:00
Nicolas Williams
e609e61f21 bx509d: Set Content-Type and Cache-Control 2021-04-30 16:02:18 -05:00
Nicolas Williams
a4adb8354f bx509: Complete /get-tgt?cname= support 2021-04-22 17:02:18 -05:00
Nicolas Williams
76d6ee4abc bx509: Don't clobber error in get_tgt() 2021-04-22 17:02:16 -05:00
Nicolas Williams
f60300984e bx509d: /get-tgt add EKU to authorization check 2021-04-16 14:13:05 -05:00
Nicolas Williams
6ff3dbf297 bx509: Add addresses q-param for /get-tgt 2021-04-14 19:28:08 -05:00
Nicolas Williams
6633f6e525 bx509d: Implement /get-tgt end-point 2021-04-06 17:19:48 -05:00
Nicolas Williams
d72c4af635 bx509: Rename end-points; doc Negotiate more
Leaving old end-point names around.
2021-04-06 17:19:48 -05:00
Nicolas Williams
fbb1a4e3ec bx509d: Allow requesting longer cert lifetimes
Add a `lifetime=NUMunit` query parameter.

Also add a krb5.conf parameter to indicate whether this is allowed.
We already have a max lifetime configuration parameter.
2021-03-07 22:20:06 -06:00
Nicolas Williams
cb6c57dc36 bx509: Let simple authorizer use the app name 2020-09-08 00:25:24 -05:00
Nicolas Williams
4f0249cd94 hx509/kdc: Move KDC CA utility function into hx509
This is part of the program to move REST services like bx509d out of
kdc/.
2020-09-08 00:25:24 -05:00
Nicolas Williams
e311d05fee bx509d: Further disentanglement from kdc 2020-09-08 00:25:24 -05:00
Nicolas Williams
73c424ea66 bx509d: Get KDC config out of bx509d 2020-09-08 00:25:24 -05:00
Nicolas Williams
01509f553d Move KDC audit functionality to lib/base/ 2020-04-24 16:02:35 -05:00
Nicolas Williams
1cbbca8dcf bx509: Add /, /health for load balancer checking
A HEAD or GET of / or /health will now produce a 200 instead of a 404.

Ideally we should add configuration arguments that would allow /health
to get a token, make a CSR, and test the /bx509 (and/or /bnegotiate)
functionality, that way we'd have a real health check.  For now we defer
that work, as external health monitoring can be done using a simple
script anyways.
2020-01-10 11:43:00 -06:00
Nicolas Williams
e7ad9da3cc bx509: Do not clobber library error info 2020-01-10 11:34:33 -06:00
Nicolas Williams
ee0a288f92 bx509: Work around microhttpd bug 2019-12-20 15:54:27 -06:00
Nicolas Williams
608c2876d4 kdc: Fix audit_addkv() typos and reason handling
Now we'll put the "reason=..." last in the log lines and we won't escape
spaces -- just newlines and other control characters.  This makes
reading log lines much easier without complicating parsing of log lines
because interior key=value pairs do get whitespace escaped or removed.
2019-12-10 22:14:38 -06:00
Nicolas Williams
18df68d6e9 bx509: Add proper logging 2019-12-10 21:26:47 -06:00
Nicolas Williams
733140553a kdc: Fix leaks 2019-12-09 21:39:30 -06:00
Nicolas Williams
d1a2652090 bx509: CSRF protection for /bnegotiate 2019-12-09 20:13:33 -06:00
Nicolas Williams
0a0a27ccec kdc: bx509: Do not vend issuer private keys 2019-12-09 18:10:10 -06:00
Nicolas Williams
575c67806b Add bx509d 2019-12-04 21:34:44 -06:00