SMACK LSM Module behaves strangely
I want the following:
- I want to use openssl to change the keys. So, I created the directory “/etc/keys” which I labelled “keys“. I created a file “key” with same access “keys” and another key file “forbiddenkey” with access “forbidden” under the directory “etc/keys“.
- I made the openssl command execute as “secure“.
- I made the following rules
secure keys rw
secure forbidden – - I tested the rules as shown in the figure below and they seem to work.
-
But when I tried to actually run the command it didn’t work even though the WRITE access is allowed to /etc/keys and /etc/keys/key
openssl rand 32 > /etc/keys/key
The error message is as follows
-bash: /etc/keys/key: Permission denied
The audit message is as follows
VirtualBox kernel: [ 1274.037659] audit: type=1400 audit(1500117397.021:8): lsm=SMACK fn=smack_inode_getattr action=denied subject=”_” object=”keys” requested=r pid=2574 comm=”pool” path=”/etc/keys” dev=”sda1″ ino=3932692
It’s strange that I ran openssl with execute “secure” as subject but I get in audit as “floor(_)”. Can anyone identify the mistake?
Greets,
Satya