Skip to contentSkip to conversation

How to restore a policy module

DISCUSSION Kim Lawson-Jenkins 5 participants 7 messages Mar 21, 2014 SELinux security module

lore
Share & tools
lore
#0 lore raw

In an attempt to lockdown a system I removed the remotelogin policy module using semodule -r. I'm using the targeted policy on RHEL6. How do I add this file back to my current configuration?

#1 lore raw
Quoted 3 lines · Kim Lawson-Jenkins

In an attempt to lockdown a system I removed the remotelogin policy module using semodule –r. I’m using the targeted policy on RHEL6. How do I add this file back to my current configuration?

You can always do a yum reinstall selinux-policy-targeted to fully reinstall the policy, or you could individually install that policy module. Used to be the case that a copy of each module was available under /usr/share/selinux/targeted, so you could do a semodule -i /usr/share/selinux/targeted/remotelogin.pp if that exists (but it seems to have gone away in recent Fedora, likely to save on storage).

#2 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 3 lines · Kim Lawson-Jenkins

In an attempt to lockdown a system I removed the remotelogin policy module using semodule –r. I’m using the targeted policy on RHEL6. How do I add this file back to my current configuration?

You can always do a yum reinstall selinux-policy-targeted to fully reinstall the policy, or you could individually install that policy module. Used to be the case that a copy of each module was available under /usr/share/selinux/targeted, so you could do a semodule -i /usr/share/selinux/targeted/remotelogin.pp if that exists (but it seems to have gone away in recent Fedora, likely to save on storage).

Also, if you add:
save-previous = true
to your /etc/selinux/semanage.conf
it will keep a copy of your previous policy under /etc/selinux/targeted/modules/previous on each transaction, making it easier to rollback changes.

#3 lore raw

Thanks everyone for the rapid answers. I was able to restore the file.

Kim

-----Original Message-----
From: Stephen Smalley [mailto:[email protected]]
Sent: Friday, March 21, 2014 9:35 AM
To: [email protected]; [email protected]
Subject: Re: How to restore a policy module

Quoted 11 lines · Stephen Smalley
Quoted 3 lines · Kim Lawson-Jenkins

In an attempt to lockdown a system I removed the remotelogin policy module using semodule -r. I'm using the targeted policy on RHEL6. How do I add this file back to my current configuration?

You can always do a yum reinstall selinux-policy-targeted to fully reinstall the policy, or you could individually install that policy module. Used to be the case that a copy of each module was available under /usr/share/selinux/targeted, so you could do a semodule -i /usr/share/selinux/targeted/remotelogin.pp if that exists (but it seems to have gone away in recent Fedora, likely to save on storage).

Also, if you add:
save-previous = true
to your /etc/selinux/semanage.conf
it will keep a copy of your previous policy under /etc/selinux/targeted/modules/previous on each transaction, making it easier to rollback changes.

#4 lore raw
In reply to Kim Lawson-Jenkins

Hello Kim,

i'd downloaded rpm, containing relevant module, unpacked it and then used semodule -i /path/to/module.pp to replace it.
Also, i think simple reinstall of the policy would do the trick.

Here's what i base my assumption on:

root@selinux:/root # cp /etc/selinux/custom/modules/active/modules/apt.pp /tmp/
root@selinux:/root # semodule -l | grep apt
apt 1.8.2
root@selinux:/root # semodule -r apt
root@selinux:/root # ls -la /etc/selinux/custom/modules/active/modules/apt*
ls: cannot access /etc/selinux/custom/modules/active/modules/apt*: No such file or directory
root@selinux:/root # semodule -i /tmp/apt.pp
root@selinux:/root # ls -la /etc/selinux/custom/modules/active/modules/apt* -rw-------. 1 root root 6814 Mar 21 13:33 /etc/selinux/custom/modules/active/modules/apt.pp

regards,
ilya

Quoted 20 lines · Kim Lawson-Jenkins

In an attempt to lockdown a system I removed the remotelogin policy module using semodule –r. I’m using the targeted policy on RHEL6. How do I add this file back to my current configuration?

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].

#5 lore raw
In reply to Kim Lawson-Jenkins
Quoted 4 lines · Kim Lawson-Jenkins

In an attempt to lockdown a system I removed the remotelogin policy module using semodule -r. I'm using the targeted policy on RHEL6. How do I add this file back to my current configuration?

The pp file for the module will still be in /usr/share/selinux/targeted/.

To reinstall the module do:
semodule -i /usr/share/selinux/remotelogin.pp.bz2

Signature · 2 lines
James Carter <[email protected]>
National Security Agency
#6 lore raw
In reply to Kim Lawson-Jenkins

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 14 lines · Kim Lawson-Jenkins

In an attempt to lockdown a system I removed the remotelogin policy module using semodule ?r. I?m using the targeted policy on RHEL6. How do I add this file back to my current configuration?

Quoted 5 lines

_______________________________________________ Selinux mailing list [email protected] To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].

yum reinstall selinux-policy-targeted

Should do it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlMshhsACgkQrlYvE4MpobOIsQCghsLBWa3m8QxihXmjXsmm8UcE 708AmgOi7Hp1e1FRGMyuohfqonoS4fQQ
=PP3O
-----END PGP SIGNATURE-----