9 Commits

Author SHA1 Message Date
Lukas Schauer
911a822c0c added option to pass environment variables over sudo 2024-08-04 12:07:34 +02:00
Wilfried Teiken
4fd777e87e Ignore output of 'openssl req -verify'.
Newer versions of openssl seem to send the verify outout to stdout instead of
stderr in the past. Ignore that output when retrieving altnames.
2023-12-05 02:36:40 +01:00
Lukas Schauer
e3ef43c816 fix zsh compatibility (fixes #896) 2023-01-16 22:41:05 +01:00
Alexander Sulfrian
67b111a7b0 Replace all escaped slashes in json strings (closes #866)
${var/pattern/string} will only replace the first occurence. We should
use ${var//pattern/string} to replace all escaped slashes.
2022-10-31 16:27:16 +01:00
Daniel Molkentin
fa68ad8b23 improve man page based on feedback from debian-l10n-english (fixes #873, closes #875)
Also propagate changes to dehydrated help and README.md
2022-10-31 16:22:04 +01:00
Lukas Schauer
5c4adf6baa added note about dehydrated irc channel 2022-10-31 15:46:28 +01:00
Lukas Schauer
35bfea55b6 increase dehydrated version for git master use 2022-10-31 15:46:07 +01:00
Lukas Schauer
ea84199863 release 0.7.1 (it finally happened!) 2022-10-31 15:12:38 +01:00
Krayon
6091ba4bc2 Add missing checks and fix hexdump output (closes #878) 2022-10-31 15:12:04 +01:00
5 changed files with 39 additions and 13 deletions

View File

@@ -2,11 +2,19 @@
This file contains a log of major changes in dehydrated This file contains a log of major changes in dehydrated
## [x.x.x] - xxxx-xx-xx ## [x.x.x] - xxxx-xx-xx
## Added
- New config variable `DEHYDRATED_SUDO_ENV` to allow passing environment variables over sudo calls
## [0.7.1] - 2022-10-31
## Changed ## Changed
- `--force` no longer forces domain name revalidation by default, a new argument `--force-validation` has been added for that - `--force` no longer forces domain name revalidation by default, a new argument `--force-validation` has been added for that
- Added support for EC secp521r1 algorithm (works with e.g. zerossl) - Added support for EC secp521r1 algorithm (works with e.g. zerossl)
- `EC PARAMETERS` are no longer written to privkey.pem (didn't seem necessary and was causing issues with various software) - `EC PARAMETERS` are no longer written to privkey.pem (didn't seem necessary and was causing issues with various software)
## Fixed
- Requests resulting in `badNonce` errors are now automatically retried (fixes operation with LE staging servers)
- Deprecated `egrep` usage has been removed
## Added ## Added
- Implemented EC for account keys - Implemented EC for account keys
- Domain list now also read from domains.txt.d subdirectory (behaviour might change, see docs) - Domain list now also read from domains.txt.d subdirectory (behaviour might change, see docs)

View File

@@ -71,7 +71,7 @@ Parameters:
--ca url/preset Use specified CA URL or preset --ca url/preset Use specified CA URL or preset
--alias certalias Use specified name for certificate directory (and per-certificate config) instead of the primary domain (only used if --domain is specified) --alias certalias Use specified name for certificate directory (and per-certificate config) instead of the primary domain (only used if --domain is specified)
--keep-going (-g) Keep going after encountering an error while creating/renewing multiple certificates in cron mode --keep-going (-g) Keep going after encountering an error while creating/renewing multiple certificates in cron mode
--force (-x) Force renew of certificate even if it is longer valid than value in RENEW_DAYS --force (-x) Force certificate renewal even if it is not due to expire within RENEW_DAYS
--force-validation Force revalidation of domain names (used in combination with --force) --force-validation Force revalidation of domain names (used in combination with --force)
--no-lock (-n) Don't use lockfile (potentially dangerous!) --no-lock (-n) Don't use lockfile (potentially dangerous!)
--lock-suffix example.com Suffix lockfile name with a string (useful for with -d) --lock-suffix example.com Suffix lockfile name with a string (useful for with -d)
@@ -86,3 +86,9 @@ Parameters:
--challenge (-t) http-01|dns-01|tls-alpn-01 Which challenge should be used? Currently http-01, dns-01, and tls-alpn-01 are supported --challenge (-t) http-01|dns-01|tls-alpn-01 Which challenge should be used? Currently http-01, dns-01, and tls-alpn-01 are supported
--algo (-a) rsa|prime256v1|secp384r1 Which public key algorithm should be used? Supported: rsa, prime256v1 and secp384r1 --algo (-a) rsa|prime256v1|secp384r1 Which public key algorithm should be used? Supported: rsa, prime256v1 and secp384r1
``` ```
## Chat
Dehydrated has an official IRC-channel `#dehydrated` on libera.chat that can be used for general discussion and suggestions.
The channel can also be accessed with Matrix using the official libera.chat bridge at `#dehydrated:libera.chat`.

View File

@@ -17,7 +17,7 @@ umask 077 # paranoid umask, we're creating private keys
exec 3>&- exec 3>&-
exec 4>&- exec 4>&-
VERSION="0.7.1" VERSION="0.7.2"
# Find directory in which this script is stored by traversing all symbolic links # Find directory in which this script is stored by traversing all symbolic links
SOURCE="${0}" SOURCE="${0}"
@@ -143,7 +143,7 @@ jsonsh() {
# Force zsh to expand $A into multiple words # Force zsh to expand $A into multiple words
local is_wordsplit_disabled local is_wordsplit_disabled
is_wordsplit_disabled="$(unsetopt 2>/dev/null | grep -c '^shwordsplit$')" is_wordsplit_disabled="$(unsetopt 2>/dev/null | grep -c '^shwordsplit$' || true)"
if [ "${is_wordsplit_disabled}" != "0" ]; then setopt shwordsplit; fi if [ "${is_wordsplit_disabled}" != "0" ]; then setopt shwordsplit; fi
$GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | grep -Ev "^$SPACE$" $GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | grep -Ev "^$SPACE$"
if [ "${is_wordsplit_disabled}" != "0" ]; then unsetopt shwordsplit; fi if [ "${is_wordsplit_disabled}" != "0" ]; then unsetopt shwordsplit; fi
@@ -217,7 +217,7 @@ jsonsh() {
'[') parse_array "$jpath" ;; '[') parse_array "$jpath" ;;
# At this point, the only valid single-character tokens are digits. # At this point, the only valid single-character tokens are digits.
''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;; ''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;;
*) value="${token/\\\///}" *) value="${token//\\\///}"
# replace solidus ("\/") in json strings with normalized value: "/" # replace solidus ("\/") in json strings with normalized value: "/"
;; ;;
esac esac
@@ -260,7 +260,7 @@ _mktemp() {
# Check for script dependencies # Check for script dependencies
check_dependencies() { check_dependencies() {
# look for required binaries # look for required binaries
for binary in grep mktemp diff sed awk curl cut; do for binary in grep mktemp diff sed awk curl cut head tail hexdump; do
bin_path="$(command -v "${binary}" 2>/dev/null)" || _exiterr "This script requires ${binary}." bin_path="$(command -v "${binary}" 2>/dev/null)" || _exiterr "This script requires ${binary}."
[[ -x "${bin_path}" ]] || _exiterr "${binary} found in PATH but it's not executable" [[ -x "${bin_path}" ]] || _exiterr "${binary} found in PATH but it's not executable"
done done
@@ -390,6 +390,7 @@ load_config() {
AUTO_CLEANUP="no" AUTO_CLEANUP="no"
DEHYDRATED_USER= DEHYDRATED_USER=
DEHYDRATED_GROUP= DEHYDRATED_GROUP=
DEHYDRATED_SUDO_ENV="no"
API="auto" API="auto"
if [[ -z "${CONFIG:-}" ]]; then if [[ -z "${CONFIG:-}" ]]; then
@@ -442,8 +443,12 @@ load_config() {
if [[ -z "${DEHYDRATED_GROUP}" ]]; then if [[ -z "${DEHYDRATED_GROUP}" ]]; then
if [[ "${EUID}" != "${TARGET_UID}" ]]; then if [[ "${EUID}" != "${TARGET_UID}" ]]; then
echo "# INFO: Running $0 as ${DEHYDRATED_USER}" echo "# INFO: Running $0 as ${DEHYDRATED_USER}"
if [ "${DEHYDRATED_SUDO_ENV}" = "yes" ]; then
has_sudo && exec sudo -E -H -u "${DEHYDRATED_USER}" "${0}" "${ORIGARGS[@]}"
else
has_sudo && exec sudo -u "${DEHYDRATED_USER}" "${0}" "${ORIGARGS[@]}" has_sudo && exec sudo -u "${DEHYDRATED_USER}" "${0}" "${ORIGARGS[@]}"
fi fi
fi
else else
TARGET_GID="$(getent group "${DEHYDRATED_GROUP}" | cut -d':' -f3)" || _exiterr "DEHYDRATED_GROUP ${DEHYDRATED_GROUP} is invalid" TARGET_GID="$(getent group "${DEHYDRATED_GROUP}" | cut -d':' -f3)" || _exiterr "DEHYDRATED_GROUP ${DEHYDRATED_GROUP} is invalid"
if [[ -z "${EGID:-}" ]]; then if [[ -z "${EGID:-}" ]]; then
@@ -452,9 +457,13 @@ load_config() {
fi fi
if [[ "${EUID}" != "${TARGET_UID}" ]] || [[ "${EGID}" != "${TARGET_GID}" ]]; then if [[ "${EUID}" != "${TARGET_UID}" ]] || [[ "${EGID}" != "${TARGET_GID}" ]]; then
echo "# INFO: Running $0 as ${DEHYDRATED_USER}/${DEHYDRATED_GROUP}" echo "# INFO: Running $0 as ${DEHYDRATED_USER}/${DEHYDRATED_GROUP}"
if [ "${DEHYDRATED_SUDO_ENV}" = "yes" ]; then
has_sudo && exec sudo -E -H -u "${DEHYDRATED_USER}" -g "${DEHYDRATED_GROUP}" "${0}" "${ORIGARGS[@]}"
else
has_sudo && exec sudo -u "${DEHYDRATED_USER}" -g "${DEHYDRATED_GROUP}" "${0}" "${ORIGARGS[@]}" has_sudo && exec sudo -u "${DEHYDRATED_USER}" -g "${DEHYDRATED_GROUP}" "${0}" "${ORIGARGS[@]}"
fi fi
fi fi
fi
elif [[ -n "${DEHYDRATED_GROUP}" ]]; then elif [[ -n "${DEHYDRATED_GROUP}" ]]; then
_exiterr "DEHYDRATED_GROUP can only be used in combination with DEHYDRATED_USER." _exiterr "DEHYDRATED_GROUP can only be used in combination with DEHYDRATED_USER."
fi fi
@@ -839,7 +848,7 @@ hex2bin() {
# Convert binary data to hex string # Convert binary data to hex string
bin2hex() { bin2hex() {
hexdump -e '16/1 "%02x"' hexdump -v -e '/1 "%02x"'
} }
# OpenSSL writes to stderr/stdout even when there are no errors. So just # OpenSSL writes to stderr/stdout even when there are no errors. So just
@@ -1011,7 +1020,7 @@ signed_request() {
extract_altnames() { extract_altnames() {
csr="${1}" # the CSR itself (not a file) csr="${1}" # the CSR itself (not a file)
if ! <<<"${csr}" "${OPENSSL}" req -verify -noout 2>/dev/null; then if ! <<<"${csr}" "${OPENSSL}" req -verify -noout >/dev/null 2>&1; then
_exiterr "Certificate signing request isn't valid" _exiterr "Certificate signing request isn't valid"
fi fi
@@ -2262,7 +2271,7 @@ main() {
;; ;;
# PARAM_Usage: --force (-x) # PARAM_Usage: --force (-x)
# PARAM_Description: Force renew of certificate even if it is longer valid than value in RENEW_DAYS # PARAM_Description: Force certificate renewal even if it is not due to expire within RENEW_DAYS
--force|-x) --force|-x)
PARAM_FORCE="yes" PARAM_FORCE="yes"
;; ;;

View File

@@ -16,6 +16,9 @@
# Which group should dehydrated run as? This will be implicitly enforced when running as root # Which group should dehydrated run as? This will be implicitly enforced when running as root
#DEHYDRATED_GROUP= #DEHYDRATED_GROUP=
# Should dehydrated pass environment variables over sudo?
#DEHYDRATED_SUDO_ENV="no"
# Resolve names to addresses of IP version only. (curl) # Resolve names to addresses of IP version only. (curl)
# supported values: 4, 6 # supported values: 4, 6
# default: <unset> # default: <unset>

View File

@@ -20,8 +20,8 @@ Dehydrated will notify if no account is configured. Run with \fB--register
Next, all domain names must be provided in domains.txt. The format is line Next, all domain names must be provided in domains.txt. The format is line
based: If the file contains two lines "example.com" and "example.net", based: If the file contains two lines "example.com" and "example.net",
Dehydrated will request two certificate, one for "example.com" and the other dehydrated will request two certificate, one for "example.com" and the other
for "example.net". A single line while "example.com example.net" will request a for "example.net". A single line containing "example.com example.net" will request a
single certificate valid for both "example.net" and "example.com" through the \fISubject single certificate valid for both "example.net" and "example.com" through the \fISubject
Alternative Name\fR (SAN) field. Alternative Name\fR (SAN) field.
@@ -106,7 +106,7 @@ Keep going after encountering an error while creating/renewing multiple
certificates in cron mode certificates in cron mode
.TP .TP
.BR \-\-force ", " \-x .BR \-\-force ", " \-x
Force renew of certificate even if it is longer valid than value in RENEW_DAYS Force certificate renewal even if it is not due to expire within RENEW_DAYS
.TP .TP
.BR \-\-no\-lock ", " \-n .BR \-\-no\-lock ", " \-n
Don't use lockfile (potentially dangerous!) Don't use lockfile (potentially dangerous!)