source: trunk/LATMOS-Accounts/bin/la-sql-updsshfp @ 1907

Last change on this file since 1907 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
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use 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
21GetOptions(
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
34Use this configuration directory instead of the default one.
35
36=item -b|--base basename
37
38Query this specific base instead of the default one.
39
40=item -f|--file file
41
42Specify the file containing the ssh-keygen output. By default data are read from
43standard input.
44
45=back
46
47=cut
48
49my $LA = LATMOS::Accounts->new($config, noacl => 1);
50my $labase = $LA->base($base);
51$labase && $labase->load or die "Cannot load base";
52
53$labase->unexported(1);
54
55my $host = $ARGV[0];
56
57my $object = $labase->get_object('nethost', $host) or die 
58    "Can't find nethost $host\n";
59
60my $text = '';
61while (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
69print "Done\n";
Note: See TracBrowser for help on using the repository browser.