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,
|
d.auth,
|
||||||
sshtun.SessionConfig{
|
sshtun.SessionConfig{
|
||||||
NoPTY: d.params.NoPTY,
|
NoPTY: d.params.NoPTY,
|
||||||
|
Shell: d.params.Shell,
|
||||||
FakeRemoteHost: d.params.FakeRemoteHost,
|
FakeRemoteHost: d.params.FakeRemoteHost,
|
||||||
KeepAliveInterval: uint(d.params.KeepAlive.Interval),
|
KeepAliveInterval: uint(d.params.KeepAlive.Interval),
|
||||||
KeepAliveMax: uint(d.params.KeepAlive.MaxAttempts),
|
KeepAliveMax: uint(d.params.KeepAlive.MaxAttempts),
|
||||||
|
@ -17,6 +17,7 @@ type Params struct {
|
|||||||
Mode types.DomainMode `mapstructure:"mode" validate:"required,oneof=single multi"`
|
Mode types.DomainMode `mapstructure:"mode" validate:"required,oneof=single multi"`
|
||||||
FakeRemoteHost bool `mapstructure:"fake_remote_host"`
|
FakeRemoteHost bool `mapstructure:"fake_remote_host"`
|
||||||
NoPTY bool `mapstructure:"nopty"`
|
NoPTY bool `mapstructure:"nopty"`
|
||||||
|
Shell bool `mapstructure:"shell"`
|
||||||
Commands types.Commands `mapstructure:"commands"`
|
Commands types.Commands `mapstructure:"commands"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ type Tunnel struct {
|
|||||||
|
|
||||||
type SessionConfig struct {
|
type SessionConfig struct {
|
||||||
NoPTY bool
|
NoPTY bool
|
||||||
|
Shell bool
|
||||||
FakeRemoteHost bool
|
FakeRemoteHost bool
|
||||||
KeepAliveInterval uint
|
KeepAliveInterval uint
|
||||||
KeepAliveMax uint
|
KeepAliveMax uint
|
||||||
@ -112,12 +113,18 @@ func (t *Tunnel) connect(ctx context.Context, bannerCb ssh.BannerCallback, sessi
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.log.Warnf("PTY allocation failed: %s", err.Error())
|
t.log.Warnf("PTY allocation failed: %s", err.Error())
|
||||||
} else {
|
|
||||||
if err := sess.Shell(); err != nil {
|
|
||||||
t.log.Warnf("failed to start shell: %s", err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user