summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-07-23 16:28:14 +0100
committerKatolaZ <katolaz@freaknet.org>2018-07-23 16:28:14 +0100
commit6ebc6b6d4fbd63428ea7c3e9f8e3bc18407600d9 (patch)
treedca42882b11806fc3579033f5bde69cb1e49b01c
parent1df435313418065be6eb6ab2f7aaf47b9a3876e6 (diff)
.gph files are now rendered as gophermaps
-rw-r--r--README.md20
-rwxr-xr-xgosher6
2 files changed, 24 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2518c6e..7480473 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,10 @@ to modify the values of the variables `NETCAT` and `STYLE` in `gosher`
If the selector is a directory, `gosher` will look for a file named
`gophermap` to render the submenu. If a `gophermap` does not exist,
`gosher` looks for the index.gph gopherfile in the folder and, if it
-exists, renders it as a gophermap.
+exists, renders it as a gophermap. If the required selector has a '.gph'
+extension, `gosher` will treat it as a gopherpile, and render it as a
+gophermap.
+
## Which netcat?
@@ -47,6 +50,21 @@ combination for your version of `netcat`:
**N.B.: Using STYLE='pipe' is preferable, since the '-c' option used by
the 'fork' mode is a potential security risk**
+
+## Running `gosher` under `chroot`
+
+In general, it makes sense to run a server in a `chroot` environment, to
+reduce the risks connected with remote exploits. If you would like to
+run `gosher` under `chroot` be sure to have the following binaries (and
+the corresponding libs) available in the chroot-ed environment:
+
+```
+ basename cat cut mkfifo netcat realpath rm sed sh
+```
+
+Obviously, `netcat` will be your preferred `netcat` implementation.
+
+
## Why `gosher`?
Just for fun. There are only a few TCP/IP application protocols left
diff --git a/gosher b/gosher
index 31e9abf..3dda536 100755
--- a/gosher
+++ b/gosher
@@ -209,7 +209,11 @@ case $selector in
if [ "${RP1}" = "${RP2}" ]; then
if [ -f "${RP1}" ]; then
- serve_selector "${RP1}"
+ if [ -n "$(echo $RP1 | sed -n '/\.gph$/p')" ]; then
+ serve_index $RP1
+ else
+ serve_selector "${RP1}"
+ fi
elif [ -d "${RP1}" ]; then
[ -f "${RP1}/gophermap" ] && serve_selector "${RP1}/gophermap"
[ -f "${RP1}/index.gph" ] && serve_index "${RP1}/index.gph"