mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Allow kernel keyring CCACHE when supported
Server and client installer should allow kernel keyring ccache when supported. https://fedorahosted.org/freeipa/ticket/4013
This commit is contained in:
committed by
Petr Viktorin
parent
b6540e88d8
commit
9677308caa
@@ -17,6 +17,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
from ipapython.ipautil import run
|
||||
|
||||
# NOTE: Absolute path not required for keyctl since we reset the environment
|
||||
@@ -47,6 +49,21 @@ def get_real_key(key):
|
||||
raise ValueError('key %s not found' % key)
|
||||
return stdout.rstrip()
|
||||
|
||||
def get_persistent_key(key):
|
||||
(stdout, stderr, rc) = run(['keyctl', 'get_persistent', KEYRING, key], raiseonerr=False)
|
||||
if rc:
|
||||
raise ValueError('persistent key %s not found' % key)
|
||||
return stdout.rstrip()
|
||||
|
||||
def is_persistent_keyring_supported():
|
||||
uid = os.geteuid()
|
||||
try:
|
||||
get_persistent_key(str(uid))
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def has_key(key):
|
||||
"""
|
||||
Returns True/False whether the key exists in the keyring.
|
||||
|
||||
Reference in New Issue
Block a user