Add NACM rules
NACM completely bypasses sysrepo permissions, so some rules need to be
set up. Now that the default shell for non-root users is netconf-cli, we
can completely forget about the sysrepo permissions, and only focus on
NACM. The default configuration for everyone is to allow reading and
disallow writing of everything. This patch changes this to allow root to
do anything and also allow the dwdm user to manipulate a subset of
installed modules.
Change-Id: Ifbb18957ba8a692b4a34ba37dba666b60819a2e6
diff --git a/package/czechlight-cfg-fs/nacm-restore.service b/package/czechlight-cfg-fs/nacm-restore.service
new file mode 100644
index 0000000..96dfb7c
--- /dev/null
+++ b/package/czechlight-cfg-fs/nacm-restore.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Restore NACM rules
+After=netopeer2-install-yang.service czechlight-install-yang.service cfg.mount
+Requires=netopeer2-install-yang.service czechlight-install-yang.service cfg.mount
+Before=netopeer2-setup.service netopeer2.service sysrepo-persistent-cfg.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/sysrepocfg -d startup -m ietf-netconf-acm -f json --import=/usr/share/yang-data/nacm.json
+ExecStart=/bin/sysrepocfg -C startup
+
+[Install]
+WantedBy=multi-user.target