Skip to content

asterfusion commit pki2.0#21

Open
Larry199203 wants to merge 1 commit intoasterfusionfrom
asterfusion-pki2
Open

asterfusion commit pki2.0#21
Larry199203 wants to merge 1 commit intoasterfusionfrom
asterfusion-pki2

Conversation

@Larry199203
Copy link
Copy Markdown

@binnyjeshan
Copy link
Copy Markdown

@taraschornyiplv

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

Comment thread cmd/client.go
// save to operational.pem
file, err := os.Create(operationalPath)
if err != nil {
logger.Error("cannot create opreational.pem, err is %s", err.Error())
Copy link
Copy Markdown

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.

Comment thread cmd/client.go
Bytes: cert.Raw,
})
if err != nil {
logger.Error("write opreational.pem failed, err is %s", err.Error())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

same here, typo

Comment thread cmd/client.go
if ControllerAddr == "" {
logger.Error("Could not get ControllerAddr")
estServerList = []string{estHost}
updateOperationalPem()
Copy link
Copy Markdown

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 ?

Comment thread cmd/client.go
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
logger.Error("command dig failed, err is %s", err.Error())
Copy link
Copy Markdown

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.

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

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
Copy Markdown
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!

Comment thread cmd/client.go
}

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

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?

Comment thread cmd/client.go
return true
}

estServerList = getEstServer(ControllerAddr)
Copy link
Copy Markdown

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
Copy Markdown
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.

2 participants