From 9d0fd33d5a30f385b6a1b84665858c063e11a8e7 Mon Sep 17 00:00:00 2001 From: sebas Date: Wed, 23 Dec 2009 03:36:18 +0000 Subject: nuevo modulo para hacer tuneles ssh git-svn-id: https://svn.redcta.org.ar/proyectos/redcta/trunk/puppet/modules/puppet-autossh@499 f006c9fa-d829-0410-90dc-981dd8ba64c0 --- README | 0 manifests/init.pp | 21 +++++++++++++++++++++ templates/tunnel-autossh.erb | 30 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 README create mode 100644 manifests/init.pp create mode 100644 templates/tunnel-autossh.erb diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..6915a44 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,21 @@ +class autossh { + package { "autossh": + ensure => installed, + } + + file { + "/etc/init.d/tunnel-autossh": + owner => root, + group => root, + mode => 755, + require => Package["autossh"], + content => template("autossh/tunnel-autossh.erb"); + } + + exec { "autossh_update_rcd": + command => "update-rc.d tunnel-autossh start 18 2 3 4 5 . stop 81 0 1 6 .", + creates => "/etc/rc2.d/S18tunnel-autossh", + path => "/bin:/sbin:/usr/sbin:/usr/bin", + require => [ Package["autossh"], File["/etc/init.d/tunnel-autossh"]], + } +} diff --git a/templates/tunnel-autossh.erb b/templates/tunnel-autossh.erb new file mode 100644 index 0000000..0e38c3a --- /dev/null +++ b/templates/tunnel-autossh.erb @@ -0,0 +1,30 @@ +#!/bin/sh +# port forwarding with ssh +# installed with: update-rc.d tunnel-autossh start 18 2 3 4 5 . stop 81 0 1 6 . + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +if ! [ -x /usr/bin/autossh ]; then + echo "Where is autossh?" + exit 0 +fi + +case "$1" in + start) + # same as above for the collector + # here we are binding to a host with an common internal interface (127.0.0.1) + /bin/su <%= autossh_tunneluser %> -c '/usr/bin/autossh -f -N -L <%= autossh_localport %>:<%= autossh_localip %>:<%= autossh_localportservice %> <%= autossh_remotehost %> -M <%= autossh_moniport %>' + echo "adding tunnel for ldap replication" + ;; + stop) + echo -n "destroying tunnel ..." + killall autossh + echo "destroyed!" + ;; + + *) + echo "Usage: /etc/init.d/tunnel-autossh {start|stop}" + exit 1 + ;; +esac + -- cgit v1.2.3