Commit graph

149 commits

Author SHA1 Message Date
Jacob Moody c12022fd8c skel(3) → skelfs(4)
The original intention was to put devskel in to the
kernel to detach what it provides from devsrv.
That is not a good reason, just move it to userspace.

auth/box has been changed to exec skelfs instead
of relying on '#z'.
2022-06-15 06:42:05 +00:00
Jacob Moody 13065e16b3 auth/box: don't bother switching to none
Changing the user to none doesn't do much for us
here. For kernel drivers that check the user of the
current proc we'll be none, but anything from devmnt
will still be accessed using creds from the original
attachment. Instead, running with none can be done
by chaining with auth/none:

auth/none auth/box ...
2022-06-10 04:10:54 +00:00
Jacob Moody 1b5ea51ee1 auth/box: bind in the binary by default
This prevents stuttering on the command line by
not having to give a -r flag for the binary itself.
2022-06-08 02:44:35 +00:00
Jacob Moody 056ad652a4 auth/box: build restricted namespaces using components from the parent. 2022-06-07 05:38:08 +00:00
cinap_lenrek 55a0abdd43 auth/as: fix wrong filesystem permissions due to wrong factotum being attached
to change user, have to (re-)mount factotum under the new user,
so it can authenticate us under the correct user for the filesystems.
2022-04-04 22:25:08 +00:00
Sigrid Solveig Haflínudóttir add3a0a4da aescbc: flush before exit and report an error (if any) 2021-11-25 21:42:12 +00:00
cinap_lenrek aebf92224f acmed: pass original utf8 subject domain to challengefn, simplify
try to keep everything in utf8 format.
2021-10-31 02:16:17 +00:00
cinap_lenrek a9e533ad1e acmed: handle international domain names 2021-10-31 00:12:36 +00:00
Ori Bernstein c5a0909b67 acmed: remove unused define
we don't use or care about the user agent.
2021-10-27 19:34:29 +00:00
Ori Bernstein d8a1437cf4 acmed: move from ip/ to auth/
Getting certs is more tied to authentication than it
is to ip.
2021-10-27 19:33:22 +00:00
Ori Bernstein 07c32fb3da auth/rsa2jwk: add code to produce jwk rsa keys
This is useful for acmed, and possibly other web
technologies.
2021-07-18 15:30:35 +00:00
cinap_lenrek 78cf847bfb rsa(8): document auth/x5092pub, fix usage lines 2021-07-04 22:38:22 +00:00
cinap_lenrek 88060e7501 libsec: add X509reqtoRSApub() function and return subject alt names in X509to*pub() name buffer
We need a way to parse a rsa certificate request and return the public
key and subject names. The new function X509reqtoRSApub() works the
same way as X509toRSApub() but on a certificate request.

We also need to support certificates that are valid for multiple domain
names (as tlshand does not support certificate selection). For this
reason, a comma separated list is returned as the certificate subject,
making it symmetric to X509rsareq() handling.

A little helper is provided with this change (auth/x5092pub) that takes
a certificate (or a certificate request when -r flag is provided) and
outputs the RSA public key in plan 9 format appended with the subject
attribute.
2021-07-04 22:00:24 +00:00
Ori Bernstein 8c9cbbb142 passwd: make legacy mode explicit
Passwd used to produce a very confusing error
about DES not being enabled whenever the password
was mistyped. This happened because we attempted
to guess what authentication method to use, and
preseneted the error from the wrong one on failure.

This puts the legacy mode behind a flag, so that
we don't even try the old method unless it's
explicitly requested.
2021-01-17 18:01:53 -08:00
cinap_lenrek eb1dfed9ab libauth: change programs to use the new procsetuser() function 2020-12-19 18:02:37 +01:00
kvik e5894dccea pre-lib9p servers: fix incorrect Tversion handling
version(5) says:

	If the server does not understand the client's version
	string, it should respond with an Rversion message (not
	Rerror) with the version string the 7 characters
	``unknown''.

Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.

lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping.  It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.

This patch brings pre-lib9p servers in accordance with the spec.
2020-08-01 15:27:28 +02:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
Ori Bernstein 5bc9b0c3ca improve usage messages (thanks henesy)
Fix inconsistencies between programs and their usage
messages,  correct instances where information seems
to be missing or lost. This  includes missing arguments,
making usage consistent with manuals, and so on.
2020-03-10 10:09:34 -07:00
Ori Bernstein 50791b8755 add usage messages to auth/(enable disable status).
print useful message when user invokes these commands incorrectly
(thanks henesy)
2020-03-08 16:31:30 -07:00
cinap_lenrek 85216d3d95 auth/rsa2asn1: implement private key export with -a flag (thanks kvik)
kvik writes:

I needed to convert the RSA private key that was laying around in
secstore into a format understood by UNIX® tools like SSH.

With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not
back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in
rsa2asn1(8) by adding the -a flag which causes the full private key to be
encoded and output.
2019-08-30 07:34:35 +02:00
cinap_lenrek 79bfff6437 factotum: rsa: use mptober() to get right adjusted result instead of mptobe() and memset() 2018-12-04 19:34:36 +01:00
aiju 911df94e5d asaudit: make error more explicit 2018-07-11 12:23:48 +01:00
cinap_lenrek 83de8c0f5f authsrv: log message when no AES key is found for pak 2018-07-11 10:17:04 +02:00
cinap_lenrek e69cde3120 authsrv: implement AuthNTLM 2018-05-20 22:59:24 +02:00
cinap_lenrek 6e19d19285 separate MSCHAP(v2) and NTLM(v2) authentication
due to linux omiting the final Z(4) in the NTLMv2 reply, and
the need for the windom for LMv2 authentication, here is a new
AuthNTLM ticket request now with length and dom fields.
2018-05-20 22:49:24 +02:00
cinap_lenrek e684b2a3fb authsrv: work arround linux omiting final Z(4) after the AvrPairs 2018-05-20 01:37:38 +02:00
cinap_lenrek 58aba2a67f cifsd: fix ntlmv2 authentication
in ntlmv2, the client will retry the challenge response trying a bunch
of different domain names assuming the same server challenge. so we have
to make retries work with factotum and the auth server.

also, windows 7 with compatlevel=4 sends all zeros LM response.
2018-05-19 16:40:01 +02:00
cinap_lenrek d06196ab87 auth/asn12rsa: also convert ASN.1 encoded public key to plan9 format 2018-02-05 03:21:51 +01:00
cinap_lenrek a7974d96b7 factotum: implement mschapv2 role=server authentication (for ppp)
this implements the server part of mschapv2 with the new
authserver changes.

we also provide AuthInfo for the client now with the
MPPE secret and the authenticator.
2018-01-21 22:35:01 +01:00
cinap_lenrek fd1e50d653 authsrv: implement mschapv2 authentication, include MPPE secret in the ticket
this adds new rpc for mschapv2 authentication (21)

deliver the MPPE secret not after the ticket/authenticator
response as cheartext, but include it in the first 128 bit
of the ticket key. and the authenticator in the first 160 bit
of the authenticator random field.
2018-01-21 22:32:34 +01:00
cinap_lenrek 2bd59d9cb3 authsrv: fix chap
use OCHAPREPLYLEN instead of sizeof(reply) (no padding).

exit after sending ticket response to force eof as factotum
unconditionally reads tailing secret hash (as of mschap).
2018-01-15 01:31:27 +01:00
cinap_lenrek 069230cd62 forgot to commit asn1dump.c... 2018-01-07 05:17:34 +01:00
cinap_lenrek 1c3377a67f factotum: remove unused sshrsa.c 2018-01-06 08:37:32 +01:00
cinap_lenrek a200ecd3a6 remove asn12dsa, dsa2pub, dsa2ssh and dsagen
was mostly usefull for old ssh.
2018-01-06 08:32:51 +01:00
cinap_lenrek 91a701747c auth/asn1dump: include in mkfile 2018-01-06 07:44:12 +01:00
cinap_lenrek 1d7bb80793 factotum: remove legacy wep protocol 2018-01-02 04:27:23 +01:00
cinap_lenrek f7b0cc7a64 factotum: replace custom hex parsing code with dec16() avoding timing side channels 2018-01-01 21:14:39 +01:00
cinap_lenrek 3ef51c16d4 auth/factotum: add role=login protocol variant to dp9ik/p9sk1
the role=login protocol is ment to replace proto=p9cr in
auth_userpasswd() from libauth to authenticate a user
given a username and a password. in contrast to p9cr, it
does not require an authentication server when user is the
hostowner and its key is present in factotum.
2017-12-03 05:10:04 +01:00
cinap_lenrek e614cdf02f auth/login: add missing quotefmtinstall(), quote dom attribute 2017-12-03 04:54:34 +01:00
cinap_lenrek 0a3695ba84 rsa: add auth/rsa2asn1, check write error in auth/rsa2x509 and auth/rsa2pub, document in rsa(8) 2017-10-06 20:55:57 +02:00
cinap_lenrek 3fc29c6984 auth/factotum: complete p9any v.2 server protocol, but don't enable it. 2017-06-18 21:59:16 +02:00
cinap_lenrek 128783a700 factotum: append public rsa encyption exponent after the modulus
this makes implementing ssh-rsa authentication easier, as we
then can convert the public key directly to ssh format and check
if the server will accept that public key.

tlshand just needs the modulus to see if the public key matches
the one it has from the certificate.
2017-04-17 05:18:24 +02:00
cinap_lenrek 242274f733 rsa2ssh: drop support for version 1 key format 2017-04-17 05:13:46 +02:00
cinap_lenrek 394af5a216 authsrv: handle short reads in initkeyseed() 2017-02-26 23:10:17 +01:00
cinap_lenrek 6de804b578 authsrv: don't hash in hostowner key for keyseed
aiju → i don't like it, it's more bullshit ways to expose the key :)
aiju → if someone can grab /adm/keyseed, they can also grab /adm/users and /adm/keys
2017-02-26 22:44:47 +01:00
cinap_lenrek 009bec0752 authsrv: salt the keyseed from /adm/keyseed file
change the keyseed key derivation to hkdf sha256
using the hostowners des key plus 256 bit random
salt from /adm/keyseed.
2017-02-26 03:47:46 +01:00
cinap_lenrek 27498dd63a authsrv: fix mkkey() dummy key generation (thanks aiju) 2017-02-26 02:21:49 +01:00
cinap_lenrek 27485e62d1 authsrv: get rid of needreply parameter by changing vnc protocol handler 2017-02-26 01:34:42 +01:00
aiju 6651be7516 authsrv: more useful error reporting 2017-02-26 01:11:37 +01:00
cinap_lenrek 28491941b0 auth/asaudit: quote user and dom attributes in factotum key 2017-02-25 17:47:36 +01:00