Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add ssh_path tool

  • Loading branch information...
commit 6c720998b28d23e2fc817f8a13edc5be2cd1ff17 1 parent f927df0
@jof authored
Showing with 36 additions and 0 deletions.
  1. +6 −0 homedir_root/.ssh/config.erb
  2. +30 −0 homedir_root/bin/ssh_path
View
6 homedir_root/.ssh/config.erb
@@ -0,0 +1,6 @@
+ControlMaster auto
+ControlPath ~/.ssh/control_master/%r_at_%h_port_%p
+Protocol 2
+
+Host localhost 127.0.0.1
+ StrictHostKeyChecking no
View
30 homedir_root/bin/ssh_path
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+
+require 'erb'
+
+def usage
+ puts <<-EOF
+# Usage: ssh_path [ roaming | office ]
+#
+# This tool templatizes an ssh configuration in order to redirect connection
+# proxy paths.
+#
+# This looks for configuration in #{SSH_TEMPLATE}, and writes configuration to # #{SSH_CONFIG}
+ EOF
+ exit 1
+end
+
+SSH_CONFIG = File.expand_path('~/.ssh/config')
+SSH_TEMPLATE = File.expand_path('~/.ssh/config.erb')
+location = ARGV.first.downcase
+
+###
+unless ARGV.length == 1
+ usage
+end
+
+template = ERB.new(open(SSH_TEMPLATE, "r").read)
+result = template.result(binding)
+File.open(SSH_CONFIG, "w") do |file|
+ file.print(result)
+end
Please sign in to comment.
Something went wrong with that request. Please try again.