| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 # == Type: adblockplus::log::uplink | 
|  | 2 # | 
|  | 3 # Used internally by class adblockplus::log::master to establish an SSH | 
|  | 4 # uplink for each known server, both identifying and authenticating the | 
|  | 5 # client by examining its $ip addresses and $ssh_public_key, i.e.: | 
|  | 6 # | 
|  | 7 #   # write into master:/var/adblockplus/log/uplink/$HOSTNAME/$@ | 
|  | 8 #   client# ssh -i /etc/ssh/ssh_host_rsa_key log@master $@ < log.1.gz | 
|  | 9 # | 
|  | 10 # Note the uplink itself being just an SSH layer for upstream I/O, meant | 
|  | 11 # to become integrated as a client's post rotation command or similar. | 
|  | 12 # | 
|  | 13 # === Parameters: | 
|  | 14 # | 
|  | 15 # Identical to base::explicit_host_records. | 
|  | 16 # | 
|  | 17 # === Examples: | 
|  | 18 # | 
|  | 19 #   adblockplus::log::uplink {'example': | 
|  | 20 #     ip => ['10.8.0.1'], | 
|  | 21 #     ssh_authorized_key => 'AAA...', | 
|  | 22 #   } | 
|  | 23 # | 
|  | 24 define adblockplus::log::uplink ( | 
|  | 25   $ip, | 
|  | 26   $ssh_public_key = undef, | 
|  | 27   $role = undef, | 
|  | 28   $dns = undef, | 
|  | 29   $groups = undef, | 
|  | 30 ) { | 
|  | 31 | 
|  | 32   include adblockplus::log::master | 
|  | 33 | 
|  | 34   $import_command = shellquote([ | 
|  | 35     $adblockplus::log::master::import_script, | 
|  | 36     '--source', $dns ? {undef => $name, default => $dns}, | 
|  | 37     '--target', $adblockplus::log::master::uplink_directory, | 
|  | 38   ]) | 
|  | 39 | 
|  | 40   $source_address_pattern = is_array($ip) ? { | 
|  | 41     true => join($ip, ','), | 
|  | 42     default => $ip, | 
|  | 43   } | 
|  | 44 | 
|  | 45   ssh_authorized_key {"adblockplus::log::uplink#$name": | 
|  | 46     ensure => $ssh_public_key ? { | 
|  | 47       undef => 'absent', | 
|  | 48       default => 'present', | 
|  | 49     }, | 
|  | 50     key => $ssh_public_key, | 
|  | 51     name => $name, | 
|  | 52     options => [ | 
|  | 53       "command=\"$import_command -- \$SSH_ORIGINAL_COMMAND\"", | 
|  | 54       "from=\"$source_address_pattern\"", | 
|  | 55       'no-agent-forwarding', | 
|  | 56       'no-port-forwarding', | 
|  | 57       'no-pty', | 
|  | 58       'no-X11-forwarding', | 
|  | 59     ], | 
|  | 60     require => File[$adblockplus::log::master::uplink_directory], | 
|  | 61     type => 'ssh-rsa', | 
|  | 62     user => $adblockplus::log::user, | 
|  | 63   } | 
|  | 64 } | 
| OLD | NEW | 
|---|