Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISPConfig
Modules
Commits
7442d709
Commit
7442d709
authored
Nov 25, 2022
by
Till Brehm
Browse files
Merge branch 'master' into 'master'
Updated and tested for ISPConfig version: 3.2.8p2 See merge request
!8
parents
06032f89
2aa93e84
Changes
2
Hide whitespace changes
Inline
Side-by-side
dns_slave_auto/README
View file @
7442d709
Author: Florian Schaal, schaal @it
Tim de Boer, tim427
ISPConfig version: 3.1.3
Intitial ISPConfig version: 3.1.3
Updated and tested on ISPConfig version: 3.2.8p2
This addon adds dns-slave-zones on additional servers after creating a dns-zone
This addon adds Secondary DNS-zone on additional servers after creating a DNS-zone
manually or via the wizard, or after updating, or deleting a DNS-zone.
If you managed multiple servers with ISPConfig but did not use the mirror-function,
you can i.e. use server 1 for bind and server 2 as a bind-slave. This plugin
manages the slave-zones on server 2 when you create / change / delete the
...
...
@@ -21,11 +24,11 @@ Usage
Adjust the following settings in /usr/local/ispconfig/interface/lib/plugins/dns_dns_slave_auto_plugin.inc.php
1.
//* define your
dns-ip
(s) that the
slave-
server should accept the data from (same as NS (IP-address) in Secondary DNS Zones)
//* define your
Nameserver IP
(s) that the
Secondary
server should accept the data from (same as NS (IP-address) in Secondary DNS Zones)
$this->nameservers[] = '192.168.0.1';
$this->nameservers[] = 'fe80::2';
If your master-server has only one IP, remove o
ne one the li
ne
s
.
If your master-server has only one IP,
just
remove o
ther lines and keep just o
ne.
2.
//* define the server_ids for slave-server(s) (see server_id in dbispconfig.server on the master)
...
...
@@ -36,3 +39,4 @@ $this->dns_slave_server_id[] = 2;
$this->dns_slave_server_id[] = 12;
$this->dns_slave_server_id[] = 18;
If your have only one slave-server, just remove other lines and keep just one.
\ No newline at end of file
dns_slave_auto/dns_dns_slave_auto_plugin.inc.php
View file @
7442d709
<?php
/*
Copyright (c) 2017, Florian Schaal, schaal @it
Copyright (c) 2022, Tim de Boer, tim427
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -54,7 +55,7 @@ class dns_dns_slave_auto_plugin {
function
slave_insert
(
$event_name
,
$page_form
)
{
global
$app
;
$soa
=
$app
->
db
->
queryOneRecord
(
"SELECT * FROM dns_soa WHERE id = ?"
,
$page_form
->
id
);
$soa
=
$app
->
db
->
queryOneRecord
(
"SELECT * FROM dns_soa WHERE id = ?"
,
is_object
(
$page_form
)
?
$page_form
->
id
:
$page_form
);
$insert_data
=
array
(
'sys_userid'
=>
$soa
[
'sys_userid'
],
'sys_groupid'
=>
$soa
[
'sys_groupid'
],
...
...
@@ -66,6 +67,7 @@ class dns_dns_slave_auto_plugin {
'active'
=>
$soa
[
'active'
],
'xfer'
=>
''
);
foreach
(
$this
->
dns_slave_server_id
as
$slave
)
{
$insert_data
[
'server_id'
]
=
$slave
;
$app
->
db
->
datalogInsert
(
'dns_slave'
,
$insert_data
,
'id'
);
...
...
@@ -75,7 +77,7 @@ class dns_dns_slave_auto_plugin {
function
slave_update
(
$event_name
,
$page_form
)
{
global
$app
;
if
(
$page_form
->
dataRecord
[
'origin'
]
!=
$page_form
->
oldDataRecord
[
'origin'
])
{
if
(
isset
(
$page_form
->
dataRecord
[
'origin'
])
&&
$page_form
->
dataRecord
[
'origin'
]
!=
$page_form
->
oldDataRecord
[
'origin'
])
{
$slave_zone_recs
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM dns_slave WHERE origin = ?"
,
$page_form
->
oldDataRecord
[
'origin'
]);
if
(
!
$slave_zone_recs
)
$this
->
slave_insert
(
$event_name
,
$page_form
);
foreach
(
$slave_zone_recs
as
$slave_zone
)
{
...
...
@@ -83,7 +85,10 @@ class dns_dns_slave_auto_plugin {
$this
->
slave_insert
(
$event_name
,
$page_form
);
}
}
if
(
$page_form
->
dataRecord
[
'active'
]
!=
$page_form
->
oldDataRecord
[
'active'
])
{
if
(
isset
(
$page_form
->
dataRecord
[
'origin'
])
&&
!
isset
(
$page_form
->
dataRecord
[
'active'
]))
{
$page_form
->
dataRecord
[
'active'
]
=
'N'
;
}
if
(
isset
(
$page_form
->
dataRecord
[
'active'
])
&&
$page_form
->
dataRecord
[
'active'
]
!=
$page_form
->
oldDataRecord
[
'active'
])
{
$slave_zone_recs
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM dns_slave WHERE origin = ?"
,
$page_form
->
dataRecord
[
'origin'
]);
if
(
!
$slave_zone_recs
)
$this
->
slave_insert
(
'update_insert'
,
$page_form
);
foreach
(
$slave_zone_recs
as
$slave_zone
)
{
...
...
@@ -98,11 +103,10 @@ class dns_dns_slave_auto_plugin {
function
slave_delete
(
$event_name
,
$page_form
)
{
global
$app
;
$slave_zone_recs
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM dns_slave WHERE origin = ?"
,
$page_form
->
dataRecord
[
'origin'
]);
foreach
(
$slave_zone_recs
as
$slave_zone
)
{
$app
->
db
->
datalogDelete
(
'dns_slave'
,
'id'
,
$slave_zone
[
'id'
]);
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment