From 4049feb6e445c12202f6ac0d8f94b5530097716b Mon Sep 17 00:00:00 2001
From: j1nx
Date: Wed, 1 Jun 2022 15:18:04 +0200
Subject: [PATCH] Allow the mycroft user full NetworkManager privileges
---
.../rootfs-overlay/etc/NetworkManager/conf.d/polkit.conf | 2 ++
.../rules.d/50-org.freedesktop.NetworkManager.rules | 8 ++++++++
2 files changed, 10 insertions(+)
create mode 100644 buildroot-external/rootfs-overlay/etc/NetworkManager/conf.d/polkit.conf
create mode 100644 buildroot-external/rootfs-overlay/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules
diff --git a/buildroot-external/rootfs-overlay/etc/NetworkManager/conf.d/polkit.conf b/buildroot-external/rootfs-overlay/etc/NetworkManager/conf.d/polkit.conf
new file mode 100644
index 00000000..11095ae0
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/NetworkManager/conf.d/polkit.conf
@@ -0,0 +1,2 @@
+[main]
+auth-polkit=true
diff --git a/buildroot-external/rootfs-overlay/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules b/buildroot-external/rootfs-overlay/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules
new file mode 100644
index 00000000..4b50cf88
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules
@@ -0,0 +1,8 @@
+/* give group 'network' rights to change settings */
+/* taken from https://wiki.archlinux.org/index.php/NetworkManager#Set_up_PolicyKit_permissions */
+
+polkit.addRule(function(action, subject) {
+ if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
+ return polkit.Result.YES;
+ }
+});