[Bug] problem when insert _domainkey using dns_txt.conf with API (include step to reproduce)

MaXi32

Verified User
Joined
Jul 25, 2016
Messages
658
Location
The Earth
I created the following template in /usr/local/directadmin/data/templates/custom/dns_txt.conf

Code:
|DOMAIN|.="v=spf1 a mx ip4:|SERVER_IP||EXTRA_SPF| ~all"
_dmarc="v=DMARC1; p=none; sp=none; rua=mailto:spam-reports@|DOMAIN|"
_domainkey="o=~; r=webmaster@|DOMAIN|"

After that, when I create a new user through directadmin GUI, all the 3 records above were inserted in DNS record perfectly, but if I use API to create a new user, the last record _domainkey from the above template, did not appear in DNS text entry (only the first and second records were inserted).

So, I also put the last record dns_txt.conf alone in /usr/local/directadmin/data/templates/custom/dns_txt.conf like this:

Code:
_domainkey="o=~; r=webmaster@|DOMAIN|"

Then when I create user using directadmin GUI, it creates the _domainkey record in DNS but using API will not create this record.

I also ran directadmin in debug mode and found no error related to this. What could be the reason?

Step to reproduce

1) Add this entry into /usr/local/directadmin/data/templates/custom/dns_txt.conf

Code:
_domainkey="o=~; r=webmaster@|DOMAIN|"

2) Restart directadmin

Code:
echo "action=directadmin&value=restart" >>/usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d2000

3) Run rewrite_confs

Code:
/usr/local/directadmin/custombuild/build rewrite_confs

4) Call API (sample):


Bash:
username="$1"
  email="$2"
  password="$3"
  domain="$4"
  package_name="$5"
  ip_type="$6"
  command="CMD_API_ACCOUNT_RESELLER" # Same thing on CMD_ACCOUNT_RESELLER
  data="username=${username}&email=${email}&passwd=${password}&passwd2=${password}&domain=${domain}&package=${package_name}&notify=yes&ip=${ip_type}&action=create&add=yes&json=yes"
method="POST"
curl --silent --request "${method}" --user "${api_username}":"${api_password}" --data "${data}" "${ssl}://${server.domain.com}:2222/${command}"

Problem:

When using API, user will be created with domain successfully and all DNS records were created perfectly except the record for '_domainkey', but when this is done through GUI, all DNS records including _domainkey were created without problem.

Expected:

'_domainkey' record should be written in DNS record when using API as it's working fine when using GUI.
 
Last edited:
Ok, bingo this indeed a bug in API, if I put extra string xxxxxxx after _domainkey like below, the DNS recognized this.

Code:
_domainkeyxxxxxxx="o=~; r=webmaster@|DOMAIN|"

This will insert the record '_domainkeyxxxxxxx' when I create reseller new account with default domain. The API seems like reserving the name of '_domainkey' and prevent the insertion if I use this name '_domainkey'. The question is why I cannot use this record name '_domainkey' in API ?
 
Last edited:
I have not found any solutions yet but my current workaround is to re-create the DKIM signing policy record using:
  • domain_create_post.sh
 
Last edited:
dont you need a selector?

like x._domainkey

I think DA uses x

thanks for reply. Yes, I already have x selector (it was generated by DA automatically) but this name '_domainkey' is for outbound signing policy as another type of DKIM record where we can specify o=~ or o=-.

Meaning the 3rd entry is for an optional DKIM signing policy not a DKIM signature which is already generated by DA using x selector.

The weird thing is, this record name '_domainkey' is possible to create using DA interface but not API.
 
Last edited:
Another bug I've found is, when creating a new username using API, it will not add this DNS record for its first domain:


Code:
# dns_a.conf
|*if IS_IPV6!="yes"|
|DOMAIN|.=|IP|
|*endif|

and this:

#  dns_aaaa.conf
|*if IS_IPV6="yes"|
|DOMAIN|.=|IP|
|*endif|


I have to manually add the above from the GUI:

Code:
record type: A
name: domain.com.
value: ipv4

record type: AAAA
name: domain.com.
value: ipv6
 
Surprisingly this has been few months since I reported, but still not fixed in the latest version Directadmin 1.62.5. I already included step to reproduce for this issue in post #1. Maybe if someone can explain .. how do I create this new key automatically when I create a new domain through API? the main issue is with the API that cannot use this record that has name _domainkey but it works with GUI.

Code:
_domainkey="o=~; [email protected]"
 
Last edited:
Back
Top