mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-02 03:46:29 +02:00
trying to get keyboard-interactive challenge to trigger
This commit is contained in:
parent
0ae4742dd0
commit
33eda54c8b
3 changed files with 20 additions and 1 deletions
|
@ -23,11 +23,12 @@ func TestSSH(t *testing.T) {
|
||||||
serverHostKey := newSSHKey(t)
|
serverHostKey := newSSHKey(t)
|
||||||
|
|
||||||
// ssh client setup
|
// ssh client setup
|
||||||
|
var ki scenarios.EmptyKeyboardInteractiveChallenge
|
||||||
clientConfig := &ssh.ClientConfig{
|
clientConfig := &ssh.ClientConfig{
|
||||||
User: "demo",
|
User: "demo",
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(clientKey),
|
ssh.PublicKeys(clientKey),
|
||||||
//ssh.KeyboardInteractive()
|
ssh.KeyboardInteractive(ki.Do),
|
||||||
},
|
},
|
||||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}
|
}
|
||||||
|
@ -36,6 +37,7 @@ func TestSSH(t *testing.T) {
|
||||||
env := testenv.New(t)
|
env := testenv.New(t)
|
||||||
|
|
||||||
env.Add(scenarios.SSH(scenarios.SSHConfig{}))
|
env.Add(scenarios.SSH(scenarios.SSHConfig{}))
|
||||||
|
env.Add(&ki)
|
||||||
|
|
||||||
up := upstreams.SSH(
|
up := upstreams.SSH(
|
||||||
upstreams.WithHostKeys(serverHostKey),
|
upstreams.WithHostKeys(serverHostKey),
|
||||||
|
|
|
@ -97,3 +97,18 @@ func writeSSHKeyPair(env testenv.Environment, key any) config.SSHKeyPair {
|
||||||
PrivateKeyFile: privname,
|
PrivateKeyFile: privname,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EmptyKeyboardInteractiveChallenge responds to any keyboard-interactive
|
||||||
|
// challenges with zero prompts, and fails otherwise.
|
||||||
|
type EmptyKeyboardInteractiveChallenge struct {
|
||||||
|
testenv.DefaultAttach
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *EmptyKeyboardInteractiveChallenge) Do(
|
||||||
|
name, instruction string, questions []string, echos []bool,
|
||||||
|
) (answers []string, err error) {
|
||||||
|
if len(questions) > 0 {
|
||||||
|
c.Env().Require().FailNow("unsupported keyboard-interactive challenge")
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
|
@ -69,6 +69,8 @@ func (d *DefaultAttach) RecordCaller() {
|
||||||
d.caller = getCaller(4)
|
d.caller = getCaller(4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DefaultAttach) Modify(*config.Config) {}
|
||||||
|
|
||||||
// Aggregate should be embedded in types implementing [Modifier] when the type
|
// Aggregate should be embedded in types implementing [Modifier] when the type
|
||||||
// contains other modifiers. Used as an alternative to [DefaultAttach].
|
// contains other modifiers. Used as an alternative to [DefaultAttach].
|
||||||
// Embedding this struct will properly keep track of when constituent modifiers
|
// Embedding this struct will properly keep track of when constituent modifiers
|
||||||
|
|
Loading…
Add table
Reference in a new issue