Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/log/uplink.pp

Issue 29333248: Issue 3306 - Create uplinks for pushing log files (Closed)
Patch Set: Issue 3306 - Address feedback from code-review Created Jan. 14, 2016, 3:05 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « modules/adblockplus/manifests/log/master.pp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/log/uplink.pp
diff --git a/modules/adblockplus/manifests/log/uplink.pp b/modules/adblockplus/manifests/log/uplink.pp
new file mode 100644
index 0000000000000000000000000000000000000000..c6cbab0ca5053982d37f3afafea00b90a7065510
--- /dev/null
+++ b/modules/adblockplus/manifests/log/uplink.pp
@@ -0,0 +1,64 @@
+# == Type: adblockplus::log::uplink
+#
+# Used internally by class adblockplus::log::master to establish an SSH
+# uplink for each known server, both identifying and authenticating the
+# client by examining its $ip addresses and $ssh_public_key, i.e.:
+#
+# # write into master:/var/adblockplus/log/uplink/$HOSTNAME/$@
+# client# ssh -i /etc/ssh/ssh_host_rsa_key log@master $@ < log.1.gz
+#
+# Note the uplink itself being just an SSH layer for upstream I/O, meant
+# to become integrated as a client's post rotation command or similar.
+#
+# === Parameters:
+#
+# Identical to base::explicit_host_records.
+#
+# === Examples:
+#
+# adblockplus::log::uplink {'example':
+# ip => ['10.8.0.1'],
+# ssh_authorized_key => 'AAA...',
+# }
+#
+define adblockplus::log::uplink (
+ $ip,
+ $ssh_public_key = undef,
+ $role = undef,
+ $dns = undef,
+ $groups = undef,
+) {
+
+ include adblockplus::log::master
+
+ $import_command = shellquote([
+ $adblockplus::log::master::import_script,
+ '--source', $dns ? {undef => $name, default => $dns},
+ '--target', $adblockplus::log::master::uplink_directory,
+ ])
+
+ $source_address_pattern = is_array($ip) ? {
+ true => join($ip, ','),
+ default => $ip,
+ }
+
+ ssh_authorized_key {"adblockplus::log::uplink#$name":
+ ensure => $ssh_public_key ? {
+ undef => 'absent',
+ default => 'present',
+ },
+ key => $ssh_public_key,
+ name => $name,
+ options => [
+ "command=\"$import_command -- \$SSH_ORIGINAL_COMMAND\"",
+ "from=\"$source_address_pattern\"",
+ 'no-agent-forwarding',
+ 'no-port-forwarding',
+ 'no-pty',
+ 'no-X11-forwarding',
+ ],
+ require => File[$adblockplus::log::master::uplink_directory],
+ type => 'ssh-rsa',
+ user => $adblockplus::log::user,
+ }
+}
« no previous file with comments | « modules/adblockplus/manifests/log/master.pp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld