root/lib/cyborghood-mapmaker/dnssec/opendnssec.rb @ 3cdff641
90197e7b | Marc Dequènes (Duck) | #--
|
|
# CyborgHood, a distributed system management software.
|
|||
# Copyright (c) 2009-2010 Marc Dequènes (Duck) <Duck@DuckCorp.org>
|
|||
#
|
|||
# This program is free software: you can redistribute it and/or modify
|
|||
# it under the terms of the GNU General Public License as published by
|
|||
# the Free Software Foundation, either version 3 of the License, or
|
|||
# (at your option) any later version.
|
|||
#
|
|||
# This program is distributed in the hope that it will be useful,
|
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
# GNU General Public License for more details.
|
|||
#
|
|||
# You should have received a copy of the GNU General Public License
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#++
|
|||
require 'cyborghood-mapmaker/dnssec/base'
|
|||
require "rexml/document"
|
|||
module CyborgHood
|
|||
module MapMakerLand
|
|||
class DNSSEC < DNSSECBase
|
|||
protected
|
|||
def fetch_zone_list
|
|||
output = []
|
|||
begin
|
|||
IO.popen("sudo ods-control ksm zonelist export 2>/dev/null") do |fp|
|
|||
output << fp.gets.chomp! until fp.eof?
|
|||
end
|
|||
rescue
|
|||
raise CyberError.new(:unrecoverable, "services/dnssec", "dnssec zone list could not be checked (I/O error)")
|
|||
end
|
|||
@zone_list = {}
|
|||
doc = REXML::Document.new(output.join("\n"))
|
|||
doc.elements.each('ZoneList/Zone') do |e|
|
|||
zone_name = e.attributes['name']
|
|||
@zone_list[zone_name] =
|
|||
DNSSECZone.new(@config, zone_name,
|
|||
e.elements['Adapters/Input/File'].text,
|
|||
e.elements['Adapters/Output/File'].text,
|
|||
{ :policy => e.elements['Policy'] })
|
|||
end
|
|||
end
|
|||
end
|
|||
class DNSSECZone < DNSSECZoneBase
|
|||
def resign
|
|||
system "sudo ods-control signer sign '#{@name}' >/dev/null"
|
|||
raise CyberError.new(:unrecoverable, "services/dnssec", "zone resign failed") unless $?.success?
|
|||
end
|
|||
end
|
|||
end # MapMakerLand
|
|||
end
|