sks-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sks-devel] Quickie Script to Check your status in the pool


From: Todd Lyons
Subject: [Sks-devel] Quickie Script to Check your status in the pool
Date: Sat, 5 Oct 2013 14:30:01 -0700
User-agent: Mutt/1.5.20 (2009-12-10)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey all, if you're like me, you are curious what pools you might be
serving data for at any given point in time. The status page at
http://www.sks-keyservers.net/status/ tells you what it thinks of your
keyserver, but it doesn't tell you all of the pools you're in. This
quickie script rolls through all of the pools looking for you and
presents a summary. You can pass the resolver you want it to use on the
commandline or it will just default to the Google public resolver.

Example usage:
$ ./check_for_pool.pl 
2001:470:d:367::555
   + ha.pool.sks-keyservers.net
   + hkps.pool.sks-keyservers.net
   + oc.pool.sks-keyservers.net
208.89.139.251
   + ha.pool.sks-keyservers.net
   + hkps.pool.sks-keyservers.net
   + oc.pool.sks-keyservers.net
SRV
   + _pgpkey-http._tcp.oc.pool.sks-keyservers.net


#!/usr/bin/perl

use strict;
use warnings;

# User configurable
my $ip       = '208.89.139.251';
my $ip6      = '2001:470:d:367::555';
my $host     = 'sks.mrball.net';
my $resolver = shift() || "8.8.4.4";
my $indent   = "   + ";

# Do the work
my @pools = qw/pool.sks-keyservers.net eu.pool.sks-keyservers.net
               na.pool.sks-keyservers.net oc.pool.sks-keyservers.net
               sa.pool.sks-keyservers.net ipv6.pool.sks-keyservers.net
               ipv4.pool.sks-keyservers.net subset.pool.sks-keyservers.net
               ha.pool.sks-keyservers.net p80.pool.sks-keyservers.net
               hkps.pool.sks-keyservers.net
              /;
my @srvpools = qw/_pgpkey-http._tcp.eu.pool.sks-keyservers.net
                  _pgpkey-http._tcp.na.pool.sks-keyservers.net
                  _pgpkey-http._tcp.oc.pool.sks-keyservers.net
                  _pgpkey-http._tcp.oc.pool.sks-keyservers.net
                 /;
my $match = {};
foreach my $pool (@pools) {
  my @dig = `dig -t any address@hidden $pool`;
  chomp(@dig);
  $match->{$ip}->{$pool}++  if ( grep /\Q$ip\E/, @dig );
  $match->{$ip6}->{$pool}++ if ( grep /\Q$ip6\E/, @dig );
}
# Redundant but present for completeness
foreach my $pool (@srvpools) {
  my @dig = `dig -t srv address@hidden $pool`;
  chomp(@dig);
  $match->{SRV}->{$pool}++  if ( grep /\Q$host\E/, @dig );
}
# Print out the results
foreach my $type (sort keys $match ) {
  if (keys %{$match->{$type}}) {
    print "$type\n$indent" .
          (join "\n$indent", keys %{$match->{$type}}) .
          "\n";
  }
}
- -- 
Regards...              Todd
   A friend of mine was at the military and had to check new recruits for
color-blindness. Only after the 20th color-blind man in a row he realized
for the first time in hist life that it was _him_, being the color-blind.
                                                    --Johannes Schindelin
Linux kernel 2.6.32-279.22.1.el6.x86_64   2 users,  load average: 0.00, 0.00, 
0.00
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAlJQhNgACgkQIBT1264ScBUngwCgizD+/M429tOZoKIrGnZgZZYi
S+oAn0j+q4QGBphYT5DMhW+nzaT96dQA
=ZVj+
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]