-
Notifications
You must be signed in to change notification settings - Fork 232
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
feat: enhance privilege elevation logic #722
feat: enhance privilege elevation logic #722
Conversation
按照操作习惯,是否可以先尝试 sudo? |
这样的话,如果桌面用户在脚本中使用 |
我开始想开启这个 PR 的观念就是,对于有着 Linux Desktop 环境的用户,调用 pkexec 使用 Polkit 来对桌面端有着更好的集成,同时也可以寄予桌面端用户更好的提示。 |
您好,关于 XDG_CURRENT_DESKTOP 我会在下一个 commit 移除,我想了下并不是所有的使用 polkit 的都使用 有桌面环境。
只有 run 命令拥有这个参数。并且不影响以前的兼容性
如果有着pkexec 更好管理,个人理解。并且如果脚本本身已经 sudo 了过后,就不会触发 pkexec |
我是觉得如果作为兼容性考虑,放到 sudo 后面,作为 fallback 是没问题的,放到前面可能会引起更多 break? |
另外, dae 作为命令行工具,是否要和桌面集成也是一个问题 |
有人认为优先polkit会导致每次使用都需要输入密码,而sudo至少是免密一段时间。doas或许是个更好的选择。 |
IMO, the preferred order of precedence is "sudo > doas > polkit". |
现在顺序是 sudo -> doas -> polkit 加了一条 info 日志来提示使用的提升权限的工具。 另外,提到的冗余代码,这样写是更明显表示是 root ,冗余无所谓。 最后感谢对于 run0 的提醒。 Doas test Conf
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧪 Since the PR has been fully tested, please consider merging it.
Thanks for your contribution! |
Background
我查看代码发现 cmd/internal/su.go 内部中,对于dae自动使用sudo 来提权对于 linux 桌面端的支持并不是特别完善。
同时方式只有 sudo 方案,对于一些应用程序非 root 运行,需要向 stdin 内部输入 sudo 密码来提权。
同时使用 os.Geteuid 来兼容 setgid.
Checklist
Full Changelogs
把 cmd/internal/su.go 内部的提权分为了两部分
Issue Reference
no
Test Result