Optionale Schreib-Schnittstelle zum Bearbeiten der statischen Leases einer dnsmasq.conf
198
Optionale Schreib-Schnittstelle zum Bearbeiten der statischen Leases (dhcp-host) in einer dnsmasq.conf. Sie gehört zur Webseite gerald77/dnsmasq-leases und wird von deren nginx unter /api/ angesprochen. Reines Node ohne Abhängigkeiten, kein veröffentlichter Port.
Quellcode, Tests und ausführliche Doku: https://github.com/geraldpublic/Dnsmasq-Leases
dhcp-host-Zeile oder hängt eine neue hinter der letzten an. Gelöscht wird nichts. Alles andere in der Datei (Kommentare, andere Optionen, Zeilenenden) bleibt Zeichen für Zeichen erhalten.dhcp-host-Zeilen erst nach einem Neustart. Die Schnittstelle startet nichts und hat keinen Zugriff auf den Docker-Socket.Die eingehängte dnsmasq.conf wird wirklich verändert. Eine Sicherung liegt im Volume /sicherung; trotzdem vorher prüfen, welche Datei eingehängt wird.
Zusammen mit der Webseite am einfachsten über Docker Compose (Profil bearbeiten, siehe Repository). Einzeln:
docker run -d --name dnsmasq-conf-api \
--user 1000:100 --read-only --cap-drop ALL \
--security-opt no-new-privileges:true \
-v /pfad/zur/dnsmasq.conf:/daten/dnsmasq.conf \
-v dnsmasq-conf-sicherung:/sicherung \
gerald77/dnsmasq-conf-api:latest
Der Benutzer (--user) braucht Schreibrecht auf die Datei; sonst meldet GET /api/status schreibbar: false und die Webseite bleibt schreibgeschützt. Die Webseite erreicht die Schnittstelle unter dem Containernamen dnsmasq-conf-api auf Port 3001, beide Container müssen im selben Docker-Netz liegen.
| Aufruf | Wirkung |
|---|---|
GET /api/status | { "schreibbar": true | false } |
POST /api/dhcp-host | neuen Eintrag hinter dem letzten dhcp-host anlegen |
PUT /api/dhcp-host/<zeile> | Zeile ersetzen; alt = Zeile, wie sie angezeigt wurde |
| Variable | Standard im Image | Bedeutung |
|---|---|---|
CONF_FILE | /daten/dnsmasq.conf | die zu ändernde Datei |
BACKUP_DIR | /sicherung | Ordner für die Sicherungen |
HOST | 0.0.0.0 | Adresse, an die gebunden wird |
PORT | 3001 | Port |
GET) übernimmt der nginx der Webseite über /etc/nginx/htpasswd.MIT-Lizenz (maßgeblich ist der englische Originaltext):
MIT License
Copyright (c) 2026 Gerald Brunner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Haftungsausschluss: Die Software wird „wie besehen" ohne jegliche Gewährleistung bereitgestellt. Die Nutzung erfolgt auf eigene Gefahr; die Autoren haften nicht für Schäden oder Datenverlust, die aus der Nutzung entstehen. Das gilt besonders für die Schnittstelle dnsmasq-conf-api, die die eingehängte dnsmasq.conf verändert.
Content type
Image
Digest
sha256:3561b142c…
Size
57.9 MB
Last updated
7 days ago
docker pull gerald77/dnsmasq-conf-api