Skip to content

Commit

Permalink
fix(certs): avoid irrelevant compilation
Browse files Browse the repository at this point in the history
Fixes opiproject#375

Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Jun 13, 2024
1 parent 702542a commit ed28e76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ services:
rm -rf /tmp/sztpd-simulator
curl -kL https://watsen.net/support/sztpd-simulator-0.0.11.tgz | tar -zxvf - -C /tmp/
cd /tmp/sztpd-simulator/pki
echo === SERVER SBI certificates ===
echo "DNS.2 = bootstrap" >> sztpd1/sbi/end-entity/openssl.cnf
echo "DNS.3 = web" >> sztpd1/sbi/end-entity/openssl.cnf
echo "DNS.4 = redirecter" >> sztpd1/sbi/end-entity/openssl.cnf
make pki SHELL=/bin/ash
echo === SERVER SBI certificates ===
make -C sztpd1/sbi pki SHELL=/bin/ash
cat sztpd1/sbi/end-entity/my_cert.pem sztpd1/sbi/intermediate2/my_cert.pem > /tmp/cert_chain.pem
openssl crl2pkcs7 -nocrl -certfile /tmp/cert_chain.pem -outform DER -out /tmp/cert_chain.cms
echo === CLIENT cert DevID trust anchor ===
make -C client pki SHELL=/bin/ash
cat client/root-ca/my_cert.pem client/intermediate1/my_cert.pem client/intermediate2/my_cert.pem > /tmp/ta_cert_chain.pem
openssl crl2pkcs7 -nocrl -certfile /tmp/ta_cert_chain.pem -outform DER -out /tmp/ta_cert_chain.cms
echo === COPY TO FINAL DESTINATION ===
Expand Down
2 changes: 1 addition & 1 deletion sztp-agent/pkg/secureagent/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (a *Agent) getBootstrapURL() error {
}
a.SetBootstrapURL(extractfromLine(line, `(?m)[^"]*`, 1))
} else {
log.Printf(" File " + a.DhcpLeaseFile + " does not exist\n")
log.Printf("[ERROR] File " + a.DhcpLeaseFile + " does not exist\n")
return errors.New(" File " + a.DhcpLeaseFile + " does not exist\n")
}
log.Println("[INFO] Bootstrap URL retrieved successfully: " + a.GetBootstrapURL())
Expand Down
4 changes: 2 additions & 2 deletions sztp-agent/pkg/secureagent/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func GetSerialNumber(givenSerialNumber string) string {
serialNumber := ""
product, err := ghw.Product()
if err != nil {
log.Printf("Error getting products info: %v", err)
log.Printf("[ERROR] Error getting products info: %v", err)
} else {
serialNumber = product.SerialNumber
}
Expand All @@ -141,7 +141,7 @@ func generateInputJSONContent() string {
hwModel := ""
baseboard, err := ghw.Baseboard()
if err != nil {
log.Printf("Error getting baseboard info: %v", err)
log.Printf("[ERROR] Error getting baseboard info: %v", err)
} else {
hwModel = baseboard.Product
}
Expand Down

0 comments on commit ed28e76

Please sign in to comment.