Linode Forum Index Linode Forum
Linode Community Forums
 


Auto-import Google Apps MX records

Click here to go to the original topic

 
       Linode Forum Index -> Feature Request/Bug Report
Author Message
GLaDOSDan



Joined: 25 Nov 2010
Posts: 23

Posted: Sat Jan 28, 2012 7:52 pm    Post subject: Auto-import Google Apps MX records  

Title is pretty self-explanitory really, I'm sure most(?) people use Google Apps for email hosting, and a button on the DNS manager to just import those 'default' Google MX records would be wonderful, as they are a hassle to add when setting up a new domain.
Back to top  
ripken204



Joined: 30 Aug 2010
Posts: 24

Posted: Wed Feb 01, 2012 10:49 am    Post subject:  

This is a good idea.
It would be cool if Linode had templates for different things, such as google apps
Select from a list of templates and import the settings into your DNS config

Something similar to what most routers have for port forwarding, you can simply select FTP, SSH, mail, etc
Obviously not for ports though, but it's the same idea
Back to top  
glg



Joined: 09 Jan 2009
Posts: 505

Posted: Wed Feb 01, 2012 6:08 pm    Post subject:  

The problem with this is it could be construed as an endorsement of google apps by linode.

ie, if they did this, they're opening a can of worms for people to want the same for any other service.
Back to top  
bandgeekndb



Joined: 29 Sep 2011
Posts: 8

Posted: Sun Feb 05, 2012 11:22 pm    Post subject:  

I can't imagine it would be too hard for them to have certain DNS records available for pre-population if desired. Making our lives easier is in no way an "endorsement".

I mean, not that I want to compare Linode to DreamHost, but coming from them not too long ago, I know they have a simple option for setting mail to "Google Apps". All it does is pre-populate the MX records for you, and I think adds some default CNAME records as well to help beginners out. They're not endorsing Google Apps, heck, right next to that option is the option for letting DH handle your email. They just realize that a LOT of people like using Google Apps, and have no problem making life easier for the people who do use Google Apps.

If a lot of people wanted another service's DNS records available for pre-population, Linode could just add it to the list and it'd be that simple. But I think the overwhelming argument for the GApps records is because so many people here use them. Time and time again, I hear some of the "pros" here (or at least people who seem to know a heck of a lot about these systems) say that if possible for the situation, go with someone else hosting the mail, specifically Google Apps, because it reduces so many headaches.

TL;DR - I think it's more of an endorsement by the user community than it is by Linode for having those records available for pre-population.
Back to top  
hybinet



Joined: 02 May 2008
Posts: 1058

Posted: Sun Feb 05, 2012 11:47 pm    Post subject:  

Hmm, maybe we could have something like StackScripts for DNS records? That way, users can contribute whatever they need, and there will be no questions about official endorsement of this or that.

For example, an ideal "template" for Google Apps might contain not only MX records but also an appropriate SPF record (include:_spf.google.com) and maybe even DKIM (copy from your GApps control panel and paste into a textbox).

Similarly, we could have templates for other e-mail hosting services (Microsoft, Rackspace, etc), CDNs (CloudFlare, etc), and whatever else usually involves a lot of Ctrl+C Ctrl+V.
Back to top  
bandgeekndb



Joined: 29 Sep 2011
Posts: 8

Posted: Sun Feb 05, 2012 11:53 pm    Post subject:  

Hadn't even thought of a "user-submitted" style like StackScripts! That definitely removes the notion of Linode endorsing anything as well.

Thanks hybinet, for drawing the parallel between what I was getting at and what already exists (and works well)! :)
Back to top  
glg



Joined: 09 Jan 2009
Posts: 505

Posted: Mon Feb 06, 2012 12:27 am    Post subject:  

Here's a start. SPF added from hybinet's post.

First off, get your API Key. Log in to Linode Manager, click on My Profile (top right) and get your key from that page. You'll use that in every command

Run this to get your DNS domain ID. The return is in JSON format, which isn't the easiest thing to read as a human, but it's doable. The return should have an empty ERRORARRAY followed by a DATA section with each domain in curly braces, comma separated. Find the right domain and use its ID for the rest
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.list

If you're not sure if there is an MX record, you can run this one. Return will be similar to the first one, but this time, each resource in curly braces, comma separated
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.list\&domainID="<domain ID>"

If you have an MX and want to delete with API (it's probably easier to skip the last step and this one and just check in the manager and delete by hand), put the resource ID of the MX from the previous into this one:
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.delete\&domainID="<domain ID>"\&resourceID="<resource ID>"

Tun this bunch to add the 5 recommended MX servers (this is the current list as of Feb 2012, if you're finding this thread 5 years from now, you'll probably want to validate this list...). Return should be empty ERRORARRAY and DATA containing the new Resource ID. You should immediately be able to see the new record(s) in linode manager, but remember that the push from manager to DNS is every 15 mins, plus any TTL if you had existing MX records. So, don't be surprised if it takes a day for google to see your MX records.
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="MX"\&target="ASPMX.L.GOOGLE.COM"\&priority="1"
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="MX"\&target="ALT1.ASPMX.L.GOOGLE.COM"\&priority="5"
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="MX"\&target="ALT2.ASPMX.L.GOOGLE.COM"\&priority="5"
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="MX"\&target="ASPMX2.GOOGLEMAIL.COM"\&priority="10"
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="MX"\&target="ASPMX3.GOOGLEMAIL.COM"\&priority="10"

If you want a cname that'll bounce to gmail, then run this one, editing the hostname to whatever you want. Same as last one, return should be empty ERRORARRY and DATA with the new resource ID.
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="CNAME"\&name="<your gmail subdomain, eg mail.yourdomain.com>"\&target="GHS.GOOGLEMAIL.COM"

SPF record. Same returns as previous two.
wget -qO- https://api.linode.com/?api_key="<your api key>"\&api_action=domain.resource.create\&domainID="<domain ID>"\&type="TXT"\&target="v=spf1 a mx include:_spf.google.com ~all"
Back to top  
hybinet



Joined: 02 May 2008
Posts: 1058

Posted: Mon Feb 06, 2012 12:43 am    Post subject:  

glg wrote: (code)
SPF could be added as type="TXT"&target="v=spf1 a mx include:_spf.google.com ~all"

With a little polishing, that could be made into an actual StackScript. Prompt the user for the API key and the domain, ask [y/n] to delete existing MX records, and automate the rest. No need to prompt for domain and resource IDs, since you can get the full list with another API call and look up the ID.

But of course, it would be so much easier to just click something in the DNS manager than to mess with #!/bin/bash.
Back to top  
mnordhoff



Joined: 03 May 2008
Posts: 451

Posted: Mon Feb 06, 2012 6:01 pm    Post subject:  

Linode seems to consider a Google Apps library article appropriate, so also putting something in the DNS manager wouldn't be a stretch.
Back to top  
czhang



Joined: 02 Feb 2012
Posts: 3
Location: Beijing/Toronto/Seattle

Posted: Wed Feb 08, 2012 8:56 pm    Post subject:  

Agree; I use DNS Made Easy for my DNS hosting and there are templates available for Google Apps and other services. I don't quite see how making prepopulated templates would serve as an endorsement of their service. Sounds like a great idea!
Back to top  
Guspaz



Joined: 26 May 2009
Posts: 1150
Location: Montreal, QC

Posted: Thu Feb 09, 2012 10:20 am    Post subject:  

Here's an idea for this sort of stuff: API scripts. Kind of like stack scripts, except they run any time (and on a non-specific linode-run machine). People could write scripts to automate complex tasks and run them through the manager, with a UI like stackscripts have.
Back to top  
GLaDOSDan



Joined: 25 Nov 2010
Posts: 23

Posted: Fri Feb 10, 2012 10:44 pm    Post subject:  

Guspaz wrote: Here's an idea for this sort of stuff: API scripts. Kind of like stack scripts, except they run any time (and on a non-specific linode-run machine). People could write scripts to automate complex tasks and run them through the manager, with a UI like stackscripts have.

That's a great idea.
Back to top  
superfastcars



Joined: 11 Apr 2011
Posts: 39

Posted: Sun Feb 12, 2012 12:59 am    Post subject:  

I've found it much easier to clone a already existing template for my sites. Then all I do is change the TXT SPF/DKIM/Verification strings as necessary.

I thought about setting up my own mail server, but after the random attempts to connect to postfix, I disabled it :P
Back to top  
theckman



Joined: 27 Nov 2010
Posts: 45

Posted: Sun Feb 12, 2012 2:44 am    Post subject: Google Apps Linode DNS Script  

Here you go guys something I (hastily) threw together tonight. The script uses the Linode API to create the records. Should work on any system that has curl installed.

Please note: While this script was written by a Linode employee it is not endorsed nor maintained by Linode. Linode should not be contacted for support using this script or to report any bugs with the script.

- https://github.com/theckman/gapps-linode-dns

Edit: Also allows you to add a default SPF record.
Back to top  
 
       Linode Forum Index -> Feature Request/Bug Report
Page 1 of 1