summaryrefslogtreecommitdiff
path: root/usr.sbin/acme-client
AgeCommit message (Collapse)Author
2024-10-10Always print account URI on first creation of an account key.Florian Obser
This was hidden behind -v but it seems useful to always have this when creating a new account. As sthen points out in his previous commit: This is useful if you want to set a CAA DNS record restricting issuance to a specific user account. OK deraadt
2024-10-07When acme-client is run with -v, show the account URI from the LocationStuart Henderson
header sent by the server in response to the newAccount API call (used for every cert request). This is useful if you want to set a CAA DNS record restricting issuance to a specific user account, rather than just "all of $whichever_acme_CA". ok florian
2024-06-19Kill the SIGPIPE signal handler which is installed around write opertations.Claudio Jeker
Instead just SIG_IGN SIGPIPE in main.c for all of acme-client. More work to be done here but at least this distraction is gone. OK florian@ deraadt@ op@
2024-05-21remove prototypes with no matching function and externs with no varJonathan Gray
partly checked by millert@
2024-05-09Align RSA and EC key generation with each otherTheo Buehler
Being two different cryptographic primitives, it is clear that there must be some differences between RSA and EC keygen, but they don't have to be entirely different. We need to set the key type, RSA needs a bit size and ECDSA needs a curve. That's all the differences there need to be. Garbage collect a few useless elses and avoid two exit labels paths where one would do just fine. As another small bonus, this file no longer uses "deprecated API", so the portable fork can get rid of an ugly openssl 3 patch if they want to. ok florian
2024-04-28Remove unused url from netproc()Theo Buehler
Leftover from when RFC 8555 support was added. ok florian
2024-04-28Don't filter dangerous characters by hand when strvisx(3) is right there.Florian Obser
segfault reported by sthen, which was most likely caused by buf_dump(). OK tb
2023-08-29acme-client: drop ecdsa.h, fix spacing and a typo in error messageOmar Polo
While here drop EC_KEY_set_asn1_flag(OPENSSL_EC_NAMED_CURVE). EC_KEY_new_by_curve_name() ends up calling EC_GROUP_new() which already sets the OPENSSL_EC_NAMED_CURVE flag on the group. (suggested by tb@) ok tb@
2023-05-16since apparently, the "example" conf is not free-form (adding commentsMarc Espie
would break scripts, go figure), highlight the staging servers so that people with non-standard configurations (challenge/response) get a chance at figuring things out. okay tb@
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