Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Webslice
ISPConfig 3
Commits
cb009ea9
Commit
cb009ea9
authored
9 years ago
by
A. Täffner
Browse files
Options
Downloads
Patches
Plain Diff
first test (proof of concept)
Signing is not working, I need a energy drink to proceed...
parent
b8611ce1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/plugins-available/bind_plugin.inc.php
+20
-13
20 additions, 13 deletions
server/plugins-available/bind_plugin.inc.php
with
20 additions
and
13 deletions
server/plugins-available/bind_plugin.inc.php
+
20
−
13
View file @
cb009ea9
...
...
@@ -86,8 +86,11 @@ class bind_plugin {
//* load the server configuration options
$dns_config
=
$app
->
getconf
->
get_server_config
(
$conf
[
"server_id"
],
'dns'
);
//TODO : change this when distribution information has been integrated into server record
$filespre
=
(
file_exists
(
'/etc/gentoo-release'
))
?
'pri/'
:
'pri.'
;
$domain
=
substr
(
$data
[
'new'
][
'origin'
],
0
,
strlen
(
$data
[
'new'
][
'origin'
])
-
1
);
if
(
!
file_exists
(
$dns_config
[
'bind_zonefiles_dir'
]
.
'/'
.
$domain
))
return
false
;
if
(
!
file_exists
(
$dns_config
[
'bind_zonefiles_dir'
]
.
'/'
.
$
filespre
.
$
domain
))
return
false
;
//* Check Entropy
if
(
file_get_contents
(
'/proc/sys/kernel/random/entropy_avail'
)
<
400
)
{
...
...
@@ -115,7 +118,7 @@ class bind_plugin {
$dnssecdata
.
=
file_get_contents
(
$keyfile
)
.
"
\n\n
"
;
}
$app
->
db
->
query
(
'UPDATE dns_soa SET dnssec_info=\''
.
$dnssecdata
.
'\' WHERE id='
.
$data
[
'new'
][
'id'
]);
$app
->
db
->
query
(
'UPDATE dns_soa SET dnssec_info=\''
.
$dnssecdata
.
'\'
, dnssec_initialized=\'Y\'
WHERE id='
.
$data
[
'new'
][
'id'
]);
}
function
soa_dnssec_update
(
$data
,
$new
=
false
)
{
...
...
@@ -123,14 +126,17 @@ class bind_plugin {
//* Load libraries
$app
->
uses
(
"getconf,tpl"
);
$domain
=
substr
(
$data
[
'new'
][
'origin'
],
0
,
strlen
(
$data
[
'new'
][
'origin'
])
-
1
);
if
(
!
file_exists
(
$dns_config
[
'bind_zonefiles_dir'
]
.
'/'
.
$domain
))
return
false
;
//* load the server configuration options
$dns_config
=
$app
->
getconf
->
get_server_config
(
$conf
[
"server_id"
],
'dns'
);
//* Check Entropy
//TODO : change this when distribution information has been integrated into server record
$filespre
=
(
file_exists
(
'/etc/gentoo-release'
))
?
'pri/'
:
'pri.'
;
$domain
=
substr
(
$data
[
'new'
][
'origin'
],
0
,
strlen
(
$data
[
'new'
][
'origin'
])
-
1
);
if
(
!
file_exists
(
$dns_config
[
'bind_zonefiles_dir'
]
.
'/'
.
$filespre
.
$domain
))
return
false
;
//* Check for available entropy
if
(
file_get_contents
(
'/proc/sys/kernel/random/entropy_avail'
)
<
200
)
{
$app
->
log
(
'DNSSEC ERROR: We are low on entropy. This could cause server script to fail. Please consider installing package haveged.'
,
LOGLEVEL_ERR
);
return
false
;
...
...
@@ -138,15 +144,15 @@ class bind_plugin {
if
(
!
$new
&&
!
file_exists
(
$dns_config
[
'bind_zonefiles_dir'
]
.
'/dsset-'
.
$domain
.
'.'
))
return
$this
->
soa_dnssec_create
(
$data
);
//TODO : change this when distribution information has been integrated into server record
$filespre
=
(
file_exists
(
'/etc/gentoo-release'
))
?
'pri/'
:
'pri.'
;
$dbdata
=
$app
->
db
->
queryOneRecord
(
'SELECT id,serial FROM dns_soa WHERE id='
.
$data
[
'new'
][
'id'
]);
$newserial
=
exec
(
'cd '
.
escapeshellcmd
(
$dns_config
[
'bind_zonefiles_dir'
])
.
';'
.
'/usr/sbin/named-checkzone '
.
escapeshellcmd
(
$domain
)
.
' '
.
escapeshellcmd
(
$dns_config
[
'bind_zonefiles_dir'
])
.
'/'
.
$filespre
.
escapeshellcmd
(
$domain
)
.
' | egrep -ho \'[0-9]{10}\''
);
exec
(
'cd '
.
escapeshellcmd
(
$dns_config
[
'bind_zonefiles_dir'
])
.
';'
.
'/usr/sbin/named-checkzone '
.
escapeshellcmd
(
$domain
)
.
' '
.
escapeshellcmd
(
$dns_config
[
'bind_zonefiles_dir'
])
.
'/'
.
$filespre
.
escapeshellcmd
(
$domain
)
.
' | egrep -ho \'[0-9]{10}\''
,
$serial
,
$retState
);
if
(
$retState
!=
0
)
{
$app
->
log
(
'DNSSEC Error: Error in Zonefile for '
.
$domain
,
LOGLEVEL_ERR
);
return
false
;
}
opendir
(
$dns_config
[
'bind_zonefiles_dir'
]);
$includeline
=
array
();
$zonefile
=
file_get_contents
(
escapeshellcmd
(
$dns_config
[
'bind_zonefiles_dir'
])
.
'/'
.
$filespre
.
escapeshellcmd
(
$domain
));
$keycount
=
0
;
foreach
(
glob
(
'K'
.
$domain
.
'*.key'
)
as
$keyfile
)
{
...
...
@@ -157,8 +163,9 @@ class bind_plugin {
if
(
$keycount
>
2
)
$app
->
log
(
'DNSSEC Warning: There are more than 2 keyfiles for zone '
.
$domain
,
LOGLEVEL_WARN
);
file_put_contents
(
$dns_config
[
'bind_zonefiles_dir'
]
.
'/'
.
$filespre
.
$domain
,
$zonefile
);
//Sign the zone and set it valid for max. 16 days
exec
(
'cd '
.
escapeshellcmd
(
$dns_config
[
'bind_zonefiles_dir'
])
.
';'
.
'/usr/sbin/dnssec-signzone -A -3 $(head -c 1000 /dev/random | sha1sum | cut -b 1-16) -N increment -o '
.
escapeshellcmd
(
$domain
)
.
' -t '
.
$filespre
.
escapeshellcmd
(
$domain
));
'/usr/sbin/dnssec-signzone -A
-e +1382400
-3 $(head -c 1000 /dev/random | sha1sum | cut -b 1-16) -N increment -o '
.
escapeshellcmd
(
$domain
)
.
' -t '
.
$filespre
.
escapeshellcmd
(
$domain
));
}
function
soa_insert
(
$event_name
,
$data
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment