func (b *Bmc) certificateSetup() (bool, error) {
	if b.config.HTTPSCert.Attributes.CommonName == "" {
		return false, fmt.Errorf("Declared certificate configuration requires a commonName")
	}
	if strings.HasPrefix(b.config.HTTPSCert.Attributes.CommonName, ".") {
		return false, fmt.Errorf("Declared certificate commonName invalid: %s", b.config.HTTPSCert.Attributes.CommonName)
	}
	b.config.HTTPSCert.Attributes.CommonName = strings.Replace(b.config.HTTPSCert.Attributes.CommonName, "_", "-", -1)
	commonName := b.config.HTTPSCert.Attributes.CommonName
	if b.butlerConfig.CertSigner == nil {
		return false, fmt.Errorf("No cert signer declared in butler configuration")
	}
	certs, csrCapability, err := b.bmc.CurrentHTTPSCert()
	if err != nil {
		return false, fmt.Errorf("Error retreiving current cert: %s", err)
	}
	invalidReason, valid := b.validateCert(certs, b.config.HTTPSCert)
	if valid {
		b.logger.WithFields(logrus.Fields{
			"Vendor":    b.vendor,
			"Model":     b.model,
			"Serial":    b.serial,
			"IPAddress": b.ip,
		}).Trace("Current certificate matches configuration.")
		return false, nil
	}
	b.logger.WithFields(logrus.Fields{
		"Vendor":    b.vendor,
		"Model":     b.model,
		"Serial":    b.serial,
		"IPAddress": b.ip,
		"Cause":     invalidReason,
	}).Trace("Current certificate does not match configuration.")
	var csr []byte
	var privateKey []byte
	var privateKeyFileName string
	if !csrCapability {
		csr, privateKey, err = generateCsr(b.config.HTTPSCert.Attributes)
	} else {
		csr, err = b.configure.GenerateCSR(b.config.HTTPSCert.Attributes)
	}
	if err != nil {
		return false, fmt.Errorf("CSR not generated: %s", err)
	}
	crt, err := b.signCSR(csr, commonName)
	if err != nil {
		return false, err
	}
	block, _ := pem.Decode(crt)
	if block == nil {
		return false, fmt.Errorf("CSR signer returned an invalid PEM block")
	}
	certFileName := fmt.Sprintf("%s.%s", commonName, "crt")
	time.Sleep(time.Second * 2)
	resetBMC, err := b.configure.UploadHTTPSCert(crt, certFileName, privateKey, privateKeyFileName)
	if err != nil {
		return false, fmt.Errorf("Error uploading signed cert: %s", err)
	}
	return resetBMC, nil
}
1. Get current certificate info
2. Determine if certificate needs to be updated
3. If update required, generate CSR from the BMC
4. Get certificate signed by CA service
5. Upload signed certificate on the BMC.
iDrac needs a reset
POST https://10.193.251.25/data?set=iDracReset:1
package configure
import (
	"bytes"
	"context"
	"crypto/rand"
	"crypto/rsa"
	"crypto/x509"
	"crypto/x509/pkix"
	"encoding/asn1"
	"encoding/pem"
	"fmt"
	"net"
	"os/exec"
	"strings"
	"syscall"
	"time"
	"github.com/bmc-toolbox/bmclib/cfgresources"
	"github.com/sirupsen/logrus"
)