Page 1 of 23 12311 ... LastLast
Results 1 to 20 of 459

Thread: DirectSlave - solution to add and remove zones on slave without DirectAdmin

  1. #1
    Join Date
    May 2005
    Location
    Ukraine, Kiev
    Posts
    101

    DirectSlave - solution to add and remove zones on slave without DirectAdmin

    For new DirectSlave/GO 3 public beta see this thread -- https://forum.directadmin.com/showthread.php?t=54992

    Benefits:
    + listen to tcp 2222 and imitates DirectAdmin /CMD_API_DNS_ADMIN (port can be changed in config)
    + SSL to secure parameters transferred from your DirectAdmin servers to DirectSlave server
    + acts as daemon with given uid/gid (bind (53), for example) for security & access to named.conf reason (named.conf is not system named.conf, just include from it)
    + no need for rsh/rsync
    + configurable via single config file (uid gid logs and many other things)
    + can serve parallel requests from as many servers, as you want
    + acts as normal secondary mode (just write named.conf entry for zone)
    + multiuser access. One server - one user. Strict permission check - no adding existing domains, nor remove unowned domains.

    Limitations:
    - old good perl, needs for CPAN-installed modules

    Tested on FreeBSD and Ubuntu 12.04.

    Do not forget to read README and UPDATING.

    Downloads:

    http://regme.in/download/directslave-1.3.tar.gz - version 1.3 - stable single-account version
    http://regme.in/download/directslave-2.1-beta.tar.gz - version 2.1 - new version with multiuser & SSL features

    DirectSlave is uncommercial, distributed absolutely free of charge, open-source project. Try it, test it, enjoy it ;-)
    Last edited by roman_m; 06-27-2017 at 04:00 AM. Reason: New version available
    For donations:
    skrill.com ID 75252920

  2. #2
    Join Date
    Feb 2010
    Location
    The Netherlands
    Posts
    37
    Looks interesting!

    Will give this a try on CentOS / Scientific Linux in a few weeks.

  3. #3
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    6,641
    Already tested and in testing, work perfectly.

    Some hints ive alread told via email to Roman for some features like multiple accounts.

    Regards
    SeLLeRoNe - Andrea Iannucci
    DevOps Engineer - System Administrator
    If you need my support write me an E-Mail to Support@CrazyNetwork.it

  4. #4
    Join Date
    Aug 2008
    Posts
    4,697
    Why would you need multiple accounts if its just slave dns?

  5. #5
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    6,641
    Cause you can offer service to other and create a user for customer without share main password, or just for have different access for each server so if a single password/server got hacked there is no need to change to each server.

    I hope ive well understand the meaning of this.

    Regards
    SeLLeRoNe - Andrea Iannucci
    DevOps Engineer - System Administrator
    If you need my support write me an E-Mail to Support@CrazyNetwork.it

  6. #6
    Join Date
    May 2008
    Location
    The Netherlands
    Posts
    1,156
    Looks good. It's quite the readme you got there, but it's good to have everything explained. I see the auth user:encryptedpassword format, can you list it like that for multiple users?
    I'll give it all a try later.

  7. #7
    Join Date
    May 2005
    Location
    Ukraine, Kiev
    Posts
    101
    Quote Originally Posted by Arieh View Post
    Looks good. It's quite the readme you got there, but it's good to have everything explained. I see the auth user:encryptedpassword format, can you list it like that for multiple users?
    I'll give it all a try later.
    There is no way to set multiple user entries at this time, just one. I'll work on this later (thanx SeLLeRoNe
    For donations:
    skrill.com ID 75252920

  8. #8
    Join Date
    Jan 2007
    Posts
    32
    wow this looks very cool.
    I will going to test this later this year and if it works stable i will switch my powerdns server to this.

  9. #9
    Join Date
    May 2005
    Location
    Ukraine, Kiev
    Posts
    101
    It works stable and fast, just fine for my 15 master servers with over of 100K zone config files.
    For donations:
    skrill.com ID 75252920

  10. #10
    Join Date
    Jun 2003
    Location
    California
    Posts
    26,123
    Are you going to add SeLLeRoNe's suggestione?

    Jeff
    +1 951 643-5345
    Third-Party DirectAdmin administration and support
    Dedicated Servers, Dedicated Reseller Accounts
    NoBaloney Internet Services div. Qnito Incorporated
    848 North Rainbow Blvd., Suite #3789
    Las Vegas, NV 89107-1103

  11. #11
    Join Date
    Jun 2003
    Location
    on the net!
    Posts
    89
    I tried this today,
    Although your README file is quite explains everything I need to try and test myself on how things must done on my ubuntu testbed.
    but at the end it works as expected!
    Thank you very much for this nice code.
    I will try to make my test setup die/crash now.
    Let's see how it goes.
    http://www.youripaddy.com/
    What is your ip address?

  12. #12
    Join Date
    Sep 2012
    Posts
    6
    Hi all

    First, thank's for directslave, it's perfect

    But I have a little problem with named.conf write.

    When I create a domain on my first server, the command is correctly received by the second server but I have an error when the directslave file is running.

    There is my error.log:

    Use of uninitialized value in length at /usr/local/directslave/bin/directslave line 108.
    Use of uninitialized value in length at /usr/local/directslave/bin/directslave line 108.
    flock() on closed filehandle SEC at /usr/local/directslave/bin/directslave line 177.
    print() on closed filehandle SEC at /usr/local/directslave/bin/directslave line 178.
    flock() on closed filehandle LOG at /usr/local/directslave/bin/directslave line 229.
    printf() on closed filehandle LOG at /usr/local/directslave/bin/directslave line 230.

    My systeme is on Debian Squeeze and it is updated.. I'm not a perl dev so I can't resolve this problem by myself.

    I have search on google but I have'nt found anything.

    Thank's

  13. #13
    Join Date
    May 2005
    Location
    Ukraine, Kiev
    Posts
    101
    This happens because CGI did not receive correct
    Turn on debug in directslave.conf and restart the daemon, then look for the explanation of the error in /usr/local/directslave/log/error.log

    Remember, you need my patched CGI.pm located in lib directory for correct data processing since directadmin generates plain-text POST request.

    Can you post your config to this thread or message me locally.
    For donations:
    skrill.com ID 75252920

  14. #14
    Join Date
    Sep 2012
    Posts
    6
    Hello,

    First, where do I put the CGI.pm file?

    Code:
    find / -name CGI.pm -print 2>/dev/null
    says:

    Code:
    /root/.cpan/build/CGI.pm-3.60-EU0zgA/blib/lib/CGI.pm
    /root/.cpan/build/CGI.pm-3.60-EU0zgA/lib/CGI.pm
    /root/.cpan/build/CGI.pm-3.60-N5muZB/blib/lib/CGI.pm
    /root/.cpan/build/CGI.pm-3.60-N5muZB/lib/CGI.pm
    /root/.cpan/build/CGI.pm-3.60-DgEMNS/blib/lib/CGI.pm
    /root/.cpan/build/CGI.pm-3.60-DgEMNS/lib/CGI.pm
    /usr/local/share/perl/5.10.1/CGI.pm
    /usr/local/lib/perl/5.10.1/CGI.pm
    /usr/share/perl/5.10.1/CGI.pm
    /usr/lib/perl/5.10.1/CGI.pm
    /usr/lib/perl5/CGI.pm
    it is good?

    Then, there is my error log with "background 1" and "debug 1":

    Code:
    SERVER OPTIONS: $VAR1 = bless( {
                     'server' => {
                                   'peername' => '',
                                   'sockport' => 2222,
                                   'conf_file' => undef,
                                   'chown_files' => [
                                                      '/usr/local/directslave/log/error.log',
                                                      '/usr/local/directslave/log/access.log'
                                                    ],
                                   'timeout_header' => 15,
                                   'reverse_lookups' => undef,
                                   'setsid' => undef,
                                   'peerport' => 33618,
                                   'pid_file' => '/usr/local/directslave/run/directslave.pid',
                                   'listen' => undef,
                                   'access_log_file' => '/usr/local/directslave/log/access.log',
                                   'access_log_format' => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"',
                                   '_bind' => [
                                                {
                                                  'proto' => 'tcp',
                                                  'ipv' => 4,
                                                  'port' => '2222',
                                                  'host' => '0.0.0.0'
                                                }
                                              ],
                                   'user' => 103,
                                   'server_type' => [
                                                      'Fork'
                                                    ],
                                   'ipv' => [],
                                   'proto' => [],
                                   'chroot' => undef,
                                   'deny' => [],
                                   'tied_stdout_callback' => sub { "DUMMY" },
                                   'port' => [
                                               '2222'
                                             ],
                                   'no_client_stdout' => undef,
                                   'check_for_dead' => 60,
                                   'server_revision' => 'DirectSlave/1.2',
                                   'cidr_deny' => [],
                                   'access_log_function' => sub { "DUMMY" },
                                   'pid_file_unlink' => 1,
                                   'cidr_allow' => [
                                                     '0.0.0.0/0'
                                                   ],
                                   'enable_dispatch' => undef,
                                   'check_for_dequeue' => undef,
                                   'max_servers' => 256,
                                   'group' => '107 107',
                                   'leave_children_open_on_hup' => undef,
                                   'log_level' => 2,
                                   'tie_client_stdout' => 1,
                                   'select' => bless( [
                                                        ' ',
                                                        1,
                                                        undef,
                                                        undef,
                                                        undef,
                                                        undef,
                                                        undef,
                                                        bless( \*Symbol::GEN0, 'Net::Server::Proto::TCP' )
                                                      ], 'IO::Select' ),
                                   'sock' => [
                                               undef
                                             ],
                                   '_run_args' => [
                                                    'min_spare_servers',
                                                    undef,
                                                    'spare_servers',
                                                    undef
                                                  ],
                                   'multi_port' => 1,
                                   'requests' => 1,
                                   'background' => 1,
                                   'sig_passthrough' => [],
                                   'peeraddr' => '37.bb.cc.dd',
                                   'log_file' => '/usr/local/directslave/log/error.log',
                                   'host' => [
                                               '*'
                                             ],
                                   'client' => bless( \*Symbol::GEN5, 'Net::Server::Proto::TCP' ),
                                   'sockaddr' => '37.bbb.ccc.ddd',
                                   'ppid' => 2037,
                                   'max_dequeue' => undef,
                                   'timeout_idle' => 60,
                                   'no_close_by_child' => undef,
                                   'allow' => [],
                                   'tied_stdin_callback' => undef,
                                   'commandline' => [
                                                      '/usr/bin/perl',
                                                      '/usr/local/directslave/bin/directslave'
                                                    ],
                                   'max_header_size' => 100000
                                 },
                     'request_info' => {
                                         'request_headers' => [
                                                                [
                                                                  'Authorization',
                                                                  'Basic ****************************************'
                                                                ],
                                                                [
                                                                  'Host',
                                                                  '37.bbb.ccc.ddd'
                                                                ]
                                                              ],
                                         'request' => 'GET /CMD_API_DNS_ADMIN?action=exists&domain=bistocraft.fr HTTP/1.0',
                                         'sockport' => 2222,
                                         'query_string' => '?action=exists&domain=bistocraft.fr',
                                         'request_method' => 'GET',
                                         'peerport' => 33618,
                                         'peeraddr' => '37.bb.cc.dd',
                                         'remote_user' => '-',
                                         'request_size' => 0,
                                         'sockaddr' => '37.bbb.ccc.ddd',
                                         'peerhost' => '37.bb.cc.dd',
                                         'request_header_size' => 146,
                                         'begin' => '1349913140.03209',
                                         'request_path' => '/CMD_API_DNS_ADMIN',
                                         'request_protocol' => 'http'
                                       }
                   }, 'main' );
    CGI QUERY: $VAR1 = bless( {
                     '.parameters' => [
                                        'action',
                                        'domain'
                                      ],
                     'use_tempfile' => 1,
                     '.charset' => 'ISO-8859-1',
                     '.fieldnames' => {},
                     'param' => {
                                  'domain' => [
                                                'bistocraft.fr'
                                              ],
                                  'action' => [
                                                'exists'
                                              ]
                                },
                     'escape' => 1
                   }, 'CGI' );
    Checking credentials: received admin:$1$************************** vs admin:$1$**************************
    Use of uninitialized value in length at /usr/local/directslave/bin/directslave line 109.
    SERVER OPTIONS: $VAR1 = bless( {
                     'server' => {
                                   'peername' => '',
                                   'sockport' => 2222,
                                   'conf_file' => undef,
                                   'chown_files' => [
                                                      '/usr/local/directslave/log/error.log',
                                                      '/usr/local/directslave/log/access.log'
                                                    ],
                                   'timeout_header' => 15,
                                   'reverse_lookups' => undef,
                                   'setsid' => undef,
                                   'peerport' => 43692,
                                   'pid_file' => '/usr/local/directslave/run/directslave.pid',
                                   'listen' => undef,
                                   'access_log_file' => '/usr/local/directslave/log/access.log',
                                   'access_log_format' => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"',
                                   '_bind' => [
                                                {
                                                  'proto' => 'tcp',
                                                  'ipv' => 4,
                                                  'port' => '2222',
                                                  'host' => '0.0.0.0'
                                                }
                                              ],
                                   'user' => 103,
                                   'server_type' => [
                                                      'Fork'
                                                    ],
                                   'ipv' => [],
                                   'proto' => [],
                                   'chroot' => undef,
                                   'deny' => [],
                                   'tied_stdout_callback' => sub { "DUMMY" },
                                   'port' => [
                                               '2222'
                                             ],
                                   'no_client_stdout' => undef,
                                   'check_for_dead' => 60,
                                   'server_revision' => 'DirectSlave/1.2',
                                   'cidr_deny' => [],
                                   'access_log_function' => sub { "DUMMY" },
                                   'pid_file_unlink' => 1,
                                   'cidr_allow' => [
                                                     '0.0.0.0/0'
                                                   ],
                                   'enable_dispatch' => undef,
                                   'check_for_dequeue' => undef,
                                   'max_servers' => 256,
                                   'group' => '107 107',
                                   'leave_children_open_on_hup' => undef,
                                   'log_level' => 2,
                                   'tie_client_stdout' => 1,
                                   'select' => bless( [
                                                        ' ',
                                                        1,
                                                        undef,
                                                        undef,
                                                        undef,
                                                        undef,
                                                        undef,
                                                        bless( \*Symbol::GEN0, 'Net::Server::Proto::TCP' )
                                                      ], 'IO::Select' ),
                                   'sock' => [
                                               undef
                                             ],
                                   '_run_args' => [
                                                    'min_spare_servers',
                                                    undef,
                                                    'spare_servers',
                                                    undef
                                                  ],
                                   'multi_port' => 1,
                                   'requests' => 1,
                                   'background' => 1,
                                   'sig_passthrough' => [],
                                   'peeraddr' => '37.bb.cc.dd',
                                   'log_file' => '/usr/local/directslave/log/error.log',
                                   'host' => [
                                               '*'
                                             ],
                                   'client' => bless( \*Symbol::GEN6, 'Net::Server::Proto::TCP' ),
                                   'sockaddr' => '37.bbb.ccc.ddd',
                                   'ppid' => 2037,
                                   'max_dequeue' => undef,
                                   'timeout_idle' => 60,
                                   'no_close_by_child' => undef,
                                   'allow' => [],
                                   'tied_stdin_callback' => undef,
                                   'commandline' => [
                                                      '/usr/bin/perl',
                                                      '/usr/local/directslave/bin/directslave'
                                                    ],
                                   'max_header_size' => 100000
                                 },
                     'request_info' => {
                                         'request_headers' => [
                                                                [
                                                                  'Authorization',
                                                                  'Basic **************************'
                                                                ],
                                                                [
                                                                  'Content-Length',
                                                                  '807'
                                                                ],
                                                                [
                                                                  'Host',
                                                                  '37.bbb.ccc.ddd'
                                                                ]
                                                              ],
                                         'request' => 'POST /CMD_API_DNS_ADMIN?action=rawsave&domain=bistocraft.fr HTTP/1.0',
                                         'sockport' => 2222,
                                         'query_string' => '?action=rawsave&domain=bistocraft.fr',
                                         'request_method' => 'POST',
                                         'peerport' => 43692,
                                         'peeraddr' => '37.bb.cc.dd',
                                         'remote_user' => '-',
                                         'request_size' => '807',
                                         'sockaddr' => '37.bbb.ccc.ddd',
                                         'peerhost' => '37.bb.cc.dd',
                                         'request_header_size' => 169,
                                         'begin' => '1349913140.43324',
                                         'request_path' => '/CMD_API_DNS_ADMIN',
                                         'request_protocol' => 'http'
                                       }
                   }, 'main' );
    CGI QUERY: $VAR1 = bless( {
                     '.parameters' => [
                                        '
    
    
    
    
    
    
    
    $TTL 14400
    @       IN      SOA     ns1.bistofly.in.      hostmaster.bistocraft.fr. (
                                                    2012101100
                                                    14400
                                                    3600
                                                    1209600
                                                    86400 )
    
    bistocraft.fr.	14400	IN	NS	ns1.bistofly.in.
    bistocraft.fr.	14400	IN	NS	ns2.bistofly.in.
    
    bistocraft.fr.	14400	IN	A	37.bb.cc.dd
    ftp	14400	IN	A	37.bb.cc.dd
    localhost	14400	IN	A	127.0.0.1
    mail	14400	IN	A	37.bb.cc.dd
    pop	14400	IN	A	37.bb.cc.dd
    smtp	14400	IN	A	37.bb.cc.dd
    www	14400	IN	A	37.bb.cc.dd
    
    bistocraft.fr.	14400	IN	MX	10 mail
    
    
    
    bistocraft.fr.	14400	IN	TXT	"v'
                                      ],
                     'use_tempfile' => 1,
                     '.charset' => 'ISO-8859-1',
                     '.fieldnames' => {},
                     'param' => {
                                  '
    
    
    
    
    
    
    
    $TTL 14400
    @       IN      SOA     ns1.bistofly.in.      hostmaster.bistocraft.fr. (
                                                    2012101100
                                                    14400
                                                    3600
                                                    1209600
                                                    86400 )
    
    bistocraft.fr.	14400	IN	NS	ns1.bistofly.in.
    bistocraft.fr.	14400	IN	NS	ns2.bistofly.in.
    
    bistocraft.fr.	14400	IN	A	37.bb.cc.dd
    ftp	14400	IN	A	37.bb.cc.dd
    localhost	14400	IN	A	127.0.0.1
    mail	14400	IN	A	37.bb.cc.dd
    pop	14400	IN	A	37.bb.cc.dd
    smtp	14400	IN	A	37.bb.cc.dd
    www	14400	IN	A	37.bb.cc.dd
    
    bistocraft.fr.	14400	IN	MX	10 mail
    
    
    
    bistocraft.fr.	14400	IN	TXT	"v' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'spf1 a mx ip4:37.bb.cc.dd ~all"
    
    localhost	14400	IN	AAAA	::1
    
    
    '
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ]
                                },
                     'escape' => 1
                   }, 'CGI' );
    Checking credentials: received admin:$1$************************** vs admin:$1$**************************
    Use of uninitialized value in length at /usr/local/directslave/bin/directslave line 109.
    flock() on closed filehandle SEC at /usr/local/directslave/bin/directslave line 178.
    print() on closed filehandle SEC at /usr/local/directslave/bin/directslave line 179.
    flock() on closed filehandle LOG at /usr/local/directslave/bin/directslave line 230.
    printf() on closed filehandle LOG at /usr/local/directslave/bin/directslave line 231.
    Note: "peername" contains strange characters so I delete it.

    And finally, this is my config:

    Code:
    background 	1
    server_type	Fork
    host  		*
    port  		2222
    debug 		1
    
    uid  		bind
    gid 		bind
    
    pid	  	/usr/local/directslave/run/directslave.pid
    access_log	/usr/local/directslave/log/access.log
    error_log	/usr/local/directslave/log/error.log
    action_log	/usr/local/directslave/log/action.log
    
    mode		slave
    named_workdir	/etc/bind/secondary
    named_conf	/etc/bind/secondary/named.conf
    retry_time	1200
    rndc_path	/usr/sbin/rndc
    
    allow		0.0.0.0/0
    
    auth		admin:(crypted)mystronglypassword
    Thank you very much
    Last edited by zEitEr; 10-11-2012 at 01:24 AM. Reason: Removed IPs of the servers and hashes of passwords

  15. #15
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    @Isoka,

    You might need to change your Directadmin and DirectSlave passwords as they were posted in your debug output, and can be easily discovered.
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  16. #16
    Join Date
    Sep 2012
    Posts
    6
    @ zEitEr:

    This is not my really password in debug file, it's just a test pass

  17. #17
    Join Date
    Dec 2007
    Posts
    102
    Quote Originally Posted by Isoka View Post
    Use of uninitialized value in length at /usr/local/directslave/bin/directslave line 109.
    I'm not good with perl but i think to fix this, just need replace string in line 109:
    Code:
    if(length($query->{param}{zone})) {
    to this
    Code:
    if((defined $query->{param}{zone} && length($query->{param}{zone}))) {

  18. #18
    Join Date
    May 2005
    Location
    Ukraine, Kiev
    Posts
    101
    Yep, he can do it, but $zone param initialized from my patched and bundled CGI.pm module.
    I look at find / and there is no CGI.pm in /usr/local/directslave/lib/
    Grab it from original directslave tarball, put into /usr/local/directslave/lib/ folder, then restart directslave and check all the things works right.

    Without my patched CGI.pm directslave was unable to process plain http data sent by DirectAdmin, this feature is not available in standart CGI from cpan or any *nix installation.
    For donations:
    skrill.com ID 75252920

  19. #19
    Join Date
    Dec 2007
    Posts
    102
    About this error
    Quote Originally Posted by Isoka View Post
    Code:
    flock() on closed filehandle SEC at /usr/local/directslave/bin/directslave line 178.
    print() on closed filehandle SEC at /usr/local/directslave/bin/directslave line 179.
    flock() on closed filehandle LOG at /usr/local/directslave/bin/directslave line 230.
    printf() on closed filehandle LOG at /usr/local/directslave/bin/directslave line 231.
    check permission and owner for your /etc/bind/secondary/named.conf
    I have same error but after changing owner to bind (my named.conf owner was root:bind) error is gone.


    Maybe will be good to change:
    Code:
    open(CONF, $config->{named_conf});
    to
    Code:
    open(CONF, $config->{named_conf}) or die ($!);
    So it will print error why DirectSlave can't open named.conf file. Roman, what do you think ?

  20. #20
    Join Date
    Sep 2012
    Posts
    6
    Okaaaay....!

    Don't worry, I'm an idiot...

    I had forgot permission of named.conf...

    I modified the chmod to 775 and.. it works

    named.conf zone was write and.. it's ok

    Thank's a lot for help roman, snk and zEitEr!

Page 1 of 23 12311 ... LastLast

Similar Threads

  1. Replies: 53
    Last Post: 07-19-2016, 01:03 PM
  2. Remove non-local zones from (ex-) slave server
    By avantis in forum DirectAdmin General Discussion
    Replies: 2
    Last Post: 10-22-2010, 12:18 PM
  3. Simpliest slave DNS solution - tested.
    By pug123 in forum 3rd Party Software
    Replies: 1
    Last Post: 06-15-2008, 11:14 AM
  4. slave dns zones
    By koos in forum DNS
    Replies: 2
    Last Post: 03-14-2005, 06:26 PM
  5. -- Slave Dns Solution --
    By Maverick in forum DNS
    Replies: 22
    Last Post: 02-02-2005, 04:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •