non return plugin callback now will be triggered together (#162)

* add failtoban plugin

* fmt

* bump ver

* add failtoban e2e

* add readme

* update readme
This commit is contained in:
Boshi Lian 2023-07-11 01:32:05 -07:00 • committed by GitHub
parent bffa03dde0
commit 2067fcb003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 189 additions and 10 deletions

View file

@ -125,9 +125,10 @@ func (cp *ChainPlugins) InstallPiperConfig(config *GrpcPluginConfig) error {
}
config.UpstreamAuthFailureCallback = func(conn ssh.ConnMetadata, method string, err error, challengeCtx ssh.ChallengeContext) {
cur := cp.pluginsCallback[challengeCtx.(*chainConnMeta).current]
if cur.UpstreamAuthFailureCallback != nil {
cur.UpstreamAuthFailureCallback(conn, method, err, challengeCtx)
for _, p := range cp.pluginsCallback {
if p.UpstreamAuthFailureCallback != nil {
p.UpstreamAuthFailureCallback(conn, method, err, challengeCtx)
}
}
}
@ -141,16 +142,18 @@ func (cp *ChainPlugins) InstallPiperConfig(config *GrpcPluginConfig) error {
}
config.PipeStartCallback = func(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) {
cur := cp.pluginsCallback[challengeCtx.(*chainConnMeta).current]
if cur.PipeStartCallback != nil {
cur.PipeStartCallback(conn, challengeCtx)
for _, p := range cp.pluginsCallback {
if p.PipeStartCallback != nil {
p.PipeStartCallback(conn, challengeCtx)
}
}
}
config.PipeErrorCallback = func(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext, err error) {
cur := cp.pluginsCallback[challengeCtx.(*chainConnMeta).current]
if cur.PipeErrorCallback != nil {
cur.PipeErrorCallback(conn, challengeCtx, err)
for _, p := range cp.pluginsCallback {
if p.PipeErrorCallback != nil {
p.PipeErrorCallback(conn, challengeCtx, err)
}
}
}