File: test_logging.py

package info (click to toggle)
cloud-init 22.4.2-1%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,088 kB
  • sloc: python: 108,898; sh: 4,091; makefile: 147; xml: 22
file content (22 lines) | stat: -rw-r--r-- 736 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Integration tests relating to cloud-init's logging."""


class TestVarLogCloudInitOutput:
    """Integration tests relating to /var/log/cloud-init-output.log."""

    def test_var_log_cloud_init_output_not_world_readable(self, client):
        """
        The log can contain sensitive data, it shouldn't be world-readable.

        LP: #1918303
        """
        # Check the file exists
        assert client.execute("test -f /var/log/cloud-init-output.log").ok

        # Check its permissions are as we expect
        perms, user, group = client.execute(
            "stat -c %a:%U:%G /var/log/cloud-init-output.log"
        ).split(":")
        assert "640" == perms
        assert "root" == user
        assert "adm" == group