mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.75k stars 1.43k forks source link

Make DNS API DDNS compatible #1539

Open moritz31 opened 5 years ago

moritz31 commented 5 years ago

In my fritzbox i can enter an url a username and a password and then it updates dns from several providers for me. This is using an standard, which seems not to conform with the curl -X PUT which miab uses. Maybe we can make this standard conform to allow such updates. Is there any interest in this?

nomandera commented 4 years ago

Have to say if we could pick flavour of DynDNS API (I dont believe there is a universal standard) it would be quite easy for many users to trick their home cheapo routers to update mailinabox just by adding a static IP domain a router support natively.

e.g. point members.dyndns.org at mailinabox and choose DYN as the protocol

bilogic commented 8 months ago

@nomandera is there a reason to not allow home cheapo routers to update the DNS?

I have a sub domain FQDN pointed home constantly, but because it is easier for mailinabox to take over DNS duties, it also breaks this pointing home requirement.

My suggestion is to setup another GET route for updating a host IP.

nomandera commented 8 months ago

@bilogic I think my wording might have been confusing.

I am suggesting that if we were to adopt the same API as a well known service such as DYNDNS it would very likely then become possible to use cheap routers as a dynamic dns client.

i.e. cheap routers usually can only speak the language of very specific APIs which means even the most simple MIAB bepoke API will never be compatible.

In the interim you should look at https://github.com/mail-in-a-box/mailinabox/issues/2183

which has info on admin/dns/custom

For example a curl call in the form

curl --user username:password -X PUT https://mailinabox/admin/dns/custom/subdomain.domaintoupdateArecord

can be used to update dynmaic dns based on the IP MIAB detects the call has come from

bilogic commented 8 months ago

@nomandera

Ok, I suppose you meant you are ok with routers being able to update MIAB? I would be curious about the reason(s) against it if any.

The router firmwares I came across are only able to perform a GET and they append credentials as a query parameter, so a PUT is kind of out of the question.

I'm not seeking to change the existing API. I think it is quite well designed. I was trying to suggest an alternative, single route GET API to perform IP updates only.

I will explore a bit further. Thanks!

yodax commented 8 months ago

You can have a look here: https://github.com/yodax/mailinabox/blob/737a7425331890b9293cb7250db327546228fd94/conf/nginx-primaryonly.conf#L17

this proxies the put to a get so I can use it with pfsense

bilogic commented 8 months ago

@yodax

From the looks of it, you have to rebase your code each time MIAB updates? I'm actually looking for a "nice" way to enhance MIAB without having to rebase each time there is a new release.

yodax commented 8 months ago

That’s certainly true.

bilogic commented 8 months ago

I admire your effort. This repo wasn't open to accepting your PR?

yodax commented 8 months ago

This wasn’t my work, I used someone else's code.

I don’t consider this merge worthy since it’s only for dyndns. I much rather see one of the dyndns rfc’s implemented. This works with a cobbled together pfsense integration so I’m happy.