ssh: shell start support
This commit is contained in:
parent
90332cd134
commit
f654deb300
@ -62,6 +62,7 @@ func (d *SSH) forward(val sshtun.Forward, domainMatcher func(string)) conn {
|
||||
d.auth,
|
||||
sshtun.SessionConfig{
|
||||
NoPTY: d.params.NoPTY,
|
||||
Shell: d.params.Shell,
|
||||
FakeRemoteHost: d.params.FakeRemoteHost,
|
||||
KeepAliveInterval: uint(d.params.KeepAlive.Interval),
|
||||
KeepAliveMax: uint(d.params.KeepAlive.MaxAttempts),
|
||||
|
@ -17,6 +17,7 @@ type Params struct {
|
||||
Mode types.DomainMode `mapstructure:"mode" validate:"required,oneof=single multi"`
|
||||
FakeRemoteHost bool `mapstructure:"fake_remote_host"`
|
||||
NoPTY bool `mapstructure:"nopty"`
|
||||
Shell bool `mapstructure:"shell"`
|
||||
Commands types.Commands `mapstructure:"commands"`
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ type Tunnel struct {
|
||||
|
||||
type SessionConfig struct {
|
||||
NoPTY bool
|
||||
Shell bool
|
||||
FakeRemoteHost bool
|
||||
KeepAliveInterval uint
|
||||
KeepAliveMax uint
|
||||
@ -112,11 +113,17 @@ func (t *Tunnel) connect(ctx context.Context, bannerCb ssh.BannerCallback, sessi
|
||||
})
|
||||
if err != nil {
|
||||
t.log.Warnf("PTY allocation failed: %s", err.Error())
|
||||
} else {
|
||||
}
|
||||
}
|
||||
if t.sessConfig.Shell {
|
||||
if err := sess.Shell(); err != nil {
|
||||
t.log.Warnf("failed to start shell: %s", err.Error())
|
||||
}
|
||||
}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
_ = sess.Wait()
|
||||
}()
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
|
Loading…
Reference in New Issue
Block a user