Last change
on this file since 1659 was
1225,
checked in by nanardon, 11 years ago
|
Add ssh fp support
This patch add support for SSH finger print DNS support. Nethost have now an
sshfp attribute to hold fingerprint. The fingerprint are added into DNS zones
This patch also make 'checkzone' test optional and not enable by default.
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use LATMOS::Accounts; |
---|
6 | use Getopt::Long; |
---|
7 | use Pod::Usage; |
---|
8 | |
---|
9 | =head1 NAME |
---|
10 | |
---|
11 | la-sql-updsshfp - Update ssh finger print from ssh-keygen output |
---|
12 | |
---|
13 | =head1 SYNOPSIS |
---|
14 | |
---|
15 | la-sql-updsshfp host |
---|
16 | |
---|
17 | la-sql-updsshfp host -f file |
---|
18 | |
---|
19 | =cut |
---|
20 | |
---|
21 | GetOptions( |
---|
22 | 'c|config=s' => \my $config, |
---|
23 | 'b|base=s' => \my $base, |
---|
24 | 'f|file=s' => \my $file, |
---|
25 | 'help' => sub { pod2usage(0) }, |
---|
26 | ) or pod2usage(); |
---|
27 | |
---|
28 | =head1 OPTIONS |
---|
29 | |
---|
30 | =over 4 |
---|
31 | |
---|
32 | =item -c|--config configdir |
---|
33 | |
---|
34 | Use this configuration directory instead of the default one. |
---|
35 | |
---|
36 | =item -b|--base basename |
---|
37 | |
---|
38 | Query this specific base instead of the default one. |
---|
39 | |
---|
40 | =item -f|--file file |
---|
41 | |
---|
42 | Specify the file containing the ssh-keygen output. By default data are read from |
---|
43 | standard input. |
---|
44 | |
---|
45 | =back |
---|
46 | |
---|
47 | =cut |
---|
48 | |
---|
49 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
50 | my $labase = $LA->base($base); |
---|
51 | $labase && $labase->load or die "Cannot load base"; |
---|
52 | |
---|
53 | $labase->unexported(1); |
---|
54 | |
---|
55 | my $host = $ARGV[0]; |
---|
56 | |
---|
57 | my $object = $labase->get_object('nethost', $host) or die |
---|
58 | "Can't find nethost $host\n"; |
---|
59 | |
---|
60 | my $text = ''; |
---|
61 | while (my $line = <STDIN>) { |
---|
62 | $text .= $line; |
---|
63 | } |
---|
64 | |
---|
65 | $object->set_fields('sshfpUpdate', $text) or die "Can update base\n"; |
---|
66 | |
---|
67 | $labase->commit; |
---|
68 | |
---|
69 | print "Done\n"; |
---|
Note: See
TracBrowser
for help on using the repository browser.