Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync #5290

Merged
merged 34 commits into from
Sep 18, 2024
Merged

sync #5290

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bd3a2b1
Prevent leaving blank lines in config file after cleared keys.
scruel Feb 27, 2024
b1d0191
UBNT removed keytool from UnifiOS, modify to use openssl PKCS12. Also…
3VAbdAVE May 13, 2024
fd461fe
Fix missing XML Escaping in Password String
Weishaupt May 16, 2024
5789e80
Fixed a bug where the zone_id was corrupted for domains containing th…
IIIPr0t0typ3III Jul 5, 2024
a2bc79d
Fixed a bug where trying to add entries where the fulldomain contains…
Jul 7, 2024
ab86e05
Changed A-Z and a-z to [:upper:] and [:lower:] from last commit to co…
Jul 7, 2024
0a64567
Merge branch 'acmesh-official:dev' into dev
IIIPr0t0typ3III Jul 22, 2024
dd582c0
Changed the direct call of `tr` to cast to lower case to the function
Jul 23, 2024
3e36f05
Update dockerhub.yml
tomo2403 Jul 27, 2024
b6f7710
Update bark.sh
tomo2403 Jul 27, 2024
cb5eae8
Update dns_ispconfig.sh
mickaelmonsieur Jul 31, 2024
de90216
Replaced keytool with openssl pkcs12. Added backup of original certif…
3VAbdAVE Aug 1, 2024
57da04b
Updated Unifi deploy hook to use openssl's pkcs12 instead of Java Key…
3VAbdAVE Aug 12, 2024
3bb5943
Merge branch 'dev' of https://github.com/3VAbdAVE/acme.sh into dev
3VAbdAVE Aug 12, 2024
a8d8fef
Merge branch 'acmesh-official:dev' into dev
3VAbdAVE Aug 12, 2024
adfafe5
reverted bad merge
3VAbdAVE Aug 12, 2024
ca62263
removed old comment
3VAbdAVE Aug 12, 2024
de99d6d
fixed shfmt
3VAbdAVE Aug 15, 2024
f1b6016
Merge branch 'acmesh-official:dev' into dev
3VAbdAVE Aug 15, 2024
d8637b2
fixes #3359
3VAbdAVE Aug 15, 2024
a94653b
Merge branch 'dev' of https://github.com/3VAbdAVE/acme.sh into dev
3VAbdAVE Aug 15, 2024
5275daa
Merge pull request #5231 from mickaelmonsieur/master
Neilpang Sep 15, 2024
e0214a2
Merge pull request #5218 from IIIPr0t0typ3III/dev
Neilpang Sep 15, 2024
beb31ab
Merge pull request #5246 from 3VAbdAVE/dev
Neilpang Sep 15, 2024
dc341ef
Merge pull request #5149 from Weishaupt/patch-1
Neilpang Sep 15, 2024
8635d89
Merge pull request #5029 from scruel/patch-2
Neilpang Sep 15, 2024
2d28259
fix format
Sep 15, 2024
f86ee84
fix format
Sep 15, 2024
522c953
Update dockerhub.yml
tomo2403 Sep 15, 2024
ea94477
Merge pull request #5229 from tomo2403/master
Neilpang Sep 15, 2024
22d260f
fix dns_nsupdate when NSUPDATE_OPT is empty, refs #5224
fraenki Sep 16, 2024
9ecd840
resolve shellcheck offenses
fraenki Sep 17, 2024
167aba6
Merge pull request #5285 from markt-de/fix_nsupdate
Neilpang Sep 17, 2024
d057a9b
update version
Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acme.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

VER=3.0.8
VER=3.0.9

PROJECT_NAME="acme.sh"

Expand Down Expand Up @@ -2361,7 +2361,7 @@ _clear_conf() {
_sdkey="$2"
if [ "$_c_c_f" ]; then
_conf_data="$(cat "$_c_c_f")"
echo "$_conf_data" | sed "s/^$_sdkey *=.*$//" >"$_c_c_f"
echo "$_conf_data" | sed "/^$_sdkey *=.*$/d" >"$_c_c_f"
else
_err "Config file is empty, cannot clear"
fi
Expand Down
6 changes: 3 additions & 3 deletions deploy/synology_dsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ synology_dsm_deploy() {

# Default values for scheme, hostname and port
# Defaulting to localhost and http, because it's localhost…
[ -n "$SYNO_SCHEME" ] || SYNO_SCHEME="http"
[ -n "$SYNO_HOSTNAME" ] || SYNO_HOSTNAME="localhost"
[ -n "$SYNO_PORT" ] || SYNO_PORT="5000"
[ -n "$SYNO_SCHEME" ] || SYNO_SCHEME=http
[ -n "$SYNO_HOSTNAME" ] || SYNO_HOSTNAME=localhost
[ -n "$SYNO_PORT" ] || SYNO_PORT=5000
_savedeployconf SYNO_SCHEME "$SYNO_SCHEME"
_savedeployconf SYNO_HOSTNAME "$SYNO_HOSTNAME"
_savedeployconf SYNO_PORT "$SYNO_PORT"
Expand Down
84 changes: 68 additions & 16 deletions deploy/unifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
# - self-hosted Unifi Controller
# - Unifi Cloud Key (Gen1/2/2+)
# - Unifi Cloud Key running UnifiOS (v2.0.0+, Gen2/2+ only)
# - Unifi Dream Machine
# This has not been tested on other "all-in-one" devices such as
# UDM Pro or Unifi Express.
#
# OS Version v2.0.0+
# Network Application version 7.0.0+
# OS version ~3.1 removed java and keytool from the UnifiOS.
# Using PKCS12 format keystore appears to work fine.
#
# Please report bugs to https://github.com/acmesh-official/acme.sh/issues/3359

#returns 0 means success, otherwise error.
Expand Down Expand Up @@ -74,14 +83,16 @@ unifi_deploy() {
_reload_cmd=""

# Unifi Controller environment (self hosted or any Cloud Key) --
# auto-detect by file /usr/lib/unifi/data/keystore:
# auto-detect by file /usr/lib/unifi/data/keystore
_unifi_keystore="${DEPLOY_UNIFI_KEYSTORE:-/usr/lib/unifi/data/keystore}"
if [ -f "$_unifi_keystore" ]; then
_info "Installing certificate for Unifi Controller (Java keystore)"
_debug _unifi_keystore "$_unifi_keystore"
if ! _exists keytool; then
_err "keytool not found"
return 1
_do_keytool=0
_info "Installing certificate for Unifi Controller (PKCS12 keystore)."
else
_do_keytool=1
_info "Installing certificate for Unifi Controller (Java keystore)"
fi
if [ ! -w "$_unifi_keystore" ]; then
_err "The file $_unifi_keystore is not writable, please change the permission."
Expand All @@ -92,29 +103,65 @@ unifi_deploy() {

_debug "Generate import pkcs12"
_import_pkcs12="$(_mktemp)"
_debug "_toPkcs $_import_pkcs12 $_ckey $_ccert $_cca $_unifi_keypass unifi root"
_toPkcs "$_import_pkcs12" "$_ckey" "$_ccert" "$_cca" "$_unifi_keypass" unifi root
# shellcheck disable=SC2181
if [ "$?" != "0" ]; then
_err "Error generating pkcs12. Please re-run with --debug and report a bug."
return 1
fi

_debug "Import into keystore: $_unifi_keystore"
if keytool -importkeystore \
-deststorepass "$_unifi_keypass" -destkeypass "$_unifi_keypass" -destkeystore "$_unifi_keystore" \
-srckeystore "$_import_pkcs12" -srcstoretype PKCS12 -srcstorepass "$_unifi_keypass" \
-alias unifi -noprompt; then
_debug "Import keystore success!"
rm "$_import_pkcs12"
# Save the existing keystore in case something goes wrong.
mv -f "${_unifi_keystore}" "${_unifi_keystore}"_original
_info "Previous keystore saved to ${_unifi_keystore}_original."

if [ "$_do_keytool" -eq 1 ]; then
_debug "Import into keystore: $_unifi_keystore"
if keytool -importkeystore \
-deststorepass "$_unifi_keypass" -destkeypass "$_unifi_keypass" -destkeystore "$_unifi_keystore" \
-srckeystore "$_import_pkcs12" -srcstoretype PKCS12 -srcstorepass "$_unifi_keypass" \
-alias unifi -noprompt; then
_debug "Import keystore success!"
else
_err "Error importing into Unifi Java keystore."
_err "Please re-run with --debug and report a bug."
_info "Restoring original keystore."
mv -f "${_unifi_keystore}"_original "${_unifi_keystore}"
rm "$_import_pkcs12"
return 1
fi
else
_err "Error importing into Unifi Java keystore."
_err "Please re-run with --debug and report a bug."
rm "$_import_pkcs12"
return 1
_debug "Copying new keystore to $_unifi_keystore"
cp -f "$_import_pkcs12" "$_unifi_keystore"
fi

# Update unifi service for certificate cipher compatibility
if ${ACME_OPENSSL_BIN:-openssl} pkcs12 \
-in "$_import_pkcs12" \
-password pass:aircontrolenterprise \
-nokeys | ${ACME_OPENSSL_BIN:-openssl} x509 -text \
-noout | grep -i "signature" | grep -iq ecdsa >/dev/null 2>&1; then
cp -f /usr/lib/unifi/data/system.properties /usr/lib/unifi/data/system.properties_original
_info "Updating system configuration for cipher compatibility."
_info "Saved original system config to /usr/lib/unifi/data/system.properties_original"
sed -i '/unifi\.https\.ciphers/d' /usr/lib/unifi/data/system.properties
echo "unifi.https.ciphers=ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES128-GCM-SHA256" >>/usr/lib/unifi/data/system.properties
sed -i '/unifi\.https\.sslEnabledProtocols/d' /usr/lib/unifi/data/system.properties
echo "unifi.https.sslEnabledProtocols=TLSv1.3,TLSv1.2" >>/usr/lib/unifi/data/system.properties
_info "System configuration updated."
fi

rm "$_import_pkcs12"

# Restarting unifi-core will bring up unifi, doing it out of order results in
# a certificate error, and breaks wifiman.
# Restart if we aren't doing unifi-core, otherwise stop for later restart.
if systemctl -q is-active unifi; then
_reload_cmd="${_reload_cmd:+$_reload_cmd && }service unifi restart"
if [ ! -f "${DEPLOY_UNIFI_CORE_CONFIG:-/data/unifi-core/config}/unifi-core.key" ]; then
_reload_cmd="${_reload_cmd:+$_reload_cmd && }systemctl restart unifi"
else
_reload_cmd="${_reload_cmd:+$_reload_cmd && }systemctl stop unifi"
fi
fi
_services_updated="${_services_updated} unifi"
_info "Install Unifi Controller certificate success!"
Expand Down Expand Up @@ -165,6 +212,11 @@ unifi_deploy() {
return 1
fi

# Save the existing certs in case something goes wrong.
cp -f "${_unifi_core_config}"/unifi-core.crt "${_unifi_core_config}"/unifi-core_original.crt
cp -f "${_unifi_core_config}"/unifi-core.key "${_unifi_core_config}"/unifi-core_original.key
_info "Previous certificate and key saved to ${_unifi_core_config}/unifi-core_original.crt/key."

cat "$_cfullchain" >"${_unifi_core_config}/unifi-core.crt"
cat "$_ckey" >"${_unifi_core_config}/unifi-core.key"

Expand Down
10 changes: 5 additions & 5 deletions dnsapi/dns_dynv6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dynv6_api="https://dynv6.com/api/v2"
# Please Read this guide first: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide
#Usage: dns_dynv6_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_dynv6_add() {
fulldomain=$1
txtvalue=$2
fulldomain="$(echo "$1" | _lower_case)"
txtvalue="$2"
_info "Using dynv6 api"
_debug fulldomain "$fulldomain"
_debug txtvalue "$txtvalue"
Expand Down Expand Up @@ -50,8 +50,8 @@ dns_dynv6_add() {
#Usage: fulldomain txtvalue
#Remove the txt record after validation.
dns_dynv6_rm() {
fulldomain=$1
txtvalue=$2
fulldomain="$(echo "$1" | _lower_case)"
txtvalue="$2"
_info "Using dynv6 API"
_debug fulldomain "$fulldomain"
_debug txtvalue "$txtvalue"
Expand Down Expand Up @@ -206,7 +206,7 @@ _get_zone_id() {
return 1
fi

zone_id="$(echo "$response" | tr '}' '\n' | grep "$selected" | tr ',' '\n' | grep id | tr -d '"')"
zone_id="$(echo "$response" | tr '}' '\n' | grep "$selected" | tr ',' '\n' | grep '"id":' | tr -d '"')"
_zone_id="${zone_id#id:}"
_debug "zone id: $_zone_id"
}
Expand Down
13 changes: 12 additions & 1 deletion dnsapi/dns_inwx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,24 @@ _inwx_check_cookie() {
return 1
}

_htmlEscape() {
_s="$1"
_s=$(echo "$_s" | sed "s/&/&/g")
_s=$(echo "$_s" | sed "s/</\&lt;/g")
_s=$(echo "$_s" | sed "s/>/\&gt;/g")
_s=$(echo "$_s" | sed 's/"/\&quot;/g')
printf -- %s "$_s"
}

_inwx_login() {

if _inwx_check_cookie; then
_debug "Already logged in"
return 0
fi

XML_PASS=$(_htmlEscape "$INWX_Password")

xml_content=$(printf '<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>account.login</methodName>
Expand All @@ -193,7 +204,7 @@ _inwx_login() {
</value>
</param>
</params>
</methodCall>' "$INWX_User" "$INWX_Password")
</methodCall>' "$INWX_User" "$XML_PASS")

response="$(_post "$xml_content" "$INWX_Api" "" "POST")"

Expand Down
2 changes: 2 additions & 0 deletions dnsapi/dns_ispconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Options:
# User must provide login data and URL to the ISPConfig installation incl. port.
# The remote user in ISPConfig must have access to:
# - DNS txt Functions
# - DNS zone functions
# - Client functions

######## Public functions #####################

Expand Down
12 changes: 8 additions & 4 deletions dnsapi/dns_nsupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ dns_nsupdate_add() {
[ -n "$DEBUG" ] && [ "$DEBUG" -ge "$DEBUG_LEVEL_1" ] && nsdebug="-d"
[ -n "$DEBUG" ] && [ "$DEBUG" -ge "$DEBUG_LEVEL_2" ] && nsdebug="-D"
if [ -z "${NSUPDATE_ZONE}" ]; then
nsupdate -k "${NSUPDATE_KEY}" $nsdebug "${NSUPDATE_OPT}" <<EOF
#shellcheck disable=SC2086
nsupdate -k "${NSUPDATE_KEY}" $nsdebug $NSUPDATE_OPT <<EOF
server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}
update add ${fulldomain}. 60 in txt "${txtvalue}"
send
EOF
else
nsupdate -k "${NSUPDATE_KEY}" $nsdebug "${NSUPDATE_OPT}" <<EOF
#shellcheck disable=SC2086
nsupdate -k "${NSUPDATE_KEY}" $nsdebug $NSUPDATE_OPT <<EOF
server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}
zone ${NSUPDATE_ZONE}.
update add ${fulldomain}. 60 in txt "${txtvalue}"
Expand Down Expand Up @@ -77,13 +79,15 @@ dns_nsupdate_rm() {
[ -n "$DEBUG" ] && [ "$DEBUG" -ge "$DEBUG_LEVEL_1" ] && nsdebug="-d"
[ -n "$DEBUG" ] && [ "$DEBUG" -ge "$DEBUG_LEVEL_2" ] && nsdebug="-D"
if [ -z "${NSUPDATE_ZONE}" ]; then
nsupdate -k "${NSUPDATE_KEY}" $nsdebug "${NSUPDATE_OPT}" <<EOF
#shellcheck disable=SC2086
nsupdate -k "${NSUPDATE_KEY}" $nsdebug $NSUPDATE_OPT <<EOF
server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}
update delete ${fulldomain}. txt
send
EOF
else
nsupdate -k "${NSUPDATE_KEY}" $nsdebug "${NSUPDATE_OPT}" <<EOF
#shellcheck disable=SC2086
nsupdate -k "${NSUPDATE_KEY}" $nsdebug $NSUPDATE_OPT <<EOF
server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}
zone ${NSUPDATE_ZONE}.
update delete ${fulldomain}. txt
Expand Down
Loading
Loading