Ignore:
Timestamp:
04/17/13 18:24:00 (11 years ago)
Author:
nanardon
Message:

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.

Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Nethost.pm

    r1224 r1225  
    8484                multiple => 1, 
    8585                input => sub { lc($_[0]) }, 
     86            }, 
     87            sshfp => { multiple => 1, }, 
     88            sshfpUpdate  => { 
     89                managed => 1, 
    8690            }, 
    8791        } 
     
    158162        delete($data{ipFrom}); 
    159163    } 
     164    if ($data{sshfpUpdate}) { 
     165        open my $h, '<', \$data{sshfpUpdate}; 
     166        my @sshfps; 
     167        while (my $line = <$h>) { 
     168            my ($type, $mode, $key) = $line =~ /^\S+\s+IN\s+SSHFP\s+(\d)\s+(\d)\s+(\S+)/i 
     169                or do { 
     170                    la_log(LA_ERR, "Seems to not be a ssh-keygen line: %s", $line); 
     171                    return; 
     172                }; 
     173            la_log(LA_DEBUG, "found sshfp %s %s %s", $type, $mode, $key); 
     174            push(@sshfps, "$type $mode $key"); 
     175        } 
     176        close($h); 
     177        delete($data{sshfpUpdate}); 
     178        $data{sshfp} = \@sshfps; 
     179    } 
    160180 
    161181    $self->SUPER::set_fields(%data) 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm

    r1218 r1225  
    318318sub _checkzone_output { 
    319319    my ($self, $ozone, $output) = @_; 
     320 
     321    if (!$self->_la->val('network', 'checkzone')) { 
     322        return 1; 
     323    } 
    320324 
    321325    my ($fh, $filename) = tempfile(); 
     
    479483                } 
    480484            } 
     485            foreach (grep { $_ } $host_o->get_attributes('sshfp')) { 
     486                $dbzone .= sprintf( 
     487                    "%-30s IN    SSHFP    %s\n", 
     488                    $res, 
     489                    $_, 
     490                ); 
     491            } 
    481492        } 
    482493    } 
Note: See TracChangeset for help on using the changeset viewer.