Module: TrainPlugins::Juniper::WindowsProxy
- Included in:
- BastionProxy
- Defined in:
- lib/train-juniper/connection/windows_proxy.rb
Overview
Windows-specific proxy handling using plink.exe This pattern is used by various Ruby projects for Windows SSH support, including hglib.rb (Mercurial) and follows Net::SSH::Proxy::Command patterns
Instance Method Summary collapse
-
#build_plink_proxy_command(bastion_host, user, port, password) ⇒ String
Build plink.exe proxy command for Windows bastion authentication.
-
#plink_available? ⇒ Boolean
Check if plink.exe is available on Windows.
Instance Method Details
#build_plink_proxy_command(bastion_host, user, port, password) ⇒ String
Build plink.exe proxy command for Windows bastion authentication
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/train-juniper/connection/windows_proxy.rb', line 27 def build_plink_proxy_command(bastion_host, user, port, password) parts = [] parts << 'plink.exe' parts << '-batch' # Non-interactive mode parts << '-ssh' # Force SSH protocol (not telnet) parts << '-pw' parts << Shellwords.escape(password) if port && port != 22 parts << '-P' parts << port.to_s end parts << "#{user}@#{bastion_host}" parts << '-nc' parts << '%h:%p' # Netcat mode for proxying parts.join(' ') end |
#plink_available? ⇒ Boolean
Check if plink.exe is available on Windows
13 14 15 16 17 18 19 |
# File 'lib/train-juniper/connection/windows_proxy.rb', line 13 def plink_available? return false unless Gem.win_platform? ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path| File.exist?(File.join(path, 'plink.exe')) end end |