summaryrefslogtreecommitdiff
path: root/usr.sbin/acme-client
AgeCommit message (Collapse)Author
2022-12-28spelling fixes; from paul tagliamonteJason McIntyre
any parts of his diff not taken are noted on tech
2022-12-19acme-client: fix copy-paste error in error messageTheo Buehler
2022-12-18acme-client: rename cc to sign_len in op_sign()Theo Buehler
requested by jsing
2022-12-18acme-client: fix openssl includes in acctproc.cTheo Buehler
We don't do PEM or random in here, but we use BN, EC, ECDSA, so include the relevant headers. errno.h was also missing.
2022-12-18acme-client: check EC signature lengthTheo Buehler
Make sure the size_t containing EC signature length is not truncated when passing it to d2i_ECDSA_SIG() as a long. This won't happen, but documents API quirks... requested by jsing
2022-12-18acme-client: simplify elliptic curve signaturesTheo Buehler
We can get the correct size of the signature using EVP_PKEY_bits() which uses the order instead of the (strictly speaking incorrect) degree. Grab the (r, s) out of the ECDSA signature with ECDSA_SIG_get0_{r,s}(), which is a saner interface than EVP_SIG_get0(). Finally, do the zero padding using BN_bn2binpad() which is simpler than the currently rather fiddly solution. ok jsing
2022-12-18acme-client: switch op_sign() to EVP_DigestSign()Theo Buehler
EVP_DigestSign() is a bit more ergonomic than the old EVP_Sign* family, it takes size_t instead of int and and it also allows allocating the memory needed instead of relying on some weird estimate. This again gets rid of a few stupid else if. ok jsing
2022-12-18acme-client: simplify op_thumbprint()Theo Buehler
We can EVP_Digest() into an array on the stack rather than doing a long dance and song with lots of ugly else if. ok jsing
2022-12-18acme-client: inline a confusing and useless defineTheo Buehler
2022-12-18acme-client: encode unexpected SANs before printingTheo Buehler
If a SAN isn't configured, it could be anything, so make printing it safe using strvisx(). If it is configured but duplicate, printing it should be fine, so don't bother. This removes two XXX added in the previous commit. ok florian
2022-12-17acme-client: fix SAN-handling insanityTheo Buehler
The revoke process, which does a lot more than revoking a cert, wants to know the SANs in the cert to be revoked or renewed and check them against the ones configured in the config file. To find out which ones are, it prints the SAN extension to a BIO using X509V3_EXT_print(), slurps that into a buffer, tokenizes the undocumented output string and plucks out the "DNS:" names. This is reminiscent of node's hilarious CVE-2021-44532 and on about the same level of crazy, but fortunately not security relevant. Get the SAN extension as a GENERAL_NAMES from libcrypto, then we have an actual data structure to work with, which allows us to access the DNS names without problems. This simplifies things quite a bit, but the actual logic in this file remains unmodified. Be careful about ASN1_IA5STRINGs and do not assume they are C strings. Tested by florian, millert, Renaud Allard, thanks! ok florian jsing
2022-12-15acme-client: use timegm() instead of mktime()Theo Buehler
Times in certificates are all expressed in Zulu time, so calling the time zone dependent mktime() on such a time and comparing it to time(NULL) is wrong. This means that the check of at least 30 days validity and deciding on whether to renew or not might have been off by by half a day depending on where you are. That should not matter since you (or cron) are supposed to run acme-client way more often than once a month. ok claudio millert
2022-12-15acme-client: use ASN1_TIME_to_tm()Theo Buehler
There is a hand-rolled, only minimally checked implementation converting an ASN1_TIME into a struc tm. beck has invested a lot of time improving the time parsing inside libcrypto, so make use of that. That code is safer, better vetted and more correct. ok florian
2022-12-15The argument to ctype functions must be EOF or representable as anFlorian Obser
unsigned char. Casting to int is particularly useless because that's what the compiler already does. We need to prevent sign extension, not write down that we want sign extension. OK deraadt, kn, miod
2022-12-14The argument to ctype functions must be EOF or representable as anFlorian Obser
unsigned char. Casting to int is particularly useless because that's what the compiler already does. We need to prevent sign extension, not write down that we want sign extension. OK deraadt, millert, kn
2022-12-14Continue loop if no match found; avoids an OOB write. ok florian@ tb@Otto Moerbeek
2022-12-14Plug leak of ECDSA_SIGTheo Buehler
ok sthen
2022-11-09nreq could leak a http get request in case a redirect withoutMoritz Buhl
location header was received. OK deraadt
2022-10-09allow newlines inside the `alternative names' block in acme-client.confOmar Polo
ok florian
2022-08-28Make a few error messages match the actually failing function.Theo Buehler
2022-08-28Set the X.509 request version number.Joel Sing
Rather than assuming the default value from X509_REQ_new(), explicitly set the X.509 request version number to zero. ok tb@
2022-05-05Check that the challenge token which is turned into a filename isFlorian Obser
base64url encoded. We have only the challenge directory unveil(2)'ed so funny business like ../ will not work, but we shouldn't generate garbage filenames that someone else might trip over either. Pointed out and diff by Ali Farzanrad (ali_farzanrad AT riseup.net) OK beck
2022-02-22Plug leak in ec_key_create()Theo Buehler
EVP_PKEY_set1_EC_KEY() bumps the refcount of eckey, so eckey won't be freed at the end of keyproc() or acctproc(), which means that secrets aren't wiped. Move EC_KEY_free() to the out label, so that the refcount is decremented or the key freed, as appropriate. tested/ok claudio
2022-02-22whitespace/KNFTheo Buehler
2022-02-22acme-client: only warn on PEM_write_ECPrivateKey() failure insteadTheo Buehler
of everytime ec_create_key() is called. From wolf at wolfsden dot cz ok florian
2022-01-21the wrapped cron line is going to lose peopleTheo de Raadt
2022-01-14Fix acme-client build with opaque RSATheo Buehler
2021-12-13Let dnsproc pass multiple addresses to netprocJeremie Courreges-Anglas
The loop was exited prematurely because of a stray break statement. In case of a failure to connect to the first address returned by getaddrinfo(3), acme-client can now try to connect using another address or address family if available. ok florian@
2021-11-22acme-client: use BIO_number_written(bio) instead of bio->num_write.Theo Buehler
Avoid awkward line wrapping by removing awkward else if chaining. ok claudio florian
2021-11-18acme-client: use EVP_PKEY_base_id()Theo Buehler
In an upcoming libcrypto bump, EVP_PKEY will become opaque. In order to stop reaching inside EVP_PKEY, we must replace EVP_PKEY_type(pkey->type) with the equivalent EVP_PKEY_base_Id(pkey) in various places. ok florian
2021-10-15Don't declare variables as "unsigned char *" that are passed toChristian Weisgerber
functions that take "char *" arguments. Where such chars are assigned to int or passed to ctype functions, explicitly cast them to unsigned char. For OpenBSD's clang, -Wpointer-sign has been disabled by default, but when the parse.y code was built elsewhere, the compiler would complain. With help from millert@ ok benno@ deraadt@
2021-10-13acme-client: stop reaching into X509Theo Buehler
Prepare for an upcoming change in libcrypto and retrieve the stack of extensions via X509_get0_extensions(). Simplify the for loop by relying on the fact that empty or NULL stacks have an sk_num() of 0 and -1, respectively, so the loop won't be entered and the extsz dance is unnecessary. ok florian
2021-09-17Fix subjectAlternativeName (SAN) generation for CSRs. CA/B Forum baselineStuart Henderson
requirements require that it's used in certificates so it makes sense to generate a CSR compliant with this, additionally it replaces rather than adds to the name in the certificate's subject which we weren't handling correctly. Diff from wolf at wolfsden/cz, ok florian@
2021-09-14Add missing void to definition of http_init().Theo Buehler
ok deraadt florian
2021-08-24fix outdated comments, from Emil Engler, thanks.Sebastian Benoit
2021-07-14Remove unneeded calls to tls_init(3)kn
As per the manual and lib/libtls/tls.c revision 1.79 from 2018 "Automatically handle library initialisation for libtls." initialisation is handled automatically by other tls_*(3) functions. Remove explicit tls_init() calls from base to not give the impression of it being needed. Feedback tb OK Tests mestre
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-05-13acme-client: use EC_POINT_{get,set}_affine_cooordinates()Theo Buehler
The versions with _GFp() suffix only exist for historical reasons. Now that we have EC_POINT_{get,set}_affine_coordinates(), we should stop using the old ones as they provide no benefit. ok florian
2021-02-12Xr to ssl(8) which has clues about EC key generation that are still usefulStuart Henderson
to acme-client users.
2021-01-11document how to specify multiple alternative names;Jason McIntyre
modified version of diff from wolf on misc, improved by and ok florian benno sthen
2021-01-03Create .1 backup files when acme-client is going to overwrite aFlorian Obser
certificate file. These files are not terribly big and they might become helpful if one re-creates a certificate with additional or removed domains and whishes to revoke the old cert (this part needs a bit of work to make it convenient to do). OK sthen
2021-01-02If acme-client detects an added or removed SAN in the config fileStuart Henderson
compared to the existing certificate on disk, automatically request a new certificate without requiring -F. (Previously the code using -F only coped with added SANs; if one was removed in config then the certificate needed manual removal vefore acme-client would work). Name checks for -r (revocation) are kept as-is for now.
2020-12-24First fulfil all challenges then tell the CA that it should check.Florian Obser
For http-01 this doesn't matter but I think this will be nicer for dns-01 because there are propagation delays to consider and it will be better to just put everything in DNS and then wait then wait after each challenge. Testing & OK sthen
2020-12-19remove extra sTheo Buehler
2020-12-18Add details to -F flagsolene
If you add alternatives domain names to acme-client.conf, using -F is required to renew the certificate with the new names. ok jmc@
2020-11-18Do not check the list of SAN's in the cert when -F is specified to force renewalBob Beck
This allows you to add a SAN DNS name to a cert, and request a forced renewal to get the new name added immediately ok florian@
2020-11-06mention that acme-client generates a 4096-bit or secp384r1 key if the keyStuart Henderson
file doesn't exist; ok florian jmc
2020-11-04Back out last commit.denis
Some devs are not convinced.
2020-11-02acme response challenge location to issue better error codedenis
Notified to me by jmc@ Diff by Matthias Pressfreund <mpfr @ fn de>, thanks
2020-09-14We need to be able to provide contact information to use theFlorian Obser
buypass.com acme api. From Bartosz Kuzma (bartosz.kuzma AT release11.com), thanks! OK beck, deraadt