Skip to content

Commit 8ba2333

Browse files
committed
Add debian build
This adds a debian build for usteer including the following packages: usteer (usteerd, usteer.service) usteer-tools (ap-monitor, fakeap) This relies on the recent debian/ packaging additions to libubox and ubus as well as the new libnl-unl package, which provides a component present in libnl-tiny missing from stock libnl-3: https://github.com/russdill/libnl-unl It also requires the packaged rpcd: openwrt/rpcd#20 This is currently for proof of concept and experimentation, as the debian package of hostapd does not contain any of the ubus endpoints.
1 parent 1d6524c commit 8ba2333

File tree

11 files changed

+150
-0
lines changed

11 files changed

+150
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,15 @@ install_manifest.txt
99
.vscode/
1010
*.patch
1111
*.orig
12+
obj-*
13+
debian/.debhelper/
14+
debian/*.debhelper
15+
debian/debhelper-build-stamp
16+
debian/*.debhelper.log
17+
debian/*.substvars
18+
debian/files
19+
debian/usteer/
20+
debian/usteer-tools/
21+
debian/changelog
22+
debian/tmp/
1223

debian/control

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Source: usteer
2+
Section: net
3+
Priority: optional
4+
Maintainer: You <you@example.com>
5+
Build-Depends:
6+
debhelper-compat (= 13),
7+
cmake,
8+
pkg-config,
9+
libpcap-dev,
10+
libjson-c-dev,
11+
libubus-dev,
12+
libubox-dev,
13+
libnl-3-dev, libnl-genl-3-dev, libnl-unl-dev
14+
Standards-Version: 4.7.0
15+
Homepage: https://github.com/openwrt/usteer
16+
Rules-Requires-Root: no
17+
18+
Package: usteer
19+
Architecture: any
20+
Multi-Arch: same
21+
Depends: ${shlibs:Depends}, ${misc:Depends}, ubus, ubusd, hostapd, rpcd
22+
Recommends: rpcd-mod-hostapd, rpcd-mod-iwinfo
23+
Description: AP client steering daemon
24+
usteer coordinates client roaming between APs using hostapd and ubus.
25+
On Debian it runs as a systemd service and uses rpcd/ubus for control.
26+
(Optional nl80211 support is enabled automatically if libnl-tiny is present.)
27+
28+
Package: usteer-tools
29+
Architecture: any
30+
Multi-Arch: same
31+
Depends: ${shlibs:Depends}, ${misc:Depends}
32+
Description: Utilities for usteer (monitoring & testing)
33+
Installs 'ap-monitor' (pcap-based passive monitor) and 'fakeap' test tool.

debian/generate-changelog.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
cd "$(dirname "$0")/.."
4+
5+
COMMIT_DATE=$(git log -1 --format='%cd' --date=format:'%Y%m%d' 2>/dev/null || echo '00000000')
6+
COMMIT_HASH=$(git log -1 --format='%h' 2>/dev/null || echo 'unknown')
7+
COMMIT_TIMESTAMP=$(git log -1 --format='%cd' --date=rfc2822 2>/dev/null || date -R)
8+
9+
cat > debian/changelog <<EOF
10+
usteer (0.0.${COMMIT_DATE}) unstable; urgency=medium
11+
12+
* Latest version (${COMMIT_HASH})
13+
14+
-- Russ Dill <russ.dill@gmail.com> ${COMMIT_TIMESTAMP}
15+
EOF

debian/rules

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/make -f
2+
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
3+
4+
NL3_CFLAGS := $(shell pkg-config --cflags libnl-genl-3.0 libnl-3.0 libnl-unl)
5+
NL3_LIBS := $(shell pkg-config --libs libnl-genl-3.0 libnl-3.0 libnl-unl)
6+
7+
%:
8+
dh $@ --buildsystem=cmake
9+
10+
override_dh_auto_configure:
11+
dh_auto_configure -- \
12+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
13+
-DCMAKE_INSTALL_PREFIX=/usr \
14+
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
15+
-DNL_CFLAGS="$(NL3_CFLAGS)" \
16+
-DNL_LIBS="$(NL3_LIBS)" \
17+
-DNL_LDFLAGS="$(NL3_LIBS)"
18+
19+
override_dh_auto_install:
20+
dh_auto_install --destdir=$(CURDIR)/debian/tmp
21+
22+
install -d debian/tmp/usr/bin
23+
[ -f obj-*/ap-monitor ] && install -m 0755 obj-*/ap-monitor debian/tmp/usr/bin/ap-monitor || true
24+
[ -f obj-*/fakeap ] && install -m 0755 obj-*/fakeap debian/tmp/usr/bin/fakeap || true
25+
26+
override_dh_installsystemd:
27+
# Install the unit but do not auto-enable/start
28+
dh_installsystemd --name=usteer --no-enable --no-start

debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

debian/usteer-tools.install

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
usr/bin/ap-monitor
2+
usr/bin/fakeap

debian/usteer.install

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
usr/sbin/usteerd
2+
debian/usteer.service lib/systemd/system/

debian/usteer.postinst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
set -e
3+
case "$1" in
4+
configure)
5+
if ! getent group usteer >/dev/null; then addgroup --system usteer; fi
6+
if ! id usteer >/dev/null 2>&1; then
7+
adduser --system --ingroup usteer --home /var/lib/usteer --no-create-home \
8+
--disabled-login --shell /usr/sbin/nologin usteer
9+
fi
10+
install -d -o usteer -g usteer -m 0750 /var/lib/usteer
11+
systemctl daemon-reload >/dev/null 2>&1 || true
12+
;;
13+
esac
14+
exit 0

debian/usteer.prerm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
set -e
3+
if [ "$1" = remove ] && [ -d /run/systemd/system ]; then
4+
systemctl stop usteer.service >/dev/null 2>&1 || true
5+
fi
6+
exit 0

debian/usteer.service

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[Unit]
2+
Description=usteer client steering daemon
3+
Documentation=https://github.com/openwrt/usteer
4+
After=network-online.target ubusd.service hostapd.service rpcd.service
5+
Wants=network-online.target ubusd.service hostapd.service rpcd.service
6+
7+
[Service]
8+
Type=simple
9+
User=usteer
10+
Group=usteer
11+
ExecStart=/usr/sbin/usteerd
12+
Restart=on-failure
13+
RestartSec=2
14+
15+
# Hardening
16+
NoNewPrivileges=true
17+
PrivateTmp=true
18+
ProtectSystem=strict
19+
ProtectHome=true
20+
ProtectKernelTunables=true
21+
ProtectKernelModules=true
22+
ProtectKernelLogs=true
23+
ProtectControlGroups=true
24+
PrivateDevices=true
25+
RestrictAddressFamilies=AF_UNIX
26+
RestrictRealtime=true
27+
RestrictSUIDSGID=true
28+
LockPersonality=true
29+
MemoryDenyWriteExecute=true
30+
SystemCallArchitectures=native
31+
ReadOnlyPaths=/run/ubus/ubus.sock
32+
ReadWritePaths=/var/lib/usteer
33+
34+
[Install]
35+
WantedBy=multi-user.target
36+

0 commit comments

Comments
 (0)