@@ -79,6 +79,24 @@ var diegoCredentials = flag.String(
7979 "Diego Credentials to be used with the Diego authentication method" ,
8080)
8181
82+ var bbsCACert = flag .String (
83+ "bbsCACert" ,
84+ "" ,
85+ "path to certificate authority cert used for mutually authenticated TLS BBS communication" ,
86+ )
87+
88+ var bbsClientCert = flag .String (
89+ "bbsClientCert" ,
90+ "" ,
91+ "path to client cert used for mutually authenticated TLS BBS communication" ,
92+ )
93+
94+ var bbsClientKey = flag .String (
95+ "bbsClientKey" ,
96+ "" ,
97+ "path to client key used for mutually authenticated TLS BBS communication" ,
98+ )
99+
82100const (
83101 dropsondeDestination = "localhost:3457"
84102 dropsondeOrigin = "ssh-proxy"
@@ -152,8 +170,7 @@ func configure(logger lager.Logger) (*ssh.ServerConfig, error) {
152170 logger .Fatal ("failed-to-parse-cc-api-url" , err )
153171 }
154172
155- bbsClient := bbs .NewClient (* bbsAddress )
156- permissionsBuilder := authenticators .NewPermissionsBuiler (bbsClient )
173+ permissionsBuilder := authenticators .NewPermissionsBuiler (initializeBBSClient (logger ))
157174
158175 authens := []authenticators.PasswordAuthenticator {}
159176
@@ -212,3 +229,20 @@ func NewHttpClient() *http.Client {
212229 Timeout : * communicationTimeout ,
213230 }
214231}
232+
233+ func initializeBBSClient (logger lager.Logger ) bbs.Client {
234+ bbsURL , err := url .Parse (* bbsAddress )
235+ if err != nil {
236+ logger .Fatal ("Invalid BBS URL" , err )
237+ }
238+
239+ if bbsURL .Scheme != "https" {
240+ return bbs .NewClient (* bbsAddress )
241+ }
242+
243+ bbsClient , err := bbs .NewSecureClient (* bbsAddress , * bbsCACert , * bbsClientCert , * bbsClientKey )
244+ if err != nil {
245+ logger .Fatal ("Failed to configure secure BBS client" , err )
246+ }
247+ return bbsClient
248+ }
0 commit comments