projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix syntax error
[mirror/dsa-puppet.git]
/
modules
/
portforwarder
/
templates
/
authorized_keys.erb
diff --git
a/modules/portforwarder/templates/authorized_keys.erb
b/modules/portforwarder/templates/authorized_keys.erb
index
5cb7662
..
063312a
100644
(file)
--- a/
modules/portforwarder/templates/authorized_keys.erb
+++ b/
modules/portforwarder/templates/authorized_keys.erb
@@
-4,6
+4,13
@@
##
<%=
##
<%=
+
+require 'digest/sha1'
+def get_local_ip_addr(host)
+ hash = Digest::SHA1.digest(host)
+ return '127.101.%d.%d'%[hash[0].ord, hash[1].ord]
+end
+
def getportforwarderkey(host)
key = nil
begin
def getportforwarderkey(host)
key = nil
begin
@@
-29,8
+36,8
@@
config.each_pair do |sourcehost, services|
if allowed_ports.length > 0
sshkey = getportforwarderkey(sourcehost)
if allowed_ports.length > 0
sshkey = getportforwarderkey(sourcehost)
- remote_ip =
allnodeinfo
[sourcehost]['ipHostNumber'].join(',')
- local_bind =
'127.101.%d.%d'%[ (sourcehost.hash / 256 % 256), sourcehost.hash % 256 ]
+ remote_ip =
scope.lookupvar('site::allnodeinfo')
[sourcehost]['ipHostNumber'].join(',')
+ local_bind =
get_local_ip_addr(sourcehost)
lines << "# from #{sourcehost}"
if sshkey.nil? or remote_ip.nil? or local_bind.nil?
lines << "# from #{sourcehost}"
if sshkey.nil? or remote_ip.nil? or local_bind.nil?