Ejemplo n.º 1
0
    def configure_selinux_task_default_test(self):
        """Test SELinux configuration task - SELinux default."""
        content = """
        SELINUX=foo
        """

        with tempfile.TemporaryDirectory() as sysroot:
            os.makedirs(os.path.join(sysroot, "etc/selinux/"))
            with open(os.path.join(sysroot, "etc/selinux/config"), "wt") as f:
                f.write(content)
                f.close()

            # check the default value in the SELinux config file is not changed
            ConfigureSELinuxTask(sysroot=sysroot,
                                 selinux_mode=SELinuxMode.DEFAULT).run()

            with open(os.path.join(sysroot, "etc/selinux/config")) as f:
                self.assertEqual(f.read().strip(), content.strip())
Ejemplo n.º 2
0
    def install_with_tasks(self):
        """Return the installation tasks of this module.

        :returns: list of installation tasks
        """
        return [
            ConfigureSELinuxTask(
                sysroot=conf.target.system_root,
                selinux_mode=self.selinux
            ),
            ConfigureFingerprintAuthTask(
                sysroot=conf.target.system_root,
                fingerprint_auth_enabled=self.fingerprint_auth_enabled
            ),
            ConfigureAuthselectTask(
                sysroot=conf.target.system_root,
                authselect_options=self.authselect
            )
        ]