case $hoster {
"ubcece", "darmstadt", "ftcollins", "grnet": { include resolv }
}
+ case $portforwarder_user_exists {
+ "true": { include portforwarder }
+ }
}
--- /dev/null
+class portforwarder {
+ # do not depend on xinetd, yet. it might uninstall other inetds
+ # for now this will have to be done manually
+ file {
+ "/etc/ssh/userkeys/portforwarder":
+ content => template("portforwarder/authorized_keys.erb"),
+ mode => 444,
+ ;
+ "/etc/xined.d":
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => 755,
+ ;
+ #"/etc/xinetd.d/dsa-portforwader":
+ # content => template("portforwarder/xinetd.erb"),
+ # notify => Exec["xinetd reload"]
+ # ;
+ }
+
+ exec {
+ "xinetd reload":
+ path => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
+ refreshonly => true,
+ ;
+ }
+}
+# vim:set et:
+# vim:set ts=4:
+# vim:set shiftwidth=4:
--- /dev/null
+<%=
+config = YAML.load(File.open('/etc/puppet/modules/portforwarder/misc/config.yaml').read)
+config.each_pair do |sourcehost, services|
+ services.each do |service|
+ next if service['target_host'] != hostname
+
+ sshkey = nil
+ remote_ip = keyinfo[sourcehost][0]['ipHostNumber'].join(',')
+ forward_to_port = service['target_port']
+ local_bind = 127.0.0.2
+
+ lines << "# from #{sourcehost} on local port #{service['source_bind_port']}"
+ if remote_ip.nil? or forward_to_port.nil? or local_bind.nil?
+ #if sshkey.nil? or remote_ip.nil? or forward_to_port.nil? or local_bind.nil?
+ lines << "# insufficient config values"
+ else
+ #lines << "from=\"#{remote_ip}\",command=\"/bin/nc -s #{local_bind} 127.0.0.1 #{forward_to_port}\",no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding #{sshkey}"
+ lines << "#from=\"#{remote_ip}\",command=\"/bin/nc -s #{local_bind} 127.0.0.1 #{forward_to_port}\",no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding <sshkey here>"
+ end
+ end
+end
+lines = []
+lines.join("\n")
+%>