Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o-dns
Commits
5bdcde4a
Commit
5bdcde4a
authored
Dec 27, 2018
by
Maxime Bombar
Browse files
[dnssec_generate] add verbose mode
parent
9f9e950d
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnssec_generate.py
View file @
5bdcde4a
...
...
@@ -4,6 +4,7 @@ import json
import
os
import
re
import
subprocess
import
argparse
path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
...
@@ -13,10 +14,21 @@ try:
except
:
zones
=
[]
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
(
description
=
"Gestion de DNSSEC"
)
parser
.
add_argument
(
'-v'
,
'--verbose'
,
help
=
"Mode verbeux"
,
action
=
"store_true"
)
args
=
parser
.
parse_args
()
verbose
=
args
.
verbose
ds_records
=
{}
for
zone
in
zones
:
cdss
=
subprocess
.
check_output
([
'/usr/sbin/knotc'
,
'zone-read'
,
zone
,
'@'
,
'CDS'
])[:
-
1
].
decode
(
'utf-8'
).
split
(
'
\n
'
)
if
verbose
:
print
(
"Getting CDS of %s:"
%
(
zone
,))
print
(
"/usr/sbin/knotcs zone-read %s @ CDS"
%
(
zone
,))
cdss
=
subprocess
.
check_output
([
'/usr/sbin/knotc'
,
'zone-read'
,
zone
,
'@'
,
'CDS'
])[:
-
1
].
decode
(
'utf-8'
).
split
(
'
\n
'
)
if
verbose
:
print
(
"CDS of %s = %s"
%
(
zone
,
cdss
))
for
cds
in
cdss
:
ds
=
{}
try
:
...
...
@@ -33,5 +45,8 @@ if __name__ == '__main__':
if
not
zone
in
ds_records
:
ds_records
[
zone
]
=
[]
ds_records
[
zone
].
append
(
ds
)
if
verbose
:
print
(
"DS record of %s : %s"
%
(
zone
,
ds
))
print
(
"
\n\n
"
)
with
open
(
'dnssec.json'
,
'w'
)
as
dnssec
:
json
.
dump
(
ds_records
,
dnssec
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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