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

fix: add polkit rules for yubikey #231

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions files/etc/polkit-1/rules.d/org.debian.pcsc-lite.access_card.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// allow members of the wheel group to access gpg cards via pcscd service
// this is needed for access to yubikey devices
// installation details from https://github.com/drduh/YubiKey-Guide/issues/376

polkit.addRule(function(action, subject) {
if (action.id == "org.debian.pcsc-lite.access_card" &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id == "org.debian.pcsc-lite.access_pcsc" &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
36 changes: 36 additions & 0 deletions rpmspec/ublue-os-polkit-rules.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Name: ublue-os-polkit-rules
Packager: ublue-os
Vendor: ublue-os
Version: 0.1
Release: 1%{?dist}
Summary: Additional polkit rules

License: MIT
URL: https://github.com/ublue-os/config

BuildArch: noarch
Supplements: systemd-udev

Source0: ublue-os-polkit-rules.tar.gz

%global sub_name %{lua:t=string.gsub(rpm.expand("%{NAME}"), "^ublue%-os%-", ""); print(t)}

%description
Adds various polkit rules for improving device support

%prep
%setup -q -c -T

%install
tar xf %{SOURCE0} -C %{buildroot}%{_datadir}/%{VENDOR} --strip-components=1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be causing the CI problems. From the logs

tar xf /tmp/ublue-os/rpmbuild/SOURCES/ublue-os-polkit-rules.tar.gz -C /tmp/ublue-os/rpmbuild/BUILDROOT/ublue-os-polkit-rules-0.1-1.fc39.x86_64/usr/share/ublue-os --strip-components=1
tar: /tmp/ublue-os/rpmbuild/SOURCES/ublue-os-polkit-rules.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a long time since I packaged anything in RPM. @storopoli Do you know why it may not be creating the tar?


mkdir -p -m0755 %{buildroot}%{_exec_prefix}/polkit-1/rules.d

cp %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name}/etc/polkit-1/rules.d/*.rules %{buildroot}%{_exec_prefix}/polkit-1/rules.d

%files
%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/etc/polkit-1/rules.d/*.rules

%changelog
* Sun Mar 10 2024 Justin Garrison <[email protected]> - 0.1
- Add polkit rules for yubikey access
Loading