Beispiel #1
0
func newSSLConfig(logger logger.Logger) auth.SSLConfig {
	pem, err := ioutil.ReadFile(*caPemFile)
	if err != nil {
		logger.Error("CaPEMFile", "failed to read pemFile: ", err)
		os.Exit(1)
	}

	config, err := auth.NewSSLConfig(*certFile, *keyFile, string(pem), []string{*allowedName})
	if err != nil {
		logger.Error("Config", "Unable to create SSL config", err)
		os.Exit(1)
	}
	return config
}
Beispiel #2
0
		logger = boshlogger.New(boshlogger.LevelDebug, sysLog, sysLog)
		directorCert = spec.CertFor("director")
		tmpDir, err = ioutil.TempDir("", "test-tmp")
		Expect(err).ToNot(HaveOccurred())
		installScript := fmt.Sprintf("#!/bin/bash\necho hiya > %s/install.log\n", tmpDir)
		tarballPath = spec.CreateTarball(installScript)
		allowedNames = []string{"*"}
		system := system.NewOsSystem()
		i = installer.New(system)
		port = spec.GetFreePort()
	})

	JustBeforeEach(func() {
		config, err := auth.NewSSLConfig(
			spec.FixtureFilename("certs/bootstrapper.crt"),
			spec.FixtureFilename("certs/bootstrapper.key"),
			(string)(spec.FixtureData("certs/rootCA.pem")),
			allowedNames,
		)
		Expect(err).ToNot(HaveOccurred())

		l = listener.NewListener(config, i)
	})

	AfterEach(func() {
		if l != nil {
			l.Close()
		}
	})

	Context("when the port is already taken", func() {
		var otherListener *net.TCPListener