aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Bouchard <louis.bouchard@canonical.com>2013-04-15 15:47:24 +0200
committerLouis Bouchard <louis.bouchard@canonical.com>2013-04-15 15:47:24 +0200
commit028b3fe4f9d800b426e1c7930fdf166e26ca6aef (patch)
tree553e94ba0b47c16d9ad8ed6d48809618d0592eaf
parente7ab7388c4a1764b650868e67a187e60f07ccde3 (diff)
downloadsos-028b3fe4f9d800b426e1c7930fdf166e26ca6aef.tar.gz
Enabled plugin for Ubuntu/Debian
-rw-r--r--sos/plugins/named.py42
1 files changed, 38 insertions, 4 deletions
diff --git a/sos/plugins/named.py b/sos/plugins/named.py
index 83dc6b22..e479b3c9 100644
--- a/sos/plugins/named.py
+++ b/sos/plugins/named.py
@@ -12,16 +12,15 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-from sos.plugins import Plugin, RedHatPlugin
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import commands
from os.path import normpath, join, exists
-class named(Plugin, RedHatPlugin):
+class Named(Plugin):
"""named related information
"""
- files = ('/etc/named.conf', '/etc/sysconfig/named')
- packages = ('bind',)
+ plugin_name = "named"
def get_dns_dir(self, config_file):
""" grab directory path from named{conf,boot}
@@ -32,7 +31,15 @@ class named(Plugin, RedHatPlugin):
else:
return ""
+class RedHatNamed(Named, RedHatPlugin):
+ """named related information for RedHat based distribution
+ """
+
+ files = ('/etc/named.conf', '/etc/sysconfig/named')
+ packages = ('bind',)
+
def setup(self):
+ super(RedHatNamed, self).setup()
config_files = ("/etc/named.conf",
"/etc/named.boot")
for cfg in config_files:
@@ -52,3 +59,30 @@ class named(Plugin, RedHatPlugin):
match = r"(\s*arg \"password )[^\"]*"
subst = r"\1******"
self.do_file_sub("/etc/named.conf", match, subst)
+
+class DebianNamed(Named, DebianPlugin, UbuntuPlugin):
+ """named related information for Debian based distribution
+ """
+
+ files = ('/etc/bind/named.conf')
+ packages = ('bind9',)
+
+ def setup(self):
+ super(DebianNamed, self).setup()
+ config_files = ("/etc/bind/named.conf",
+ "/etc/bind/named.conf.options",
+ "/etc/bind/named.conf.local")
+ for cfg in config_files:
+ if exists(cfg):
+ self.add_copy_spec(cfg)
+ self.add_copy_spec(self.get_dns_dir(cfg))
+ self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/dev"))
+ self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/proc"))
+
+ self.add_copy_spec("/etc/bind/")
+ return
+
+ def postproc(self):
+ match = r"(\s*arg \"password )[^\"]*"
+ subst = r"\1******"
+ self.do_file_sub("/etc/bind/named.conf", match, subst)