Closed internethering closed 1 year ago
You need to specify the setHost parameter to invoke the API. Here is an example:
php /usr/local/facileManager/fmDNS/client.php setHost id=36 action=add name=www value=1.2.3.4 type=A ttl=500 createPTR=yes comment="some comment" status=active
You would have to update each A record individually and given your example RR is at the root, it should look something like this:
php /usr/local/facileManager/fmDNS/client.php setHost id=36 action=update domain=example.org name="@" newvalue=10.0.0.2 type=A
Then a dry-run build should reflect the change:
php /usr/local/facileManager/fmDNS/client.php -d -n -z id=39
Thanks, nice to see this working. But it's difficult to handle. I want to use the api with let's encrypt, there I have to set every renew two TXT records:
_acme-challenge.example.org. 300 IN TXT ("F_huPhIxHEwrGAJ_V2-Vsohzzpwp5LZpKkPWE98H2Sg")
_acme-challenge.example.org. 300 IN TXT ("5eaqdCurfBqU94VM837tdM1GBRzbSgVKPJ-ke0rE6QY")
I want to delete the old ones, but:
php /usr/local/facileManager/fmDNS/client.php setHost id=39 action=delete type=TXT name=_acme-challenge
value is a required parameter.
Can you please enable delete without value parameter?
Then I've to have to access the database to get the IDs, it would be easyier for scripting, if I could access the api by setHost host=
Thanks for the feedback.
Without specifying the record value, how will fmDNS know which record (when there are multiple of the same name) to delete or update? This is why value is required. Perhaps an additional flag could be used to delete/update all records of the same name.
Specifying the domain ID is required because a lot of users have multiple views with the same domain names so the ID is what separates them.
Without specifying the record value, how will fmDNS know which record (when there are multiple of the same name) to delete or update? This is why value is required. Perhaps an additional flag could be used to delete/update all records of the same name.
'action=delete type=TXT name=_acme-challenge' should simply delete all _acme-challenge records.
Specifying the domain ID is required because a lot of users have multiple views with the same domain names so the ID is what separates them.
ok, thats an argument.
the API should run from client ? can we run from server ?
Correct, the API calls are currently only supported from client.php.
Correct, the API calls are currently only supported from client.php.
are there is a way to add,update and delete record from server over bash cli to trigger php or maybe using curl with payload to trigger the php ?
to run API using client.php, do i need run install first or i can initiate from any without run php74 client.php install ?
@WillyXJ thx for removing the parameter, it works fine. When I do:
php /usr/local/facileManager/fmDNS/client.php setHost id=39 action=add type=TXT name=_acme-challenge value=test php /usr/local/facileManager/fmDNS/client.php -z id=39
Only the first Nameserver is resolving, the second not:
$ host -t txt _acme-challenge.example.org. ns1.example.com
_acme-challenge.example.org descriptive text "test"
$ host -t txt _acme-challenge.example.org. ns2.example.com
Host _acme-challenge.example.org. not found: 3(NXDOMAIN)
The Webinterface shows me one avaiable update and after processing the second nameserver shows the correct value. Is it possible to run this update with client.php?
I found a bug/a feature in
php /usr/local/facileManager/fmDNS/client.php -z id=39
The server is being updated, but facileManager reports that the zone needs to be updated.
In this case, repeated changes via the API and server updates lead to the preservation of the old SOA serial - if there are slave DNSs, they will not be updated - SOA serial is not updated due to the fact that the facileManager believes that there were no updates.
fM was originally designed with GUI interaction in mind so the API is lacking (and likely not fully thought out). As such, the API is not able to issue zone updates on other clients nor does it reset zone reload flags in the database as those get updates through the GUI when all associated servers get successfully updated.
The API will likely need to be rewritten to handle these use cases.
Until then, it can be used to add, updated, delete records, but the reloads should be issued from the GUI.
Calling php /usr/local/facileManager/fmDNS/client.php -z id=39
Technically that client gets called from the fM server so it’s not an API call per se and it’s the server side that will update the SOA when all associated clients successfully reload the zone from the server. fmDNS was originally designed around users interacting with the server and not the client.
Calling php /usr/local/facileManager/fmDNS/client.php -z id=39
* is this an API call or not? P.S.: To solve my problem, I made an additional call to reloadZoneSQL($domain_id, "none", "one"); in function buildZoneConfig in facileManager/server/fm-modules/fmDNS/classes/class_buildconf.php
@beza2000 would it be possible for you to show me how you made this call (I'm assuming you did this via CLI)? I'm looking for a way to add records programmatically and reload the zones afterwards and this part is the last step I'm missing. Thanks in advance!
Calling php /usr/local/facileManager/fmDNS/client.php -z id=39
* is this an API call or not? P.S.: To solve my problem, I made an additional call to reloadZoneSQL($domain_id, "none", "one"); in function buildZoneConfig in facileManager/server/fm-modules/fmDNS/classes/class_buildconf.php
@beza2000 would it be possible for you to show me how you made this call (I'm assuming you did this via CLI)? I'm looking for a way to add records programmatically and reload the zones afterwards and this part is the last step I'm missing. Thanks in advance!
I am using the facilitemanager v4.1.1 & fmDNS v5.1.0. Patch file: patch.txt
Calling php /usr/local/facileManager/fmDNS/client.php -z id=39
* is this an API call or not? P.S.: To solve my problem, I made an additional call to reloadZoneSQL($domain_id, "none", "one"); in function buildZoneConfig in facileManager/server/fm-modules/fmDNS/classes/class_buildconf.php
@beza2000 would it be possible for you to show me how you made this call (I'm assuming you did this via CLI)? I'm looking for a way to add records programmatically and reload the zones afterwards and this part is the last step I'm missing. Thanks in advance!
I am using the facilitemanager v4.1.1 & fmDNS v5.1.0. Patch file: patch.txt
forgive my ignorance but I'm not seeing how to perform this via CLI (I know next to nothing about php. Just trying to automate creating records and reloading zones using ansible).
I am using the facilitemanager v4.1.1 & fmDNS v5.1.0. Patch file: patch.txt
forgive my ignorance but I'm not seeing how to perform this via CLI (I know next to nothing about php. Just trying to automate creating records and reloading zones using ansible).
My solution in the current code will not work without making changes. Then look for another solution.
Hey, I'm confused of using the API. For example I want to set a new IP for all A-Records:
php /usr/local/facileManager/fmDNS/client.php -d -n -z id=39 action=update type=A newvalue=10.0.0.2
I get a config with the old 10.0.0.1 ip:
I tried several other commands like delete or add. Nothing worked.