I'd like to automate some common DNS checks that I do regularly. I do tech support, part of my job being to walk customers through setting up various DNS records, including SPF and DKIM. Most of these customers are small to medium sized businesses. The first part of the call is always me doing some dig commands to see what the name servers are, what their current TXT records are. Then when we're done I check again this time checking their DKIM, two TXT records with two hosts.
So working manually, first I do a couple basic checks:
Then again to check our work, I run through everything we've done.
I don't have any experience with Bash scripting but I think that a Bash script would be the right tool for this job. If it were just a list of commands run on the root domain, it'd be easier but there are host names and so on to insert in front of the domain.
Any ideas and code examples on how to automate this process would be greatly appreciated. By the way, my research into dig has already yielded and improvement. I added +noall +answer to a .digrc file meaning dig now only returns the answer not all the extraneous (to me) information.
Thank you.
Last edited by RudiC; 05-11-2016 at 10:44 AM..
Reason: Changed icode tags to code tags.
Imagine that your script would:
prompt for the domain
execute a couple of dig commands
perhaps (in addition to display) have the computer check the results
Thanks for the response!!
Here's what I have so far. I don't yet know the syntax so I'm just trying to write something that seems reasonable. ---------- Post updated at 07:46 AM ---------- Previous update was at 07:38 AM ----------
Any suggestions on what I should do next? I realize I have to learn Bash script syntax but does the basic logic seem reasonable? I know it's a bit simplistic but I figure I should get something to work for my first script and then add features later...
---------- Post updated at 07:53 AM ---------- Previous update was at 07:46 AM ----------
Wow, actually, my script worked. I'm shocked. It's not fancy but it basically did what i wanted. I have to improve it for sure.
Last edited by RudiC; 05-11-2016 at 11:43 AM..
Reason: Changed icode to code tags.
Probably next steps would be to experiment with what is returned from the dig commands.
For instance, save the return message to a variable.
Then, see if it contains or does not contain an important message.
Finally, based on the "if" statement you just did, you could display either
OK -- full return message here
*ERROR* - unknown ___ -- full return message here
Experiment a little with this.
I know when I was a Sys Admin (long ago), I had many scripts that would run and alert me when an error. In my case, the script would email me when something was wrong.
Probably next steps would be to experiment with what is returned from the dig commands.
For instance, save the return message to a variable.
Then, see if it contains or does not contain an important message.
Finally, based on the "if" statement you just did, you could display either
OK -- full return message here
*ERROR* - unknown ___ -- full return message here
Experiment a little with this.
I know when I was a Sys Admin (long ago), I had many scripts that would run and alert me when an error. In my case, the script would email me when something was wrong.
I get what you're saying now. Sorry for being dense. You're saying that I'd do an "if" statement to process the output, presumably after validating it in some way. It would either succeed or fail. Then I need to have the script tell me what is broken if there's a problem.
I like the idea of it doing some sort of validation and then emailing or otherwise notifying me if there's a problem. I'm not sure what a problem would be I guess an invalid spf record but I'm not yet sure how to check for that.
Your current example is rather simple where you are looking for the result.
I remember looking at sites and also doing repeated PING tests to the site to measure responsiveness. And rather than seeing results from ten PING's, I had a summary message to tell me - for instance "8/10 PING command response <__seconds"
Or, maybe you would do a WHOIS command to the domain, and grep for "STATUS" to make sure the domain is active.
Hi,
We have built a new server (RHEL VM)and added that IP/hostname into dns zone configs file on DNS server (Solaris 10). Reloaded the configuration using
and added nameserver into resolv.conf on client. But when I am trying nslookup, its not getting resolved. The nameserver is not able to... (8 Replies)
Hi ,
I need a script for processing below scenario.
I have to check daily by doing ftp IP to check it is logging or not.
So i want this activity to be automated such that if login succesful i will get "FTP LOGIN SUCCESS" in a log file and if fails i want the error message in the same log... (1 Reply)
Hey Guys,
I'm seeking some assistance in getting this script to run as a cron job for the user oracle.. the script is basically to perform 2 ADRCI checks... see the script below... i'm getting the following error: /export/home/oracle/Daily_Checks/ADRCI_Daily_Checks.sh: syntax error at line 16:... (7 Replies)
I am trying to setup a CentOS 6.2 server that will be doing 3 things DHCP, DNS & Samba for a very small office (2 users). The idea being this will replace a very old Win2k server. The users are all windows based clients so only the server will be Linux based.
I've installed CentOS 6.2 with... (4 Replies)
Hi,
I have a question on how to point the DNS server-1's A-record to second DNS server, which is DNS server-2. So, the computer can access other domain which only listed in the DNS server-2. The scenario is as follow:
http://img689.imageshack.us/img689/6333/12234.png
How to configure this... (4 Replies)
I'd like to get some opnions on choosing DNS server:
Windows DNS vs Linux BIND comparrsion:
1) managment, easy of use
2) Security
3) features
4) peformance
5) ??
I personally prefer Windows DNS server for management, it supports GUI and command line. But I am not sure about security... (2 Replies)
I have a process that I am trying to provide a solution for and have hit a brick wall and would like some pointers in the right direction.
Basically on a daily basis a report is automatically generated in a CSV format (FIRST.CSV) which includes codes and amounts in the following format:
... (6 Replies)
hey guys, how to add soalris box as a microsoft DNS Client ?
and how to register in the microsoft DNS ??
i managed to query from the DNS server after adding /etc/resolve.conf and editing /etc/nsswitch.conf
but i need to register the soalris server (dns Client) into Microsoft DNS automatically.... (3 Replies)