Skip to content

Commit

Permalink
Merge pull request #2334 from reubenmiller/issue-2154-c8y-bridge-perm…
Browse files Browse the repository at this point in the history
…issions
  • Loading branch information
reubenmiller authored Oct 13, 2023
2 parents 2724cc9 + 753537c commit 0047f08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/core/tedge/src/cli/connect/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ fn write_bridge_config_to_file(
common_draft.persist()?;

let config_path = get_bridge_config_file_path(config_location, bridge_config);
let mut config_draft = DraftFile::new(config_path)?;
let mut config_draft = DraftFile::new(config_path)?.with_mode(0o644);
bridge_config.serialize(&mut config_draft)?;
config_draft.persist()?;

Expand Down
14 changes: 14 additions & 0 deletions tests/RobotFramework/tests/tedge_connect/tedge_connect_test.robot
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ tedge_connect_test_positive
${output}= Execute Command sudo tedge connect c8y --test
Should Contain ${output} Connection check to c8y cloud is successful.

Non-root users should be able to read the mosquitto configuration files #2154
[Tags] \#2154
Execute Command sudo tedge connect c8y || true
Should Have File Permissions /etc/tedge/mosquitto-conf/tedge-mosquitto.conf 644 root:root
Should Have File Permissions /etc/tedge/mosquitto-conf/c8y-bridge.conf 644 root:root


tedge_connect_test_negative
Execute Command sudo tedge disconnect c8y
${output}= Execute Command sudo tedge connect c8y --test exp_exit_code=1 stdout=${False} stderr=${True}
Expand All @@ -32,3 +39,10 @@ tedge_disconnect_test_sm_services
Should Contain ${output} Cumulocity Bridge successfully disconnected!
Should Contain ${output} tedge-agent service successfully stopped and disabled!
Should Contain ${output} tedge-mapper-c8y service successfully stopped and disabled!

*** Keywords ***

Should Have File Permissions
[Arguments] ${file} ${expected_permissions}
${FILE_MODE_OWNERSHIP}= Execute Command stat -c '%a %U:%G' ${file} strip=${True}
Should Be Equal ${FILE_MODE_OWNERSHIP} ${expected_permissions} msg=Unexpected file permissions/ownership of ${file}

1 comment on commit 0047f08

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
319 0 3 319 100 57m27.907s

Please sign in to comment.