mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-09-08 00:52:05 +00:00
Trying to allow nsd usage with zonesdir and multiple domains for same cert
This commit is contained in:
parent
0d25f7612b
commit
b274c98785
@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/bash
|
||||
|
||||
#Nsd_ZoneFile="/etc/nsd/zones/example.com.zone"
|
||||
#Nsd_Command="sudo nsd-control reload"
|
||||
#Nsd_ZonesDir="/etc/nsd/zones"
|
||||
|
||||
# args: fulldomain txtvalue
|
||||
dns_nsd_add() {
|
||||
@ -11,8 +12,14 @@ dns_nsd_add() {
|
||||
|
||||
Nsd_ZoneFile="${Nsd_ZoneFile:-$(_readdomainconf Nsd_ZoneFile)}"
|
||||
Nsd_Command="${Nsd_Command:-$(_readdomainconf Nsd_Command)}"
|
||||
Nsd_ZonesDir="${Nsd_ZonesDir:-$(_readdomainconf Nsd_ZonesDir)}"
|
||||
|
||||
|
||||
# Arg checks
|
||||
if [ -n "$Nsd_ZonesDir" ]; then
|
||||
Nsd_ZoneFile="$Nsd_ZonesDir/$fulldomain.zone"
|
||||
fi
|
||||
|
||||
if [ -z "$Nsd_ZoneFile" ] || [ -z "$Nsd_Command" ]; then
|
||||
Nsd_ZoneFile=""
|
||||
Nsd_Command=""
|
||||
@ -27,8 +34,16 @@ dns_nsd_add() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
_savedomainconf Nsd_ZoneFile "$Nsd_ZoneFile"
|
||||
_savedomainconf Nsd_Command "$Nsd_Command"
|
||||
if [ -n "$Nsd_ZonesDir" ]; then
|
||||
Nsd_ZoneFile="$Nsd_ZonesDir/$fulldomain.zone"
|
||||
_cleardomainconf Nsd_ZoneFile
|
||||
_savedomainconf Nsd_Command "$Nsd_Command"
|
||||
_savedomainconf Nsd_ZonesDir "$Nsd_ZonesDir"
|
||||
else
|
||||
_cleardomainconf Nsd_ZonesDir
|
||||
_savedomainconf Nsd_ZoneFile "$Nsd_ZoneFile"
|
||||
_savedomainconf Nsd_Command "$Nsd_Command"
|
||||
fi
|
||||
|
||||
echo "$fulldomain. $ttlvalue IN TXT \"$txtvalue\"" >>"$Nsd_ZoneFile"
|
||||
_info "Added TXT record for $fulldomain"
|
||||
@ -50,8 +65,9 @@ dns_nsd_rm() {
|
||||
|
||||
Nsd_ZoneFile="${Nsd_ZoneFile:-$(_readdomainconf Nsd_ZoneFile)}"
|
||||
Nsd_Command="${Nsd_Command:-$(_readdomainconf Nsd_Command)}"
|
||||
Nsd_ZonesDir="${Nsd_ZonesDir:-$(_readdomainconf Nsd_ZonesDir)}"
|
||||
|
||||
_sed_i "/$fulldomain. $ttlvalue IN TXT \"$txtvalue\"/d" "$Nsd_ZoneFile"
|
||||
sed -i "/$fulldomain. $ttlvalue IN TXT \"$txtvalue\"/d" "$Nsd_ZoneFile"
|
||||
_info "Removed TXT record for $fulldomain"
|
||||
_debug "Running $Nsd_Command"
|
||||
if eval "$Nsd_Command"; then
|
||||
|
Loading…
Reference in New Issue
Block a user