DirectSlave/GO 3 - public beta

Updated: 01012021

All:
I found a script that started here on the old version with perl. Originally created by user jordivn on the DirectAdmin forum:https://forum.directadmin.com/showthread.php?t=43924&page=22&p=278112#post278112

I have taken it and modified it to work with GO version. I was able to install a CentOS 7 box all works no issues. If you have another OS you will need to modify the script. It had fail2ban in the old version but many like other options so I removed it. Also SSL is not set automatically you will need to do that manually. Feel free to add to it or modify it. Please report success or failure.

Script now includes:
DirectSlave 3.4.1
Root install check
OS check
ssh port updating. (never want to keep default 22)
Simple Firewalld install and setup (opens DNS and 2222). Does not setup access to ssh port Admin needs to own that.



********************Note this script currently rebuilds the /etc/named.conf on the slave server. Don't run this on a current IN USE slave server. This is mean't for a fresh server.****************************

Please do all the normal admin tasks for setting up a Server E.G. set Timezone, Host File, Hostname, and Swap space before running script.

Run:


Code:
yum install wget -y
cd /root
wget https://raw.githubusercontent.com/bdacus01/directadmin-directslave-install/master/da-slave-install.sh -O da-slave-install.sh
chmod +x da-slave-install.sh

usage <username> <userpass> <master ip>

sh da-slave-install.sh admin C00Lpassword xxx.zzz.ccc.vvv < IP of your Mater DA server

Normal output is

Code:
Saving most outputs to /root/install.log
doing updates and installs
creating user admin and adding to wheel
disable root access to ssh
installing and configuring directslave
Added user admin to authfile.
setting enabled and starting up
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/directslave.service to /etc/systemd/system/directslave.service.
all done!
Once this completes Go setup Multi Server on your DA master with username, password and ip of Slave server.


Troubleshooting here:

simple things can you ping from outside to the box?

did you check if the firewall is on and blocking?

ref if you need it. https://www.rootusers.com/how-to-open-a-port-in-centos-7-with-firewalld/

If you dig on the slave server do you find records?

if you dig on the DA server do you see it in the list?

ref https://www.rootusers.com/12-dig-command-examples-to-query-dns-in-linux/

on the slave if you

Code:
cat /etc/namedb/directslave.inc

do you see zones and their db's listed?

do what do you see?

Code:
cat /etc/named.conf
does all of this look correct?

In there do you see
Code:
include "/etc/namedb/directslave.inc";
at the very bottom

in the options section do you see
Code:
allow-query     { any; };
allow-notify    { your da master ip here; };
allow-transfer    { none; };

@roman_m feel free to include in your first post and or test this out as well. It sort of buried here..
 
Last edited:
All:
Also the above script might not have the hot fix in it found here. https://directslave.com/download

I haven't had a chance to ask the developer if the full package was Patched back. @roman.

I will see if I can pull it in.
 
thanks for your great work, you save my time. using centos 7 its working with some note.

some notes that must be updated

1. script that must be added at the beginning

Code:
if [ -z "$1" ]; then

2. we have to add directslave access manually with

Code:
/usr/local/directslave/bin/directslave --password admin:yourhardtoreadpassword

directslave working fine :)

regards

All:
I found a script that started here on the old version with perl. Originally created by user jordivn on the DirectAdmin forum:
https://forum.directadmin.com/showthread.php?t=43924&page=22&p=278112#post278112

I have taken it and modified it to work with GO version. I was able to install a CentOS 7 box all works no issues. If you have another OS you will need to modify the script. It had fail2ban in the old version but may like other options. Also SSL is not set automatically you will need to do that manually. Feel free to add to it or modify it. Please report success or failure.

Note this script currently rebuilds the /etc/named.conf on the slave server. Don't run this on a current IN USE slave server. This is mean't for a fresh server.

Run:

Code:
cd /root
wget https://raw.githubusercontent.com/bdacus01/directadmin-directslave-install/master/da-slave-install.sh -O da-slave-install.sh
chmod +x da-slave-install.sh

useage <username> <userpass> <master ip>

sh da-slave-install.sh admin C00Lpassweord xxx.zzz.ccc.vvv
^ IP of your Mater DA server

Once this completes Go setup Multi Server with username and ip of Slave server.
 
Thanks Glad it helped.

Would you let me know where you needed to add. Like the section you added it to. Never mind I found it. I will have it fixed today... Thanks for the Report.

Code:
if [ -z "$1" ]; then


also so the password you placed here eg you replaced my example with your password, correct? You are saying that password did not work?

Code:
[COLOR=#333333][I]sh da-slave-install.sh admin C00Lpassweord xxx.zzz.ccc.vvv[/I][/COLOR]

Also did you make note of this post and manually update the tpl file..
https://forum.directadmin.com/showthread.php?t=54992&p=296617#post296617
 
Last edited:
thanks for your great work, you save my time. using centos 7 its working with some note.

some notes that must be updated

1. script that must be added at the beginning

Code:
if [ -z "$1" ]; then

2. we have to add directslave access manually with

Code:
/usr/local/directslave/bin/directslave --password admin:yourhardtoreadpassword

directslave working fine :)

regards
The reported bug has been fixed. Which should make the admin and password all work now..
 
The reported bug has been fixed. Which should make the admin and password all work now..

thanks for your quick update, there may be a typing error in the initial script "useage" should be "usage"

i will try on another dns cluster soon.
 
I trying to install on fresh centos 7 but show error

Code:
[root@dns ~]# sh da-slave-install.sh admin [B]mypassword[/B] [B]myipDA[/B]
Saving most outputs to /root/install.log
doing updates and installs
creating user admin and adding to wheel
disable root access to ssh
installing and configurating directslave
da-slave-install.sh: line 48: allow: command not found
preparing named for jail2ban
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5d7254]

goroutine 1 [running]:
log.(*Logger).Output(0x0, 0x2, 0xc4200860a0, 0x41, 0x0, 0x0)
        /usr/local/go/src/log/log.go:153 +0x54
log.(*Logger).Fatal(0x0, 0xc42003b9c0, 0x1, 0x1)
        /usr/local/go/src/log/log.go:192 +0x6a
main.UpdatePasswordFile()
        /export/store/Project/home/golang/directslave/directslave.go:1882 +0x209
main.RunWithOption(0x7ffd7f35b813, 0xa)
        /export/store/Project/home/golang/directslave/directslave.go:1309 +0x1fe
main.main()
        /export/store/Project/home/golang/directslave/directslave.go:138 +0xda
setting enabled and starting up
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/directslave.service to /etc/systemd/system/directslave.service.
all done!

this has been successful?


All:
I found a script that started here on the old version with perl. Originally created by user jordivn on the DirectAdmin forum:
https://forum.directadmin.com/showthread.php?t=43924&page=22&p=278112#post278112

I have taken it and modified it to work with GO version. I was able to install a CentOS 7 box all works no issues. If you have another OS you will need to modify the script. It had fail2ban in the old version but many like other options so I removed it. Also SSL is not set automatically you will need to do that manually. Feel free to add to it or modify it. Please report success or failure.

Note this script currently rebuilds the /etc/named.conf on the slave server. Don't run this on a current IN USE slave server. This is mean't for a fresh server.

Run:

Code:
cd /root
wget https://raw.githubusercontent.com/bdacus01/directadmin-directslave-install/master/da-slave-install.sh -O da-slave-install.sh
chmod +x da-slave-install.sh

useage <username> <userpass> <master ip>

sh da-slave-install.sh admin C00Lpassweord xxx.zzz.ccc.vvv
^ IP of your Mater DA server

Once this completes Go setup Multi Server with username and ip of Slave server.

Code:
 
thanks for your quick update, there may be a typing error in the initial script "useage" should be "usage"

i will try on another dns cluster soon.

Usage fixed it was in the old script..
 
I trying to install on fresh centos 7 but show error

Code:
[root@dns ~]# sh da-slave-install.sh admin [B]mypassword[/B] [B]myipDA[/B]
Saving most outputs to /root/install.log
doing updates and installs
creating user admin and adding to wheel
disable root access to ssh
installing and configurating directslave
da-slave-install.sh: line 48: allow: command not found
preparing named for jail2ban
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5d7254]

goroutine 1 [running]:
log.(*Logger).Output(0x0, 0x2, 0xc4200860a0, 0x41, 0x0, 0x0)
        /usr/local/go/src/log/log.go:153 +0x54
log.(*Logger).Fatal(0x0, 0xc42003b9c0, 0x1, 0x1)
        /usr/local/go/src/log/log.go:192 +0x6a
main.UpdatePasswordFile()
        /export/store/Project/home/golang/directslave/directslave.go:1882 +0x209
main.RunWithOption(0x7ffd7f35b813, 0xa)
        /export/store/Project/home/golang/directslave/directslave.go:1309 +0x1fe
main.main()
        /export/store/Project/home/golang/directslave/directslave.go:138 +0xda
setting enabled and starting up
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/directslave.service to /etc/systemd/system/directslave.service.
all done!

this has been successful?
yes

Let me go see. also do you see anything in the
/root/install.log
 
Those errors are normal they have to do with the GO program.

once you get to All done

go to http://IP of the server you installed on:2222/login

Test your login

if you have issue logging in use
/usr/local/directslave/bin/directslave --password admin:yourhardtoreadpassword
 
Those errors are normal they have to do with the GO program.

once you get to All done

go to http://IP of the server you installed on:2222/login

Test your login

if you have issue logging in use
/usr/local/directslave/bin/directslave --password admin:yourhardtoreadpassword

It has been synchronized successfully directslave with DA server, but nameservers do not resolve with the domain, on nameserver IP i pointing to IP directslave, is right?
 
All thanks for all the bug reports. I have confirmed the other errors reported were related to creating the Auth file. I have successfully run this fully on a full blank centos 7 box
 
I trying to install on fresh centos 7 but show error

Code:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5d7254]

goroutine 1 [running]:
log.(*Logger).Output(0x0, 0x2, 0xc4200860a0, 0x41, 0x0, 0x0)
        /usr/local/go/src/log/log.go:153 +0x54
log.(*Logger).Fatal(0x0, 0xc42003b9c0, 0x1, 0x1)
        /usr/local/go/src/log/log.go:192 +0x6a
main.UpdatePasswordFile()
        /export/store/Project/home/golang/directslave/directslave.go:1882 +0x209
main.RunWithOption(0x7ffd7f35b813, 0xa)
        /export/store/Project/home/golang/directslave/directslave.go:1309 +0x1fe
main.main()
        /export/store/Project/home/golang/directslave/directslave.go:138 +0xda

this has been successful?

I have confirmed these were error. The script was fixed
 
The DA box's IP is the one you put in the command. its the master DNS server.
Code:
sh da-slave-install.sh admin C00Lpassword xxx.zzz.ccc.vvv  < IP of your Mater DA server

Also on the DA box go to Multiserver and setup the Slave IP (the one you ran my script on) user and password. There is a test connection under where the password goes in DA. Does that come back successful? Green
 
Hi @bdacus01 thanks for your quick update, I try reinstall and working good with a successful message but I'm still confused because the nameservers still don't resolve.
In case I use da.ns1.mydomain.net I point to DA IP (its working) and for da.ns2.mydomain.net point to IP directslave (its not working) when I check on leafdns.com http://prnt.sc/ocy868

what mistakes did happen?

The DA box's IP is the one you put in the command. its the master DNS server.
Code:
sh da-slave-install.sh admin C00Lpassword xxx.zzz.ccc.vvv  < IP of your Mater DA server

Also on the DA box go to Multiserver and setup the Slave IP (the one you ran my script on) user and password. There is a test connection under where the password goes in DA. Does that come back successful? Green
 
simple things can you ping from outside to the box?

did you check if the firewall is on and blocking?

ref if you need it. https://www.rootusers.com/how-to-open-a-port-in-centos-7-with-firewalld/

If you dig on the slave server do you find records?

if you dig on the DA server do you see it in the list?

ref https://www.rootusers.com/12-dig-command-examples-to-query-dns-in-linux/

on the slave if you

Code:
cat /etc/namedb/directslave.inc

do you see zones and their db's listed?

do what do you see?

Code:
cat /etc/named.conf
does all of this look correct?

In there do you see
Code:
include "/etc/namedb/directslave.inc";
at the very bottom

in the options section do you see
Code:
allow-query     { any; };
allow-notify	{ your da master ip here; };
allow-transfer	{ none; };
 
Last edited:
Awesome.. I assume my post will help others.

just a regular guy helping the best he can....
 
Last edited:
invalid $curip

hello,

FYI when hostname not setup correctly, directslave can't running. Hostname value on /usr/local/directslave/etc/directslave.conf filled with 127.0.0.1, its must be manually updated and rerun directslave.

another issue, firewall not add ssh custom port

regards.
 
hostname not setup correctly

Are you saying you did not set up a hostname on the box?
You should for sure do that before you start. All server need hostnames and host files.


firewall not add ssh custom port

Correct it does not. I could add it but I might be best the Admin control outside access to the box.
 
Last edited:
Back
Top