From: Paul Hänsch Date: Thu, 1 Nov 2018 17:13:45 +0000 (+0100) Subject: redirect HTTP requests to mockup web server X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=462f5b00c78def3eef69550b76e7e56f706e6f80;p=rpi_small redirect HTTP requests to mockup web server --- diff --git a/Makefile b/Makefile index 6f810da..8e8fe91 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ deb http://raspbian.raspberrypi.org/raspbian stretch main non-free firmware rpi\ deb http://archive.raspberrypi.org/debian stretch main\n endef -PACKAGES := apt apt-transport-https bluez bluez-firmware bluez-tools bridge-utils btrfs-tools busybox-static bzip2 ca-certificates cron deborphan dnsmasq firmware-atheros firmware-brcm80211 firmware-libertas firmware-linux-free firmware-misc-nonfree firmware-realtek gzip htop ifupdown init iptables iputils-ping irqbalance isc-dhcp-client less libraspberrypi-bin libraspberrypi0 make net-tools nmap ntpdate openssh-client openssh-server p7zip-full pi-bluetooth rpi-update rsync ssh sshfs sudo systemd traceroute unace unrar-free unzip vim wget wireless-tools wpasupplicant xz-utils zip +PACKAGES := apt apt-transport-https bluez bluez-firmware bluez-tools bridge-utils btrfs-tools busybox-static bzip2 ca-certificates cron deborphan dnsmasq firmware-atheros firmware-brcm80211 firmware-libertas firmware-linux-free firmware-misc-nonfree firmware-realtek gzip htop ifupdown init iptables iputils-ping irqbalance isc-dhcp-client less libraspberrypi-bin libraspberrypi0 make net-tools nmap ntpdate openbsd-inetd openssh-client openssh-server p7zip-full pi-bluetooth rpi-update rsync ssh sshfs sudo systemd traceroute unace unrar-free unzip vim wget wireless-tools wpasupplicant xz-utils zip # Do not change, only override in config.mk WIFI-SSID = diff --git a/files/etc/dnsmasq.conf b/files/etc/dnsmasq.conf index dc15f81..38b9bbb 100644 --- a/files/etc/dnsmasq.conf +++ b/files/etc/dnsmasq.conf @@ -3,3 +3,5 @@ bind-interfaces dhcp-authoritative dhcp-range=192.168.82.16,192.168.82.254,48h + +address=/#/192.168.82.1 diff --git a/files/etc/inetd.conf b/files/etc/inetd.conf new file mode 100644 index 0000000..0480d69 --- /dev/null +++ b/files/etc/inetd.conf @@ -0,0 +1 @@ +80 stream tcp nowait nobody /bin/sed sed -nrf /srv/webserver.sed diff --git a/files/srv/webserver.sed b/files/srv/webserver.sed new file mode 100755 index 0000000..f509a6c --- /dev/null +++ b/files/srv/webserver.sed @@ -0,0 +1,25 @@ +#!/bin/sed -nrf + +:START +/\r?\n\r?$/bRESPONSE; N; bSTART; + +:RESPONSE + +/\nHost: oktopus\r?\n/{ +s;^.*$;;; +iHTTP/1.1 200 OK\r\ +Content-Type: text/html; encoding=utf-8\r\ +Connection: close\r\ +\r\ +Oktopus

Oktopus

Oktopus +p +q +} + +s;^.*$;;; +iHTTP/1.1 307 Temporary Redirect\r\ +Location: http://oktopus\r\ +Connection: close\r\ +\r\ +p +q