Пример #1
0
func (cmd *Command) upsertHostAction(c *cli.Context) {
	host, err := engine.NewHost(c.String("name"), engine.HostSettings{})
	if err != nil {
		cmd.printError(err)
		return
	}
	if c.String("cert") != "" || c.String("privateKey") != "" {
		keyPair, err := readKeyPair(c.String("cert"), c.String("privateKey"))
		if err != nil {
			cmd.printError(fmt.Errorf("failed to read key pair: %s", err))
			return
		}
		host.Settings.KeyPair = keyPair
	}
	host.Settings.OCSP = engine.OCSPSettings{
		Enabled:            c.Bool("ocsp"),
		SkipSignatureCheck: c.Bool("ocspSkipCheck"),
		Period:             c.Duration("ocspPeriod").String(),
		Responders:         c.StringSlice("ocspResponder"),
	}
	if err := cmd.client.UpsertHost(*host); err != nil {
		cmd.printError(err)
		return
	}
	cmd.printOk("host added")
}
Пример #2
0
func initBundle(c *cli.Context) {
	b, err := NewBundler(c.StringSlice("middleware"))
	if err != nil {
		log.Errorf("Failed to bundle middlewares: %s", err)
		return
	}
	if err := b.bundle(); err != nil {
		log.Errorf("Failed to bundle middlewares: %s", err)
	} else {
		log.Infof("SUCCESS: bundle vulcand and vctl completed")
	}
}
Пример #3
0
func getTLSSettings(c *cli.Context) (*engine.TLSSettings, error) {
	s := &engine.TLSSettings{
		InsecureSkipVerify:       c.Bool("tlsSkipVerify"),
		PreferServerCipherSuites: c.Bool("tlsPreferServerCS"),
		SessionTicketsDisabled:   c.Bool("tlsSessionTicketsOff"),
		MinVersion:               c.String("tlsMinV"),
		MaxVersion:               c.String("tlsMaxV"),
		CipherSuites:             c.StringSlice("tlsCS"),
	}
	s.SessionCache.Type = c.String("tlsSessionCache")
	if s.SessionCache.Type == engine.LRUCacheType {
		s.SessionCache.Settings = &engine.LRUSessionCacheSettings{
			Capacity: c.Int("tlsSessionCacheCapacity"),
		}
	}
	if _, err := engine.NewTLSConfig(s); err != nil {
		return nil, err
	}
	return s, nil
}
Пример #4
0
// FromCli creates a Trace plugin object from command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return New(c.String("addr"), c.StringSlice("reqHeader"), c.StringSlice("respHeader"))
}