mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-21 19:40:11 +00:00
Introduce polkit policies
This commit is contained in:
parent
43a1a228b8
commit
c6cdc4c84a
@ -48,6 +48,8 @@ install: $(ODIR)/wihotspot-gui
|
|||||||
install -Dm644 desktop/icons/hotspot@512.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
|
install -Dm644 desktop/icons/hotspot@512.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
|
||||||
install -Dm644 desktop/icons/hotspot.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
|
install -Dm644 desktop/icons/hotspot.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
|
||||||
install -Dm644 desktop/wifihotspot.desktop $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
|
install -Dm644 desktop/wifihotspot.desktop $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
|
||||||
|
install -Dm644 scripts/policies/polkit.rules $(DESTDIR)$(PREFIX)/share/polkit-1/rules.d/90-org.opensuse.policykit.wihotspot.rules
|
||||||
|
install -Dm644 scripts/policies/polkit.policy $(DESTDIR)$(PREFIX)/share/polkit-1/actions/org.opensuse.policykit.wihotspot.policy
|
||||||
install -Dm755 $(ODIR)/wihotspot-gui $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
|
install -Dm755 $(ODIR)/wihotspot-gui $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
|
||||||
cd scripts && $(MAKE) install
|
cd scripts && $(MAKE) install
|
||||||
|
|
||||||
@ -59,6 +61,8 @@ uninstall:
|
|||||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
|
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
|
||||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
|
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
|
||||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
|
rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/share/polkit-1/rules.d/90-org.opensuse.policykit.wihotspot.rules
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/share/polkit-1/actions/org.opensuse.policykit.wihotspot.policy
|
||||||
rm -f $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
|
rm -f $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
|
||||||
cd scripts && $(MAKE) uninstall
|
cd scripts && $(MAKE) uninstall
|
||||||
|
|
||||||
|
35
src/scripts/policies/polkit.policy
Normal file
35
src/scripts/policies/polkit.policy
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE policyconfig PUBLIC
|
||||||
|
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||||
|
<policyconfig>
|
||||||
|
|
||||||
|
<action id="org.opensuse.policykit.wihotspot-gui">
|
||||||
|
<message>Authentication is required to run the Wihotspot</message>
|
||||||
|
<icon_name>wihotspot</icon_name>
|
||||||
|
<defaults>
|
||||||
|
<allow_any>auth_admin</allow_any>
|
||||||
|
<allow_inactive>auth_admin</allow_inactive>
|
||||||
|
<allow_active>yes</allow_active>
|
||||||
|
</defaults>
|
||||||
|
<annotate
|
||||||
|
key="org.freedesktop.policykit.exec.path">/usr/bin/wihotspot-gui</annotate>
|
||||||
|
<annotate
|
||||||
|
key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<action id="org.opensuse.policykit.create-ap">
|
||||||
|
<message>Authentication is required to run the Wihotspot</message>
|
||||||
|
<icon_name>wihotspot</icon_name>
|
||||||
|
<defaults>
|
||||||
|
<allow_any>auth_admin</allow_any>
|
||||||
|
<allow_inactive>auth_admin</allow_inactive>
|
||||||
|
<allow_active>yes</allow_active>
|
||||||
|
</defaults>
|
||||||
|
<annotate
|
||||||
|
key="org.freedesktop.policykit.exec.path">/usr/bin/create_ap</annotate>
|
||||||
|
<annotate
|
||||||
|
key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
</policyconfig>
|
11
src/scripts/policies/polkit.rules
Normal file
11
src/scripts/policies/polkit.rules
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* Allow users in admin group to run GParted without authentication */
|
||||||
|
polkit.addRule(function(action, subject) {
|
||||||
|
if ( action.id == "org.opensuse.policykit.create-ap" ) {
|
||||||
|
|
||||||
|
if (subject.isInGroup("sudo")) {
|
||||||
|
return polkit.Result.YES;
|
||||||
|
} else {
|
||||||
|
return polkit.Result.AUTH_ADMIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Start wihotspot-gui as root user
|
# Start wihotspot-gui
|
||||||
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/wihotspot-gui
|
/usr/bin/wihotspot-gui
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
<property name="gravity">center</property>
|
<property name="gravity">center</property>
|
||||||
<property name="program_name">Linux Wifi Hotspot</property>
|
<property name="program_name">Linux Wifi Hotspot</property>
|
||||||
<property name="version">3.7.0</property>
|
<property name="version">4.0.0</property>
|
||||||
<property name="copyright" translatable="yes">(c) lakinduakash 2021</property>
|
<property name="copyright" translatable="yes">(c) lakinduakash 2021</property>
|
||||||
<property name="comments" translatable="yes">For more info visit
|
<property name="comments" translatable="yes">For more info visit
|
||||||
https://github.com/lakinduakash/linux-wifi-hotspot</property>
|
https://github.com/lakinduakash/linux-wifi-hotspot</property>
|
||||||
|
@ -167,7 +167,7 @@ void write_accepted_macs(char* filename, char* accepted_macs){
|
|||||||
|
|
||||||
printf("mac filter file %s \n",filename);
|
printf("mac filter file %s \n",filename);
|
||||||
|
|
||||||
snprintf(cmd_write_mac,BUFSIZE,"%s '%s' %s %s","echo", accepted_macs, "| sudo tee", filename);
|
snprintf(cmd_write_mac,BUFSIZE,"%s '%s' %s %s","echo", accepted_macs, "| pkexec -u root tee", filename);
|
||||||
int r=system(cmd_write_mac);
|
int r=system(cmd_write_mac);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user