~ubuntu-branches/ubuntu/trusty/zonecheck/trusty

« back to all changes in this revision

Viewing changes to test/dnssec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Delafond
  • Date: 2010-07-08 12:55:39 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100708125539-gazuzu1eb58l3tot
Tags: 3.0.2-1
* New upstream release (Closes: #587419).
* Updated watch file.
* Bumped up Standards revision.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ZCTEST 1.0
2
 
# $Id: dnssec.rb,v 1.8 2010/06/17 13:49:50 chabannf Exp $
 
2
# $Id: dnssec.rb,v 1.9 2010/06/25 08:41:04 chabannf Exp $
3
3
 
4
4
5
5
# CONTACT     : zonecheck@nic.fr
6
6
# AUTHOR      : Stephane D'Alu <sdalu@nic.fr>
7
7
#
8
8
# CREATED     : 2002/08/02 13:58:17
9
 
# REVISION    : $Revision: 1.8 $ 
10
 
# DATE        : $Date: 2010/06/17 13:49:50 $
 
9
# REVISION    : $Revision: 1.9 $ 
 
10
# DATE        : $Date: 2010/06/25 08:41:04 $
11
11
#
12
12
# CONTRIBUTORS: (see also CREDITS file)
13
13
#
96
96
      end
97
97
      
98
98
      def chk_algorithm(ns,ip)
99
 
        sig = rrsig(ip,"SOA")[0]
 
99
        rrsig(ip,"SOA").each {|sig|
100
100
        if [Dnsruby::Algorithms.RSASHA1,
101
101
            Dnsruby::Algorithms.RSASHA256,
102
102
            Dnsruby::Algorithms.RSASHA512,
104
104
            Dnsruby::Algorithms.DSA,
105
105
            Dnsruby::Algorithms.DSA_NSEC3_SHA1].include?(sig.algorithm)
106
106
          return true
107
 
        else
108
 
          return false
109
107
        end
 
108
        }
 
109
        return {"error" => $mc.get('dnssec:algorithm:unknown')}
110
110
      end
111
111
      
112
112
      def chk_key_length(ns,ip)
170
170
      
171
171
      def chk_soa_rrsig_expiration(ns,ip)
172
172
        sig = rrsig(ip,"SOA")[0]
173
 
    #    puts "","#{Time::now.to_i} < #{(sig.expiration - 0.1 * (sig.expiration - sig.inception))} ?"
174
 
    #    puts "Time : #{Time::now.to_i} ; Exp : #{sig.expiration} ; Inc : #{sig.inception}"
175
173
        return true if Time::now.to_i < sig.expiration - 0.1 * (sig.expiration - sig.inception)
176
174
        { "date" =>  Time.at(sig.expiration) }
177
175
      end