Skip to content

Conversation

@Larry199203
Copy link

@binnyjeshan
Copy link

@taraschornyiplv

Could you please add relevant folks from the OLS SONiC side to review as well, thanks.

// save to operational.pem
file, err := os.Create(operationalPath)
if err != nil {
logger.Error("cannot create opreational.pem, err is %s", err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor mistake .. typo error "operational" it must have been.

Bytes: cert.Raw,
})
if err != nil {
logger.Error("write opreational.pem failed, err is %s", err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, typo

if ControllerAddr == "" {
logger.Error("Could not get ControllerAddr")
estServerList = []string{estHost}
updateOperationalPem()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return if it was false, then its not handled ?

cmd.Stdout = &out
err := cmd.Run()
if err != nil {
logger.Error("command dig failed, err is %s", err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the domain context may also be additionally helpful in this log.

caUrl := "https://" + estServer + "/cacerts"
resp, err := client.Get(caUrl)
if err != nil {
logger.Error("request failed, err is %s", err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally printing the url attempted may be helpful.

Copy link
Author

@Larry199203 Larry199203 Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the err info contains the url.But It's more readable when expressed in code. Thank you!

}

// parse private key
privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSignatureAlgorithm function supports both RSA and ECDSA, rest is erred.
In tihs code, there is a single key type parsed. Is that enough?

I'm not sure if my comment is right, but thinking why only this is called here and returned failed below, without checking if the key type is something else?

return true
}

estServerList = getEstServer(ControllerAddr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this was returned empty from getEstServer ?
Guess that case to be handled?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If It's empty from getEstServer, the code will use production est or qs est based on the birth certificate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants