code: func initSelfSignedHTTPSCert(cfg *Config) (err error) {
  	log.Warningf("No TLS Keys provided, using self signed certificate.")
  
  	keyPath := filepath.Join(cfg.DataDir, defaults.SelfSignedKeyPath)
  	certPath := filepath.Join(cfg.DataDir, defaults.SelfSignedCertPath)
  
  	cfg.Proxy.TLSKey = keyPath
  	cfg.Proxy.TLSCert = certPath
  
  	// return the existing pair if they have already been generated:
  	_, err = tls.LoadX509KeyPair(certPath, keyPath)
  	if err == nil {
  		return nil
  	}
  	if !os.IsNotExist(err) {
  		return trace.Wrap(err, "unrecognized error reading certs")
  	}
  	log.Warningf("Generating self signed key and cert to %v %v.", keyPath, certPath)
  
  	creds, err := utils.GenerateSelfSignedCert([]string{cfg.Hostname, "localhost"})
  	if err != nil {
  		return trace.Wrap(err)
  	}
  
  	if err := ioutil.WriteFile(keyPath, creds.PrivateKey, 0600); err != nil {
  		return trace.Wrap(err, "error writing key PEM")
  	}
  	if err := ioutil.WriteFile(certPath, creds.Cert, 0600); err != nil {
  		return trace.Wrap(err, "error writing key PEM")
  	}
  	return nil
  }
docs: // initSelfSignedHTTPSCert generates and self-signs a TLS key+cert pair for https connection
  // to the proxy server.