I am undertaking development of an https application (both client and server) which requires that I issue myself a certificate with the domain name of the server. Lets say its test.example.com and I access the server from my browser with https://test.example.com

My development machine sits on my home network, with a dhcp/dns server on another machine which uses dnsmasq. It can be configured to deliver the ip address of my development machine to a dns lookup of test.example.com

BUT. I have a small raspberry pi which I want to hold a copy of this application. When I plug it into my home network my dnsmasq recognises its mac address and allocates it a known ip address.

CAN I configure dnsmasq in anyway (or something else?), so that IF and ONLY IF this machine is plugged in a dns lookup of test.example.com now returns this machines ip address.

NOTE: I am happy to give this domain name a very short TTL to facilitate a quick switch over.

NOTE: I am aware that one approach could be to configure the dns server to always return the ip address of raspberry pi, but put test.example.com in my development machines /etc/hosts file for use only when I want develop locally and manually remove it when I want to use the raspberry pi. I am looking for an automatic solution. (although this will be the fallback if no answer here is forthcoming)

UPDATE: I have come to the conclusion I have asked the wrong question. I think I can achieve what I want by using a certificate with more than one domain name it it. I can then load that single multidomain name certificate in my code and distribute it to both machines. I then just point the browser at the correct machine and it will run the same copy of the code on the machine I want. BUT the code is identical on both machines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.