Skip to content

Commit

Permalink
Change default common name of Edge CA cert to "aziot-edge CA" (Azure#…
Browse files Browse the repository at this point in the history
…5998)

This affects the certd config generated by running `iotedge config apply`,
as well as a new Edge CA cert issued when the current one expires *and*
the common name has not been set explicitly in certd config already.

Fixes Azure#5937
Ref Azure#4740

Also fix iotedge-check tests to not require sudo access.

Ref Azure#5927 (comment)
  • Loading branch information
arsing authored and lt72 committed Jan 31, 2022
1 parent 5e5ba74 commit 37f0b15
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions edgelet/contrib/config/linux/template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
# # Optional EST configuration for issuing the Edge CA certificate below.
# # If not set, the defaults in [cert_issuance.est] will be used.
#
# common_name = "iotedged workload ca"
# common_name = "aziot-edge CA"
# expiry_days = 90
# url = "https://example.org/.well-known/est"
#
Expand Down Expand Up @@ -368,7 +368,7 @@
#
# # Optional configuration below.
#
# common_name = "iotedged workload ca"
# common_name = "aziot-edge CA"
# expiry_days = 90

# ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion edgelet/edgelet-http-workload/src/module/cert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pub(crate) async fn check_edge_ca(
if should_renew(&cert_client, edge_ca_cert).await? {
log::info!("Requesting new Edge CA certificate...");

let common_name = format!("iotedged workload ca {}", device_id);
let common_name = format!("aziot-edge CA {}", device_id);
let keys = edge_ca_keys(key_connector, key_handle)?;

let extensions = edge_ca_extensions().map_err(|_| {
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/src/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ fn get_local_service_proxy_setting(svc_name: &str) -> Option<String> {
const PROXY_KEY: &str = "https_proxy";
let output = Command::new("sh")
.arg("-c")
.arg("sudo systemctl show --property=Environment ".to_owned() + svc_name)
.arg("systemctl show --property=Environment ".to_owned() + svc_name)
.output()
.expect("failed to execute process");
let stdout = String::from_utf8_lossy(&output.stdout);
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/src/config/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AZIOT_EDGED_HOMEDIR_PATH: &str = "/var/lib/aziot/edged";
const TRUST_BUNDLE_USER_ALIAS: &str = "trust-bundle-user";

// TODO: Dedupe this with edgelet-http-workload
const IOTEDGED_COMMONNAME_PREFIX: &str = "iotedged workload ca";
const IOTEDGED_COMMONNAME_PREFIX: &str = "aziot-edge CA";

pub fn execute(config: &Path) -> Result<(), std::borrow::Cow<'static, str>> {
// In production, running as root is the easiest way to guarantee the tool has write access to every service's config file.
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/test-files/config/ca-certs-est/certd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ identity_cert = "est-id-aziot-edged-ca"
identity_pk = "est-id-aziot-edged-ca"
bootstrap_identity_cert = "est-bootstrap-id-aziot-edged-ca"
bootstrap_identity_pk = "est-bootstrap-id-aziot-edged-ca"
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca", "trust-bundle-user"]
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/test-files/config/ca-quickstart/certd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 30
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/test-files/config/dps-tpm/certd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/test-files/config/dps-x509/certd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"
expiry_days = 90
method = "self_signed"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/test-files/config/manual-x509/certd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/test-files/config/nested-edge/certd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homedir_path = "/var/lib/aziot/certd"
[cert_issuance.aziot-edged-ca]
method = "self_signed"
expiry_days = 90
common_name = "iotedged workload ca my-device"
common_name = "aziot-edge CA my-device"

[preloaded_certs]
aziot-edged-trust-bundle = ["aziot-edged-ca"]
Expand Down

0 comments on commit 37f0b15

Please sign in to comment.