Add xinetd gopher request filter example daemon. - geomyidae - A small C-based gopherd.
(HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 72b56b76bbd9616ec82b59b4a6541ca40ab4e660
(DIR) parent 147e063355b1560f40584b7ddb11f8831e350753
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 17 Mar 2021 22:18:34 +0100
Add xinetd gopher request filter example daemon.
Diffstat:
A xinetd-gopher-request-filter.conf | 23 +++++++++++++++++++++++
A xinetd-gopher-request-filter.sh | 18 ++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
(DIR) 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
+}
+
(DIR) 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
+