File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change
1
+ version : 2
2
+ updates :
3
+ - package-ecosystem : " gomod"
4
+ directory : " /"
5
+ schedule :
6
+ interval : " daily"
7
+ labels :
8
+ - " dependencies"
9
+ commit-message :
10
+ prefix : " feat"
11
+ include : " scope"
12
+ - package-ecosystem : " github-actions"
13
+ directory : " /"
14
+ schedule :
15
+ interval : " daily"
16
+ labels :
17
+ - " dependencies"
18
+ commit-message :
19
+ prefix : " chore"
20
+ include : " scope"
21
+ - package-ecosystem : " docker"
22
+ directory : " /"
23
+ schedule :
24
+ interval : " daily"
25
+ labels :
26
+ - " dependencies"
27
+ commit-message :
28
+ prefix : " feat"
29
+ include : " scope"
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ type Server struct {
39
39
Version string // server version to be sent before the initial handshake
40
40
Banner string // server banner
41
41
42
+ BannerHandler BannerHandler // server banner handler, overrides Banner
42
43
KeyboardInteractiveHandler KeyboardInteractiveHandler // keyboard-interactive authentication handler
43
44
PasswordHandler PasswordHandler // password authentication handler
44
45
PublicKeyHandler PublicKeyHandler // public key authentication handler
@@ -134,10 +135,16 @@ func (srv *Server) config(ctx Context) *gossh.ServerConfig {
134
135
config .ServerVersion = "SSH-2.0-" + srv .Version
135
136
}
136
137
if srv .Banner != "" {
137
- config .BannerCallback = func (conn gossh.ConnMetadata ) string {
138
+ config .BannerCallback = func (_ gossh.ConnMetadata ) string {
138
139
return srv .Banner
139
140
}
140
141
}
142
+ if srv .BannerHandler != nil {
143
+ config .BannerCallback = func (conn gossh.ConnMetadata ) string {
144
+ applyConnMetadata (ctx , conn )
145
+ return srv .BannerHandler (ctx )
146
+ }
147
+ }
141
148
if srv .PasswordHandler != nil {
142
149
config .PasswordCallback = func (conn gossh.ConnMetadata , password []byte ) (* gossh.Permissions , error ) {
143
150
applyConnMetadata (ctx , conn )
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ type Option func(*Server) error
36
36
// Handler is a callback for handling established SSH sessions.
37
37
type Handler func (Session )
38
38
39
+ // BannerHandler is a callback for displaying the server banner.
40
+ type BannerHandler func (ctx Context ) string
41
+
39
42
// PublicKeyHandler is a callback for performing public key authentication.
40
43
type PublicKeyHandler func (ctx Context , key PublicKey ) bool
41
44
@@ -152,8 +155,7 @@ func Handle(handler Handler) {
152
155
153
156
// KeysEqual is constant time compare of the keys to avoid timing attacks.
154
157
func KeysEqual (ak , bk PublicKey ) bool {
155
-
156
- //avoid panic if one of the keys is nil, return false instead
158
+ // avoid panic if one of the keys is nil, return false instead
157
159
if ak == nil || bk == nil {
158
160
return false
159
161
}
You can’t perform that action at this time.
0 commit comments