Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting os.py with a polkit converter #1

Closed
ghost opened this issue Apr 20, 2017 · 4 comments
Closed

Supporting os.py with a polkit converter #1

ghost opened this issue Apr 20, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2017

Greetings, more than an issue (unfortunately Github doesn't have something like suggestions), this "issue" may be something that can help you, or can benefit both of us on the long term (if you don't mind my inexperience with python so far, and my failures on english from time to time)

I was checking some of the code in os.py inside the library, as long as I understand (correct me if I am wrong) there is no way that you can run a program with pkexec as long as you don't define a policy file. Your code might be able to check if the polkit agent is running, but if you don't define that file, the program will not run at all.

It might be on very early stages, but I forked a code based on some comments and a forum that should allow you to create some policy file templates for you to use in any application. So far the downside is that it only check on applications that are on /usr/bin, so other applications like blueberry or lightdm-settings whose launcher relies on other directories like /usr/lib are not included

You can [check my repository here] and let me know if something of that is useful for you or if that code doesn't work at all for you (I don't mind if you believe that, you may have your reasons and I respect that), it is written in Bash so porting to Python might take some work (at least for me)
EDIT: I will be reuploading the repository so I can give you the code in a pastebin if you wish

Sorry if I may sound rude, but is not my intention

@clefebvre
Copy link
Member

Hi Sam,

I'm not convinced but I'm interested in looking at it.

Either way thanks for helping, you don't sound rude, you sound helpful.

@clefebvre
Copy link
Member

I used to set DISPLAY and XAUTHORITY but it was buggy.

pkexec thinks it's running /usr/bin/env (as opposed to the executable itself), and in some cases it failed altogether (although I think that's because I used to call Popen() instead of call()).

@ghost
Copy link
Author

ghost commented Apr 27, 2017

I see, in this particular case I am still studying the code and see what else can I do, since my tests are done on Archlinux instead of Mint or LMDE there might be things quite different (for example, not being able to enable guest session on LightDM and Slick greeter) or similar (like the usage of pkexec and gksu on some other programs like lightdm-settings or pia-manager)

I am still reading about Python and Gtk so I can see what else can I achieve or help in these cases, about the code, you can look at it in this repository , like I said it is written on Bash, so I am still looking on how to port it to Python or check if it will be of good usage

@clefebvre
Copy link
Member

Quick follow-up after conversation and PRs. We've moved to pkexec almost everywhere, and as you stated with the addition of policy files. We also couldn't integrate this directly into a python library so this was done in the tools directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant