A simple question on dns txt variable #410

Closed
opened 2025-12-29 01:24:36 +01:00 by adam · 3 comments
Owner

Originally created by @Tungsteno74 on GitHub (Jun 9, 2019).

Hello @lukas2511 ,

I can't find at which dehydrated code the $4 variablie in the duckdns hook.sh refers.

This is the piece of code:

    "deploy_challenge")
        curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=$4"
        echo
        ;;

It is supposed to be a TXT with record APIs from duckDNS page, but which ones exactly?

I ask this because I'm trying to implement another Hook based on this.
Thanks in advance

Originally created by @Tungsteno74 on GitHub (Jun 9, 2019). Hello @lukas2511 , I can't find at which dehydrated code the `$4` variablie in the [duckdns hook.sh](https://github.com/lukas2511/dehydrated/wiki/DNS-01-hook-for-DuckDNS) refers. This is the piece of code: ``` "deploy_challenge") curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=$4" echo ;; ``` It is supposed to be a TXT with record APIs from [duckDNS page](https://www.duckdns.org/spec.jsp), but which ones exactly? I ask this because I'm trying to implement another Hook based on this. Thanks in advance
adam closed this issue 2025-12-29 01:24:36 +01:00
Author
Owner

@jobe1986 commented on GitHub (Jun 9, 2019):

It should be noted that when comparing the linked duckDNS hook script to the example hook script https://github.com/lukas2511/dehydrated/blob/master/docs/examples/hook.sh that the $ variables are offset by one. That is where the duckDNS hook script says $4, read that as $3 in the example hook script. So in this case, $4 is the token value and thus the content of the TXT record.

@jobe1986 commented on GitHub (Jun 9, 2019): It should be noted that when comparing the linked duckDNS hook script to the example hook script https://github.com/lukas2511/dehydrated/blob/master/docs/examples/hook.sh that the $<number> variables are offset by one. That is where the duckDNS hook script says $4, read that as $3 in the example hook script. So in this case, $4 is the token value and thus the content of the TXT record.
Author
Owner

@Tungsteno74 commented on GitHub (Jun 9, 2019):

thanks @jobe1986 ,
ok well, now i understand better why how works, but why is it shifted?

Practically, the following slice of code from dehydrated hook.sh example is wrong:

deploy_challenge() {
    local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"

I tested it and DOMAIN variable give me "deploy_challenge" value. As you proposed if i "shift" it by one it returns me the correct value.
Is this a normal behavior or i miss something?

thanks

@Tungsteno74 commented on GitHub (Jun 9, 2019): thanks @jobe1986 , ok well, now i understand better why how works, but why is it shifted? Practically, the following slice of code from dehydrated hook.sh example is wrong: ``` deploy_challenge() { local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" ``` I tested it and DOMAIN variable give me "deploy_challenge" value. As you proposed if i "shift" it by one it returns me the correct value. Is this a normal behavior or i miss something? thanks
Author
Owner

@lukas2511 commented on GitHub (Jun 10, 2019):

The example hook shifts the variables before calling the functions (see last few lines of that example script). So yea, problem seems to be that you copied stuff around without adjusting for the differences in the scripts.

Edit: Reason for the shift is purely to make a clear difference between the functions and the data given for each.

@lukas2511 commented on GitHub (Jun 10, 2019): The example hook shifts the variables before calling the functions (see last few lines of that example script). So yea, problem seems to be that you copied stuff around without adjusting for the differences in the scripts. Edit: Reason for the shift is purely to make a clear difference between the functions and the data given for each.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dehydrated#410