Last active
April 11, 2018 07:56
-
-
Save avigail-oron/fa89899b9aeb048c76ad9fb73c4a4335 to your computer and use it in GitHub Desktop.
Installing AtomiaDNS API server & web UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//On an ubuntu machine (I used 16.04) | |
//On TRUSTED machine: | |
//=================== | |
//Install AtomiaDNS API server | |
//----------------------------- | |
sudo su | |
repo="$(wget -q -O - http://public.apt.atomia.com/setup.sh.shtml | sed s/%distcode/`lsb_release -c | awk '{ print $2 }'`/g)"; echo "$repo" | |
echo "$repo" | sh | |
apt-get install atomiadns-masterserver | |
//When asked if to replace the '/etc/atomiadns.conf file, press ENTER, which is to keep the current version | |
//Edit /etc/atomiadns.conf, add the following lines: | |
soap_uri = http://localhost/atomiadns | |
soap_username = [email protected] | |
soap_password = 1234 | |
//Start the apache server: | |
apache2ctl graceful | |
//Verify the apache2 process is running and listening on port 80 | |
// Generate DNSSEC keys | |
//---------------------- | |
//Install the command line client: | |
apt-get install atomiadns-client/etc/default/rng-tools | |
//The following steps are for testing env ONLY! in production real random generator must be used | |
apt-get install rng-tools | |
//edit /etc/default/rng-tools and add the following line: | |
HRNGDEVICE = /dev/urandom | |
//Generate KSK, ZSK and inactive ZSK: | |
atomiadnsclient --method AddDNSSECKey --arg RSASHA256 --arg 2048 --arg KSK --arg 1 | |
atomiadnsclient --method AddDNSSECKey --arg RSASHA256 --arg 1024 --arg ZSK --arg 1 | |
atomiadnsclient --method AddDNSSECKey --arg RSASHA256 --arg 1024 --arg ZSK --arg 0 | |
//Installing WebApp (optional) | |
//------------------------------ | |
apt-get install atomiadns-webapp | |
//Create the nameserver group (this will contain later the power dns we'll install on the untrusted area): | |
atomiadnsclient --method AddNameserverGroup --arg default | |
//edit /etc/atomiadns.conf and add the following lines (admin user must be in email format!) | |
require_auth = 1 | |
auth_admin_user = [email protected] | |
auth_admin_pass =1234 | |
webapp_nameservers=ns1.example.com,ns2.example.com | |
//Restart apache | |
apache2ctl graceful | |
//Starting atomia webapp - it was written for ubuntu 14 using upstart, need to convert it to systemd | |
//Add a service file for atomia-web: | |
nano /etc/systemd/system/atomia-web.service | |
//and paste the following contents to it: | |
[Unit] | |
Description=blah, blah, blah | |
[Service] | |
Type=simple | |
# (NOTE: "Type=simple" is the default) | |
ExecStart=/usr/share/atomiadns-web/avig/start-web | |
//Now create the start-web executable file, with the following content: | |
#!/bin/bash | |
node_bin=`whereis -b nodejs | awk '{ print $2 }'` | |
if [ -z "$node_bin" ]; then | |
echo "can't find node binary" | |
exit 1 | |
fi | |
if [ -f "/etc/atomiadns.conf" ]; then | |
init_env=`mktemp` || exit 1 | |
temp_export=`mktemp` || exit 1 | |
grep -E '^(webapp|json)_' /etc/atomiadns.conf | perl -le 'while (<>) { /(.*?)\s*=\s*(.*)$/ && print uc($1) . "=\"" . $2 . "\""; }' > "$init_env" | |
cut -d "=" -f 1 < "$init_env" | xargs echo export > "$temp_export" | |
cat "$temp_export" >> "$init_env" | |
. "$init_env" | |
rm -f "$init_env" "$temp_export" | |
fi | |
exec "$node_bin" /usr/lib/atomiadns/webapp/atomiadns.js >> /var/log/atomiadns_webapp.log 2>&1 | |
//Install perl | |
sudo apt-get install libcgi-session-perl | |
apache2ctl graceful | |
//Start the atomia-web service via Systemd: | |
systemctl start atomia-web | |
//Verify it's active via: | |
systemctl status atomia-web | |
//Add your first user (CURL example). For X-Auth, use the admin username and password set in atomiadns.conf: | |
curl -X POST -d '[ "[email protected]", "avig_password" ]' -H "X-Auth-Username: [email protected]" -H "X-Auth-Password: 1234" http://localhost/pretty/atomiadns.json/AddAccount | |
//Access Atomia web UI via the URL: | |
http://<trusted host name/IP>:5380 | |
//Login using the new user we have added in the curl command | |
//Test by adding zones and retrieving them | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put atomiadns apache conf file in a folder apache includes (make sure extension is correct [e.g. conf-enabled/*.conf]
check perl?