pax_global_header 0000666 0000000 0000000 00000000064 14001072007 0014501 g ustar 00root root 0000000 0000000 52 comment=e95e401e05ffbbe2ff18dc94117d941a4378e9b1
put-dns-v0.0.2/ 0000775 0000000 0000000 00000000000 14001072007 0013260 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/CONTRIBUTING.md 0000664 0000000 0000000 00000000263 14001072007 0015512 0 ustar 00root root 0000000 0000000 Contributions, particularly of new DNS providers are very welcome. Please ensure that you do not give away your own API key, but, if needed, provide a dummy one under etc/private
put-dns-v0.0.2/LICENSE 0000664 0000000 0000000 00000016743 14001072007 0014300 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
put-dns-v0.0.2/README.md 0000664 0000000 0000000 00000002007 14001072007 0014536 0 ustar 00root root 0000000 0000000 put-dns aims to simplfy the process of adding DNS records for other projects, such as mail servers, which benefit from having MX, SPF, DKIM etc records set up for them.
It is targetted at software being installed in a fairly simple environment, as if the requirement extends to load balancers, sofware being split across multiple hosts and so on, then more detailed design and installation planning will be required.
It does not deal with Dynamic DNS. where a DNS entry, normally a simple A record, must be updated to point to a host on an IP address which changes from time to time, as this field is well covered.
There is one main command
put-dns {dns-record-entry}
where {dns-record-entry} is a single entry in RFC 1034 format.
All the work is done by providers, which are simply scripts which do the real work of updating the external DNS provider used by the computer running put-dns with the DNS entry given in the argumnet.
The default 'none' provider simply appends the entry to a list of entries to be dealt with.
put-dns-v0.0.2/bin/ 0000775 0000000 0000000 00000000000 14001072007 0014030 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/bin/put-dns 0000775 0000000 0000000 00000001133 14001072007 0015346 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Copyright John Lines 2020 LGPL
# Call the appropriate DNS provider to put a DNS record
CONFIG=/etc/put-dns/put-dns.conf
PROVIDER=`crudini --get $CONFIG dns dns_provider`
VERBOSE=0
NO_ACT=0
while [ "$#" -gt 1 ]; do
case "$1" in
-v)
VERBOSE=1
;;
-n)
NO_ACT=1
;;
*)
echo "unknow argument \"$1\""
exit 1
;;
esac
shift
done
RECORD=$1
#LIBDIR=/usr/local/share/put-dns
LIBDIR=/usr/share/put-dns
if [ "$VERBOSE" -eq 1 ]; then
echo "put-dns ($PROVIDER) $RECORD"
fi
if [ "$NO_ACT" -eq 1 ]; then
exit 0
fi
$LIBDIR/$PROVIDER/put-dns "$RECORD"
put-dns-v0.0.2/docs/ 0000775 0000000 0000000 00000000000 14001072007 0014210 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/docs/put-dns.1.md 0000664 0000000 0000000 00000001706 14001072007 0016267 0 ustar 00root root 0000000 0000000 % put-dns(1) put-dns 0.0.1
% John Lines
% January 2021
# NAME
put-dns - Put a DNS record onto an external DNS provider
# SYNOPSIS
**put-dns** [*-v*] [*-n*] "DNS entry"
# DESCRIPTiON
**put-dns** uses the Provider defined in put-dns.conf to create a DNS entry.
## DNS entry
This is a DNS entry in RFC1034 format, this should be of the form
owner type class RDATA
and passed as a single argument to put-dns.
# OPTIONS
**-v**
: Be verbose, say what DNS entry will be sent to which provider
**-n**
: No action - do not actually invoke the provider to add the entry
# EXAMPLES
put-dns \"mail.example.com IN A 10.9.8.7\"
: create a DNS Adress record for mail.example com, pointing to the IP addess 10.9.8.7
# COPYRIGHT
Copyright @ 2021 John Lines. License LGPLv3+: GNU Lesser GPL version 3 or later
This is free software: you are free to change and redistribute it. There is NO WARRENTY, to the extent permitted by law.
put-dns-v0.0.2/etc/ 0000775 0000000 0000000 00000000000 14001072007 0014033 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/etc/private/ 0000775 0000000 0000000 00000000000 14001072007 0015505 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/etc/private/README 0000664 0000000 0000000 00000000131 14001072007 0016360 0 ustar 00root root 0000000 0000000 This directory holds files which should only be readable
by root, such as password files
put-dns-v0.0.2/etc/private/mythic-beasts-api 0000664 0000000 0000000 00000000205 14001072007 0020750 0 ustar 00root root 0000000 0000000 # Replace the login and password with your API key
# and secret
machine api.mythic-beasts.com
login zzzzzzzzz
password asdfasdfasdf
put-dns-v0.0.2/etc/put-dns.conf 0000664 0000000 0000000 00000000262 14001072007 0016274 0 ustar 00root root 0000000 0000000 # Configuration for put-dns
#
# Replace values in this file with your own
#
[main]
host = localhost
domain = localdomain
ipv4 = 127.0.0.1
ipv6 = ::1
[dns]
dns_provider = none
put-dns-v0.0.2/lib/ 0000775 0000000 0000000 00000000000 14001072007 0014026 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/lib/mythicbeasts/ 0000775 0000000 0000000 00000000000 14001072007 0016525 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/lib/mythicbeasts/README 0000664 0000000 0000000 00000000420 14001072007 0017401 0 ustar 00root root 0000000 0000000 Scripts in this direcctory mangage the DNS using the Mythic Beasts
api as described at
https://www.mythic-beasts.com/support/api/dnsv2
and
https://www.mythic-beasts.com/support/api/dnsv2/tutorial
The API information is stored at /etc/put-dns/private/mythic-beasts-api
put-dns-v0.0.2/lib/mythicbeasts/put-dns 0000775 0000000 0000000 00000004616 14001072007 0020054 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl
# Put a DNS record in RFC1035 format
# The script takes a single argument which is a an RFC1034 format DNS entry
#
$debug=0;
die "Wrong number of arguments $#ARGV to put-dns\n" unless $#ARGV==0;
$zone = `crudini --get /etc/put-dns/put-dns.conf main domain`;
chomp($zone);
$record = $ARGV[0];
# print "zone is $zone\n";
# print "record is $record\n";
@elements = split /\s+/, $ARGV[0], 3;
$host = @elements[0];
$type = @elements[1];
$rdata = @elements[2];
# print "rdata is $rdata\n";
if ( $type eq "IN" ) {
# print "type was IN\n";
($type,$rdata) = split /\s+/, @elements[2], 2;
}
# print "host is $host\n";
# print "type is $type\n";
# print "rdata is $rdata\n";
# First special case - put a record into the root of the zone
#
if ( $host eq "@" ) {
# print "put something into the root of the zone\n";
# sanity check - only do this for record types we know
#
if ( $type eq "TXT" ) {
#
#$command = "curl -v --netrc-file /etc/sos/private/mythic-beasts-api -X POST https://api.mythic-beasts.com/dns/v2/zones/$zone/records -d host=@ -d type=TXT -d \"data=$rdata\"";
# Try not putting data in quotes, as it is already quoted
$command = "curl -v --netrc-file /etc/sos/private/mythic-beasts-api -X POST https://api.mythic-beasts.com/dns/v2/zones/$zone/records -d host=@ -d type=TXT -d data=$rdata";
# print "about to do $command\n";
system($command);
} elsif ( $type eq "MX" ) {
# print "about to do an MX record\n";
($priority,$mxdata) = split /\s+/, $rdata, 2;
$command = "curl -v --netrc-file /etc/sos/private/mythic-beasts-api -X POST https://api.mythic-beasts.com/dns/v2/zones/$zone/records -d host=@ -d type=MX -d mx_priority=$priority -d data=$mxdata";
# print "about to do $command\n";
system($command);
} else {
die "unknown type $type attemting to be added to root zone with data $rdata\n";
}
} else {
if ( $type eq "TXT" ) {
#
$command = "echo '$record' | curl -v --netrc-file /etc/sos/private/mythic-beasts-api -X POST --data-binary \@- -H \"Content-Type: text/dns\" https://api.mythic-beasts.com/dns/v2/zones/$zone/records/$host/$type";
print "Put TXT record $record\n for host $host with **$command**\n" if ( $debug);
system($command);
} elsif ( $tyoe eq "SRV" ) {
print "SRV record - not handled yet - data was $rdata\n";
} else {
print "unknown type $type - not handled yet with data $rdata\n";
}
}
put-dns-v0.0.2/lib/name.com/ 0000775 0000000 0000000 00000000000 14001072007 0015523 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/lib/name.com/README 0000664 0000000 0000000 00000000257 14001072007 0016407 0 ustar 00root root 0000000 0000000 Scripts in this direcctory mangage the DNS using the name.com
api as described at
https://name.com/api-docs
The API information is stored at /etc/sos/private/name.com-api
put-dns-v0.0.2/lib/none/ 0000775 0000000 0000000 00000000000 14001072007 0014765 5 ustar 00root root 0000000 0000000 put-dns-v0.0.2/lib/none/README 0000664 0000000 0000000 00000000101 14001072007 0015635 0 ustar 00root root 0000000 0000000 This DNS provider is used if no known DNS provider is available
put-dns-v0.0.2/lib/none/put-dns 0000775 0000000 0000000 00000000151 14001072007 0016302 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Put a DNS record in RFC1035 format
RECORD=$1
echo $RECORD >>/var/lib/put-dns/pending.txt