Commit 87b9ec693f6a2c1086f577f0e8171b2b2c212dcb
1 parent
a7fbc12c
Exists in
master
and in
1 other branch
Fix preconfig script execution
Showing
2 changed files
with
5 additions
and
4 deletions
Show diff stats
Rakefile
... | ... | @@ -153,7 +153,7 @@ task :preconfig => ssh_config_file do |
153 | 153 | puts "I: delete #{preconfig_file} to force running again" |
154 | 154 | else |
155 | 155 | sh 'scp', '-F', ssh_config_file, 'utils/reverseproxy_ssh_setup', 'reverseproxy.unconfigured:/tmp' |
156 | - sh 'ssh', '-F', ssh_config_file, 'reverseproxy.unconfigured', 'sudo', '/tmp/reverseproxy_ssh_setup', $ALT_SSH_PORT.to_s, config['external_ip'], ips['integration'] | |
156 | + sh 'ssh', '-F', ssh_config_file, 'reverseproxy.unconfigured', 'sudo', '/tmp/reverseproxy_ssh_setup', $ALT_SSH_PORT.to_s, config['external_ip'], ips['reverseproxy'], ips['integration'] | |
157 | 157 | |
158 | 158 | File.open(preconfig_file, 'w') do |f| |
159 | 159 | f.puts($ALT_SSH_PORT) | ... | ... |
utils/reverseproxy_ssh_setup
... | ... | @@ -4,8 +4,9 @@ set -e |
4 | 4 | set -x |
5 | 5 | |
6 | 6 | port="$1" |
7 | -reverseproxy_ip="$2" | |
8 | -integration_ip="$3" | |
7 | +reverseproxy_external="$2" | |
8 | +reverseproxy_ip="$3" | |
9 | +integration_ip="$4" | |
9 | 10 | |
10 | 11 | # switch SSH to port $port |
11 | 12 | sed -i -e 's/^#\?\s*Port\s*[0-9]\+\s*$/Port '$port'/g' /etc/ssh/sshd_config |
... | ... | @@ -33,7 +34,7 @@ iptables -F |
33 | 34 | iptables -F -t nat |
34 | 35 | |
35 | 36 | # Setup port redirect |
36 | -iptables -t nat -A PREROUTING -d $reverseproxy_ip/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination $integration_ip:22 | |
37 | +iptables -t nat -A PREROUTING -d $reverseproxy_external/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination $integration_ip:22 | |
37 | 38 | iptables -t nat -A POSTROUTING -d $integration_ip/32 -p tcp -m tcp --dport 22 -j SNAT --to-source $reverseproxy_ip |
38 | 39 | if grep -q '/$' /proc/1/cgroup; then |
39 | 40 | # only on non-containers | ... | ... |