Changeset 770 for server/fedora/config
- Timestamp:
- Jun 18, 2008, 6:42:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/fedora/config/etc/syslog-ng/d_zroot.pl
r768 r770 5 5 use Sys::Hostname; 6 6 use Time::HiRes qw(ualarm); 7 use File::Temp; 7 8 8 9 our $ZCLASS = "scripts-auto"; … … 22 23 23 24 my %toclass; 25 26 my %sshkeys; 27 28 sub buildKeyMap($) { 29 my ($file) = @_; 30 open (KEYS, $file) or warn "Couldn't open $file: $!"; 31 while (<KEYS>) { 32 chomp; 33 my ($fingerprint, $comment) = parseKey($_); 34 $sshkeys{$fingerprint} = $comment; 35 } 36 close(KEYS); 37 } 38 39 sub parseKey($) { 40 my ($key) = @_; 41 my $tmp = new File::Temp; 42 print $tmp $key; 43 close $tmp; 44 open (KEYGEN, "-|", qw(/usr/bin/ssh-keygen -l -f), $tmp) or die "Couldn't call ssh-keygen: $!"; 45 my ($line) = <KEYGEN>; 46 close(KEYGEN); 47 my (undef, $fingerprint, undef) = split(' ', $line, 3); 48 my (undef, undef, $comment) = split(' ', $key, 3); 49 print "$fingerprint $comment"; 50 return ($fingerprint, $comment); 51 } 52 53 buildKeyMap("/root/.ssh/authorized_keys2"); 24 54 25 55 while (1) { … … 47 77 } elsif ($message =~ m|session \S+ for user (\S+)|) { 48 78 sendmsg($message) if exists $USERS{$1}; 79 } elsif ($message =~ m|^Found matching (\w+) key: (\S+)|) { 80 if ($sshkeys{$2}) { 81 sendmsg($message." (".$sshkeys{$2}.")"); 82 } else { 83 sendmsg($message." (UNKNOWN KEY)"); 84 } 49 85 } elsif ($message =~ m|^Connection closed|) { 50 86 # Do nothing 87 } elsif ($message =~ m|^Closing connection to |) { 88 } elsif ($message =~ m|^Connection from (\S+) port (\S+)|) { 51 89 } elsif ($message =~ m|^Invalid user|) { 52 90 } elsif ($message =~ m|^input_userauth_request: invalid user|) { … … 59 97 } elsif ($message =~ m|^Postponed keyboard-interactive for invalid user |) { 60 98 } elsif ($message =~ m|^Failed keyboard-interactive/pam for invalid user |) { 99 } elsif ($message =~ m|^Postponed gssapi-with-mic for |) { 61 100 } elsif ($message =~ m|^Address \S+ maps to \S+, but this does not map back to the address|) { 62 101 } else { 63 #sendmsg($message, "scripts-spew");102 sendmsg($message, "scripts-spew"); 64 103 } 65 104 }
Note: See TracChangeset
for help on using the changeset viewer.