Reputation: 2207
I'm facing an issue in setting permissions on a named keyring created using keyctl. When I create a key manually using keyctl however I'm able to set permissions using setperm whereas the setperm command doesn't work if run against the keyring created using the aforementioned Go package.
DHIWAKAR_NAMED_KEYRING_FOUR was created using the Go package
DHIWAKARMANKEYRING was created manually using the keyctl command.
Here is a snippet of the output of the two commands that I ran, they're basically identical
[root@dhiwakar:keyctl (ad-default)]$ keyctl rdescribe 16677105
keyring;0;0;3f010000;DHIWAKAR_NAMED_KEYRING_FOUR
[root@dhiwakar:keyctl (ad-default)]$ keyctl rdescribe 33715012
keyring;0;0;3f010000;DHIWAKARMANKEYRING
[root@dhiwakar:keyctl (ad-default)]$ keyctl setperm 16677105 0x3f3f3f3f
keyctl_setperm: Permission denied
[root@dhiwakar:keyctl (ad-default)]$ keyctl setperm 33715012 0x3f3f3f3f
[root@dhiwakar:keyctl (ad-default)]$
Last but not least, here is the snippet of code used to create
fmt.Println("1 Get UserSessionKeyring")
UserSessionKeyring, err := keyctl.UserSessionKeyring()
if err != nil {
fmt.Println("ERROR for keyctl.UserSessionKeyring() is !!! ", err.Error())
os.Exit(1)
}
fmt.Println("2 Create a Named Keyring")
myKeyring, err := keyctl.CreateKeyring(UserSessionKeyring, "DHIWAKAR_NAMED_KEYRING_FOUR")
if err != nil {
fmt.Println("ERROR for keyctl.CreateKeyring() is !!! ", err.Error())
os.Exit(1)
}
Testing this on Rocky Linux release 8.8 (Green Obsidian)
Upvotes: 1
Views: 136