Skip to content

Commit 39fa40a

Browse files
authored
fixed secret+key storage-usage
fixed the key and secret handling via acme account.conf
1 parent 6e14a07 commit 39fa40a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

dnsapi/dns_kappernet.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
#KAPPERNETDNS_Key="yourKAPPERNETapikey"
88
#KAPPERNETDNS_Secret="yourKAPPERNETapisecret"
9-
10-
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
9+
#KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
1110

1211
###############################################################################
1312
# called with
@@ -19,10 +18,9 @@ dns_kappernet_add() {
1918

2019
KAPPERNETDNS_Key="${KAPPERNETDNS_Key:-$(_readaccountconf_mutable KAPPERNETDNS_Key)}"
2120
KAPPERNETDNS_Secret="${KAPPERNETDNS_Secret:-$(_readaccountconf_mutable KAPPERNETDNS_Secret)}"
21+
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
2222

2323
if [ -z "$KAPPERNETDNS_Key" ] || [ -z "$KAPPERNETDNS_Secret" ]; then
24-
KAPPERNETDNS_Key=""
25-
KAPPERNETDNS_Secret=""
2624
_err "Please specify your kapper.net api key and secret."
2725
_err "If you have not received yours - send your mail to"
2826
_err "[email protected] to get your key and secret."
@@ -41,7 +39,7 @@ dns_kappernet_add() {
4139
_debug _domain "DOMAIN: $_domain"
4240

4341
_info "Trying to add TXT DNS Record"
44-
data="%7B%22name%22%3A%22$fullhostname%22%2C%22type%22%3A%22TXT%22%2C%22content%22%3A%22$txtvalue%22%2C%22ttl%22%3A%223600%22%2C%22prio%22%3A%22%22%7D"
42+
data="%7B%22name%22%3A%22$fullhostname%22%2C%22type%22%3A%22TXT%22%2C%22content%22%3A%22$txtvalue%22%2C%22ttl%22%3A%22300%22%2C%22prio%22%3A%22%22%7D"
4543
if _kappernet_api GET "action=new&subject=$_domain&data=$data"; then
4644

4745
if _contains "$response" "{\"OK\":true"; then
@@ -66,10 +64,9 @@ dns_kappernet_rm() {
6664

6765
KAPPERNETDNS_Key="${KAPPERNETDNS_Key:-$(_readaccountconf_mutable KAPPERNETDNS_Key)}"
6866
KAPPERNETDNS_Secret="${KAPPERNETDNS_Secret:-$(_readaccountconf_mutable KAPPERNETDNS_Secret)}"
67+
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
6968

7069
if [ -z "$KAPPERNETDNS_Key" ] || [ -z "$KAPPERNETDNS_Secret" ]; then
71-
KAPPERNETDNS_Key=""
72-
KAPPERNETDNS_Secret=""
7370
_err "Please specify your kapper.net api key and secret."
7471
_err "If you have not received yours - send your mail to"
7572
_err "[email protected] to get your key and secret."
@@ -81,7 +78,7 @@ dns_kappernet_rm() {
8178
_saveaccountconf_mutable KAPPERNETDNS_Secret "$KAPPERNETDNS_Secret"
8279

8380
_info "Trying to remove the TXT Record: $fullhostname containing $txtvalue"
84-
data="%7B%22name%22%3A%22$fullhostname%22%2C%22type%22%3A%22TXT%22%2C%22content%22%3A%22$txtvalue%22%2C%22ttl%22%3A%223600%22%2C%22prio%22%3A%22%22%7D"
81+
data="%7B%22name%22%3A%22$fullhostname%22%2C%22type%22%3A%22TXT%22%2C%22content%22%3A%22$txtvalue%22%2C%22ttl%22%3A%22300%22%2C%22prio%22%3A%22%22%7D"
8582
if _kappernet_api GET "action=del&subject=$fullhostname&data=$data"; then
8683
if _contains "$response" "{\"OK\":true"; then
8784
return 0
@@ -141,7 +138,7 @@ _kappernet_api() {
141138
if [ "$method" = "GET" ]; then
142139
response="$(_get "$url")"
143140
else
144-
_err "Unsupported method"
141+
_err "Unsupported method or missing Secret/Key"
145142
return 1
146143
fi
147144

0 commit comments

Comments
 (0)