@@ -26,6 +26,7 @@ mutable struct Session
2626 ssh_dir:: Union{String, Nothing}
2727 known_hosts:: Union{String, Nothing}
2828 gssapi_server_identity:: Union{String, Nothing}
29+ process_config:: Bool
2930
3031 _lock:: ReentrantLock
3132 _auth_methods:: Union{Vector{AuthMethod}, Nothing}
@@ -68,7 +69,7 @@ mutable struct Session
6869 lib. ssh_set_blocking (ptr, 0 )
6970
7071 session = new (ptr, own, [], nothing ,
71- - 1 , nothing , nothing , nothing ,
72+ - 1 , nothing , nothing , nothing , true ,
7273 ReentrantLock (), nothing , AuthMethod[], true ,
7374 Threads. Event (true ), CloseableCondition (), false )
7475
@@ -137,6 +138,13 @@ $(TYPEDSIGNATURES)
137138Constructor for creating a client session. Use this if you want to connect to a
138139server.
139140
141+ !!! warning
142+ By default libssh will try to follow the settings in any found SSH config
143+ files. If a proxyjump is configured for `host` libssh will try to set up the
144+ proxy itself, which usually does not play well with Julia's event loop. In
145+ such situations you will probably want to pass `process_config=false` and
146+ set up the proxyjump explicitly using a [`Forwarder`](@ref).
147+
140148# Throws
141149- [`LibSSHException`](@ref): if a session couldn't be created, or there was an
142150 error initializing the `user` property.
@@ -152,6 +160,7 @@ server.
152160- `log_verbosity=nothing`: Set the log verbosity for the session.
153161- `auto_connect=true`: Whether to automatically call
154162 [`connect()`](@ref).
163+ - `process_config=true`: Whether to process any found SSH config files.
155164
156165# Examples
157166
@@ -163,7 +172,8 @@ julia> session = ssh.Session(ip"12.34.56.78", 2222)
163172"""
164173function Session (host:: Union{AbstractString, Sockets.IPAddr} , port= 22 ;
165174 socket:: Union{Sockets.TCPSocket, RawFD, Nothing} = nothing ,
166- user= nothing , log_verbosity= nothing , auto_connect= true )
175+ user= nothing , log_verbosity= nothing , auto_connect= true ,
176+ process_config= true )
167177 session_ptr = lib. ssh_new ()
168178 if session_ptr == C_NULL
169179 throw (LibSSHException (" Could not initialize Session for host $(host) " ))
@@ -192,6 +202,8 @@ function Session(host::Union{AbstractString, Sockets.IPAddr}, port=22;
192202 session. user = user
193203 end
194204
205+ session. process_config = process_config
206+
195207 if auto_connect
196208 connect (session)
197209 end
@@ -295,10 +307,11 @@ const SESSION_PROPERTY_OPTIONS = Dict(:host => (SSH_OPTIONS_HOST, Cstring),
295307 :ssh_dir => (SSH_OPTIONS_SSH_DIR, Cstring),
296308 :known_hosts => (SSH_OPTIONS_KNOWNHOSTS, Cstring),
297309 :gssapi_server_identity => (SSH_OPTIONS_GSSAPI_SERVER_IDENTITY, Cstring),
298- :log_verbosity => (SSH_OPTIONS_LOG_VERBOSITY, Cuint))
310+ :log_verbosity => (SSH_OPTIONS_LOG_VERBOSITY, Cuint),
311+ :process_config => (SSH_OPTIONS_PROCESS_CONFIG, Bool))
299312# These properties cannot be retrieved from the libssh API (i.e. with
300313# ssh_options_get()), so we store them in the Session object instead.
301- const SAVED_PROPERTIES = (:log_verbosity , :gssapi_server_identity , :ssh_dir , :known_hosts )
314+ const SAVED_PROPERTIES = (:log_verbosity , :gssapi_server_identity , :ssh_dir , :known_hosts , :process_config )
302315
303316function Base. propertynames (:: Session , private:: Bool = false )
304317 fields = fieldnames (Session)
0 commit comments