1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-06-01 17:21:10 +00:00
Commit Graph

13 Commits

Author SHA1 Message Date
mbays
5783501752 set session id context
This is necessary now client certificates are supported.
Without it, an attempt to resume a session fails with
"ssl_get_prev_session:session id context uninitialized".
2021-08-27 09:48:07 +02:00
Thomas Karpiniec
53e4ce4abd Create certificates which last 68 years (INT32_MAX seconds)
This avoids integer overflow on 32-bit architectures.
2021-05-16 14:10:57 -04:00
bacardi55
8b65e303b0 Fix integer overflow error in tls.c 2021-03-24 08:02:48 -04:00
Drew DeVault
f23ec10a6d Move certificate expiration into the far future 2021-03-04 11:04:46 -05:00
nytpu
ae7ca3db39 Send client certificate hash for CGI scripts.
Set SSL_VERIFY_PEER to request a client certificate from the server,
when available.  Have to shim the certificate verification function or
else it will fail on self-signed client certs.

In serve_cgi retrieve client certificate, create a fingerprint, and set
proper environment variables.  It's pretty barebones, it doesn't parse
the certificate to give any other useful info like the common name, but
it's acceptable IMO.  For most CGI uses the fingerprint is the only
thing that is needed anyways.
2021-02-11 09:19:16 -05:00
Matt Keeter
d1ccb60a52 Use v3 X509 certificate
This fixes an issue where rustls failed to validate the X509v1 certificate.

Tested with Amfora, av-98, and titan (https://github.com/mkeeter/titan)

This requires fresh certificates, which could break clients with strict
trust-on-first-use policies; unfortunately, it doesn't appear to be possible
to migrate v1 certificates to v3.
2021-02-05 10:39:21 -05:00
Mark Dain
cb2c84b0ad Switch to using ECDSA (secp384r1) keys 2020-11-21 09:12:16 -05:00
William Casarin
ea40fb5a53 tls: fix crash when opening priv key for writing
The open syscall will return a negative value if the call fails. Switch
the check to look for this instead of 0.

before:

[gmnisrv] generating certificate for localhost
gmnisrv: src/tls.c:68: tls_host_gencert: Assertion `pf' failed.
abort (core dumped)  ./gmnisrv -C config.ini

after:

[gmnisrv] generating certificate for localhost
[gmnisrv] opening private key for writing failed: No such file or directory
[gmnisrv] TLS initialization failed

Signed-off-by: William Casarin <jb55@jb55.com>
2020-11-08 09:38:04 -05:00
Drew DeVault
1fe107875b Overhaul network I/O to be async for real
Had to totally cut off OpenSSL from the network fd because obviously
OpenSSL is just going to wreck our shit
2020-10-25 14:50:07 -04:00
Drew DeVault
50d21c03f5 Free up resources throughout 2020-09-26 16:10:10 -04:00
Drew DeVault
fa69887e52 Implement TLS exchange with clients
This probably leaves a bit to be desired tbh
2020-09-24 19:58:41 -04:00
Drew DeVault
7af04ea471 tls: move cert/key into host structure
We'll later want to set these on the SSL object (rather than SSL_CTX),
so move these into the host struct for later access.

We'll prefer to set it on the SSL object so that we can automatically
use an up-to-date certificate, per ~sircmpwn/gmni#26.
2020-09-24 17:55:10 -04:00
Drew DeVault
0d1137f987 Implement TLS store
Includes hands-free certificate generation and loading
2020-09-24 17:51:29 -04:00