commit 72b56b76bbd9616ec82b59b4a6541ca40ab4e660 parent 147e063355b1560f40584b7ddb11f8831e350753 Author: Christoph Lohmann <20h@r-36.net> Date: Wed, 17 Mar 2021 22:18:34 +0100 Add xinetd gopher request filter example daemon. Diffstat:
xinetd-gopher-request-filter.conf | | | 23 | +++++++++++++++++++++++ |
xinetd-gopher-request-filter.sh | | | 18 | ++++++++++++++++++ |
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/xinetd-gopher-request-filter.conf b/xinetd-gopher-request-filter.conf @@ -0,0 +1,23 @@ +# Adopt service to your needs. +service gopher +{ + socket_type = stream + protocol = tcp + only_from = 0.0.0.0/0 ::/0 + flags = IPv6 + + wait = no + user = gopherd + group = gopherd + groups = yes + server = /path/to/xinetd-gopher-request-filter.sh + instances = 50 + nice = 19 + + log_type = SYSLOG daemon debug + log_on_success = PID HOST EXIT DURATION + log_on_failure = HOST + + disable = no +} + diff --git a/xinetd-gopher-request-filter.sh b/xinetd-gopher-request-filter.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Copy me if you can. +# +# Change to fit to your original running geomyidae instance. +dstserver="localhost" +dstport="7070" + +read -r request +case "${request}" in +/bill-gates-chips-us-all|/something-secret) + printf "3The request cannot be handled\terror\t70\r\n" + ;; +*) + printf "%s\r\n" "${request}" | nc "${dstserver}" "${dstport}" + ;; +esac +