Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill in the 'Country' for generated certificates #1592

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt update
sudo apt install -y podman=4:4.6.2-0ubuntu22.04+obs81.2
sudo apt install -y podman
sudo systemctl start podman
- uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -331,7 +331,7 @@ jobs:
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt update
sudo apt install -y podman=4:4.6.2-0ubuntu22.04+obs81.2
sudo apt install -y podman
sudo systemctl start podman

- uses: actions/setup-python@v4
Expand Down
1 change: 1 addition & 0 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func certificateAuthoritySetup(c *clab.CLab) error {
// define the attributes used to generate the CA Cert
caCertInput := &cert.CACSRInput{
CommonName: c.Config.Name + " lab CA",
Country: "US",
Expiry: validityDuration,
Organization: "containerlab",
KeySize: keySize,
Expand Down
2 changes: 1 addition & 1 deletion nodes/default_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ func (d *DefaultNode) LoadOrGenerateCertificate(certInfra *cert.Cert, topoName s
}
hosts = append(hosts, nodeConfig.SANs...)

// collect cert details
certInput := &cert.NodeCSRInput{
CommonName: nodeConfig.ShortName + "." + topoName + ".io",
Hosts: hosts,
Organization: "containerlab",
Country: "US",
KeySize: d.Cfg.Certificate.KeySize,
Expiry: d.Cfg.Certificate.ValidityDuration,
}
Expand Down
10 changes: 5 additions & 5 deletions tests/01-smoke/10-ca-parameter.robot
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Review Root Certificate
... openssl x509 -in ${ca-cert-file} -text
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Issuer: C = , L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Subject: C = , L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Issuer: C = US, L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Subject: C = US, L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Public-Key: (${ca-keysize} bit)

Node l1 cert and key files should exist
Expand All @@ -64,7 +64,7 @@ Review Node l1 Certificate
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} CN = l1.${lab-name}.io
Should Contain ${output} Issuer: C = , L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Issuer: C = US, L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Public-Key: (${l1-keysize} bit)

Review Node l2 Certificate
Expand All @@ -73,7 +73,7 @@ Review Node l2 Certificate
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} CN = l2.${lab-name}.io
Should Contain ${output} Issuer: C = , L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Issuer: C = US, L = , O = containerlab, OU = , CN = ${lab-name} lab CA
Should Contain ${output} Public-Key: (${l2-keysize} bit)

Verfiy node cert l1 with CA Cert
Expand Down Expand Up @@ -109,7 +109,7 @@ Get Certificate Date
... ${certificate_output}
... Not ${type}\\W*: (\\w{3}\\W+\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\d{4} \\w{3})
... 1
[Return] ${date}[0]
RETURN ${date}[0]

Check Certificat Validity Duration
[Arguments] ${certificate_output} ${expected_duration}
Expand Down