Skip to content

Commit daf82bb

Browse files
committed
refactor(ns-audit): simplify report generation by integrating tar.gz creation and latest symlink into API
- Remove /usr/sbin/ns-audit wrapper script - Integrate tar.gz bundle generation directly in ns.audit API generate method - Automatically create/update 'latest' symlink pointing to newly generated report - Update Makefile to remove installation of ns-audit.py - Update README.md documentation
1 parent 0c13a07 commit daf82bb

141 files changed

Lines changed: 96169 additions & 31 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1705.patch

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
From 9d730a39cb17f7118daaecfa282e2a669352ea6b Mon Sep 17 00:00:00 2001
2+
From: Giacomo Sanchietti <giacomo.sanchietti@nethesis.it>
3+
Date: Wed, 3 Jun 2026 13:14:10 +0200
4+
Subject: [PATCH] fix(storage): handle changes from OpenWrt 25
5+
6+
Changes:
7+
- /rom partition is not mounted on first boot,
8+
from the second boot, it's mounted twice also in loop
9+
- stop all services that using the storage before unmounting
10+
to avoid resource busy errors
11+
- before unmounting, wait for all processes to finish
12+
writing files
13+
- restart the services that are using the storage when
14+
the configuration changes so they can reconfigure themself
15+
---
16+
packages/ns-storage/files/add-storage | 7 ++++++-
17+
packages/ns-storage/files/ns-storage-dhcp-leases | 7 +++----
18+
packages/ns-storage/files/remove-storage | 16 ++++++++++++++--
19+
3 files changed, 23 insertions(+), 7 deletions(-)
20+
21+
diff --git a/packages/ns-storage/files/add-storage b/packages/ns-storage/files/add-storage
22+
index 11851168c..9aa15d682 100755
23+
--- a/packages/ns-storage/files/add-storage
24+
+++ b/packages/ns-storage/files/add-storage
25+
@@ -50,4 +50,9 @@ crontab -l | grep -q '/usr/sbin/sync-data' || echo '40 1 * * * /usr/sbin/sync-da
26+
/usr/libexec/ns-openvpn/openvpn-merge-connections-db
27+
28+
# Setup persistent dnsmasq leases file
29+
-/usr/libexec/ns-storage-dhcp-leases
30+
\ No newline at end of file
31+
+/usr/libexec/ns-storage-dhcp-leases
32+
+
33+
+# Restart services that will use the storage
34+
+/etc/init.d/dnsmasq restart
35+
+/etc/init.d/victoria-metrics restart
36+
+/etc/init.d/victoria-logs restart 2>/dev/null || :
37+
diff --git a/packages/ns-storage/files/ns-storage-dhcp-leases b/packages/ns-storage/files/ns-storage-dhcp-leases
38+
index 027b6f88a..f5318ea5e 100644
39+
--- a/packages/ns-storage/files/ns-storage-dhcp-leases
40+
+++ b/packages/ns-storage/files/ns-storage-dhcp-leases
41+
@@ -37,13 +37,12 @@ fi
42+
if [ "${current_leasefile}" != "${target_leasefile}" ]; then
43+
if [ "${current_leasefile}" = "${STORAGE_LEASEFILE}" ]; then
44+
# From storage to tmp
45+
- cp -af "${STORAGE_LEASEFILE}" "${TMP_LEASEFILE}" || :
46+
+ cp -af "${STORAGE_LEASEFILE}" "${TMP_LEASEFILE}" 2>/dev/null || :
47+
else
48+
# From tmp to storage
49+
mkdir -p "${STORAGE_DIR}"
50+
- cp -af "${TMP_LEASEFILE}" "${STORAGE_LEASEFILE}" || :
51+
+ cp -af "${TMP_LEASEFILE}" "${STORAGE_LEASEFILE}" 2>/dev/null || :
52+
fi
53+
uci set dhcp.ns_dnsmasq.leasefile="$target_leasefile"
54+
uci commit dhcp
55+
- reload_config
56+
-fi
57+
\ No newline at end of file
58+
+fi
59+
diff --git a/packages/ns-storage/files/remove-storage b/packages/ns-storage/files/remove-storage
60+
index 1dde7d33a..6afacf7d1 100644
61+
--- a/packages/ns-storage/files/remove-storage
62+
+++ b/packages/ns-storage/files/remove-storage
63+
@@ -7,7 +7,7 @@
64+
65+
set -e
66+
67+
-rom_part=$(lsblk -ln | grep "/rom" | uniq | awk '{print $1}')
68+
+rom_part=$(lsblk -ln | grep "/boot" | uniq | awk '{print $1}')
69+
rom_disk=$(lsblk -lno pkname /dev/$rom_part)
70+
71+
data_part=$(mount | grep /mnt/data | uniq | awk '{print $1}')
72+
@@ -26,6 +26,13 @@ uci commit rsyslog
73+
crontab -l | grep -v "/usr/sbin/sync-data" | sort | uniq | crontab -
74+
/etc/init.d/cron restart
75+
76+
+# Stop process that will prevent umount
77+
+/etc/init.d/dnsmasq stop
78+
+/etc/init.d/victoria-metrics stop
79+
+/etc/init.d/victoria-logs stop 2>/dev/null || :
80+
+# Sync and wait for the disk to be free
81+
+sync && sleep 5
82+
+
83+
# Umounting data device
84+
umount -f /mnt/data
85+
rm -rf /mnt/data
86+
@@ -36,4 +43,9 @@ if [ "$rom_disk" == "$data_disk" ]; then
87+
fi
88+
89+
# Restore dnsmasq to /tmp before the storage disappears.
90+
-/usr/libexec/ns-storage-dhcp-leases
91+
\ No newline at end of file
92+
+/usr/libexec/ns-storage-dhcp-leases
93+
+
94+
+# Start services
95+
+/etc/init.d/dnsmasq start
96+
+/etc/init.d/victoria-metrics start
97+
+/etc/init.d/victoria-logs start 2>/dev/null || :

a.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
for file in /rom/etc/profile.d; do
2+
echo cp "$file" /etc/profile.d/
3+
done

fixes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- from the report, remove the "Run: " from the header
2+
- on the hader, add the hostname of the machine
3+
- check if a subscription is present, value is info
4+
- improve the css, it must be more similar to the firewall: use the style from https://192.168.100.237/
5+
6+
- if ha is enabled, is a big plus
7+
8+
test on:
9+
- testing machine: ssh root@192.168.100.237
10+
- testing on production machine, DO NOT CHANGE the configuration: ssh root@fw.gs.nethserver.net

0 commit comments

Comments
 (0)