Dne 10.9.2016 v 18:29 Kevin Fenzi napsal(a):
On Fri, 9 Sep 2016 14:21:33 -0500
"Dustin C. Hatch" <dustin.hatch(a)firemon.com> wrote:
> On 08/29/2016 11:00 AM, Kevin Fenzi wrote:
>> consolehelper should long be deprecated these days
>
> Out of curiosity, what is the preferred method for self-elevating
> programs written in an interpreted language, then?
PolicyKit.
Looks like there was an attempt in ~f20 to replace all the old
consolehelper/usermode packages with polkit, but I guess it didn't get
done.
http://fedoraproject.org/wiki/Features/UsermodeMigration
I tried to convert mock to use pkexec. Here it is:
https://github.com/xsuchy/mock-1/commit/4276ef488ac2d134504173d88a8a58fc0...
However I experienced several issues, which I am unable to resolve due the lack of
documentation around pkexec. Maybe
somebody will know:
* it seems that it works only in GUI. In plain VT (without display manager) I get
polkit-agent-helper-1: error response to PolicyKit daemon:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No
session for cookie
and followed by "Not authorized"
* in GUI I am able to proceed, but the code will stop at:
https://github.com/xsuchy/mock-1/blob/devel/py/mock.py#L543
because neither SUDO_UID nor USERHELPER_UID.
Is there any way to recognize that I'm running inside of pkexec and that I'm
able to drop privileges?
--
Miroslav Suchy, RHCA
Red Hat, Senior Software Engineer, #brno, #devexp, #fedora-buildsys