if merikanto is going to be syncproxy it needs rsync and therefore xinetd
[mirror/dsa-nagios.git] / dsa-nagios-checks / share / weak-ssh-keys-check
index e35a8a1..a9bd752 100755 (executable)
@@ -92,11 +92,13 @@ use IPC::Open3;
 my $fprdb_fname = "/var/lib/dsa/ssh-weak-keys.db" ;
 my ($outfile, $help);
 my $dsa_nowarn = 0;
+my $debian_org = 1;
 
 GetOptions(     'help|h' => \$help, #Help function
                'statusfile|s=s' => \$outfile, 
                'fprdb|f=s' => \$fprdb_fname,
-               'n|dsa_nowarn' => \$dsa_nowarn,  
+               'n|dsa_nowarn' => \$dsa_nowarn,
+               'd|debian-org!' => \$debian_org,
 );
 
 pod2usage(1) if $help;
@@ -123,9 +125,11 @@ my $text = '';
 my %key_sizes;
 
 
-
-#&from_user_all;
-&from_debianorg_places;
+if ($debian_org) {
+       &from_debianorg_places;
+} else {
+       &from_user_all;
+}
 &from_ssh_host(qw(localhost));
 
 my $status="OK";
@@ -198,6 +202,7 @@ sub from_ssh_key_file ($) {
     my $name = shift;
     if (open (my $FH, '<', $name)) {
        my $key = <$FH>; 
+       close($FH);
        if (! defined $key) {
                $weird_keyfiles++;
                $text .= "cannot read $name properly - empty?\n";
@@ -332,7 +337,7 @@ sub from_debianorg_places () {
        for my $file (grep { ! -d $d.'/'.$_ } readdir(D)) {
            next if ($file eq 'README-DSA-BUILDD');
            my $f = $d.'/'.$file;
-           from_ssh_key_file $f if -r $f;
+           from_ssh_auth_file $f if -r $f;
        };
     };
 }