From 6532d70f98f4e00ca3d2bc0da7615558e10f946e Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 15 May 2018 21:14:05 +0000
Subject: shellinabox: update to 2.20

---
 abs/extra/shellinabox/PKGBUILD             | 16 ++++++++++++----
 abs/extra/shellinabox/shellinaboxd.include | 13 +++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/abs/extra/shellinabox/PKGBUILD b/abs/extra/shellinabox/PKGBUILD
index fc9a679..baa19a5 100644
--- a/abs/extra/shellinabox/PKGBUILD
+++ b/abs/extra/shellinabox/PKGBUILD
@@ -1,5 +1,5 @@
 pkgname=shellinabox
-pkgver=2.19
+pkgver=2.20
 pkgrel=1
 _pkghash=master
 pkgdesc="Implementation of a web server that can export arbitrary command line tools to a web based terminal emulator"
@@ -18,10 +18,18 @@ build() {
   #change default to show onscreen keyboard
   sed -i "s/this.softKeyboard         = false;/this.softKeyboard         = true;/g" ./shellinabox/vt100.jspp
 
+  #fix unsupported option errors with openssh
+  find . -name "service.c" -exec sed -i -e "s|-oRhostsRSAAuthentication=no||g" {} \;
+  find . -name "service.c" -exec sed -i -e "s|-oRSAAuthentication=no||g" {} \; 
+
   autoreconf -i
   export CPPFLAGS="${CPPFLAGS/-D_FORTIFY_SOURCE=2/}"
   ./configure  --prefix=/usr
-  make 
+
+  #fix ssl libs
+  sed -i -e "s|LIBS = -lz -ldl -lutil|LIBS = -lz -ldl -lutil -lssl -lcrypto|g" ./Makefile
+
+  make
 }
 package() {
   cd "$srcdir/$pkgname-${_pkghash}"
@@ -33,6 +41,6 @@ package() {
   #gen_light_conf
   install -D -m 744 ${srcdir}/shellinaboxd.gen_light_conf.d ${pkgdir}/etc/gen_light_conf.d/shellinaboxd.conf
 }
-md5sums=('7b7d178a2ec5b63f2b31b2869aa7b755'
-         'dd46ab61bfafdb56ea705a876963550e'
+md5sums=('20e8876ce8637ebf4fc98b1e7807bed9'
+         '4c5ce3c17bed94ca71ebafba7f934bba'
          'aadd1edf4110aca2d16d806791e90019')
diff --git a/abs/extra/shellinabox/shellinaboxd.include b/abs/extra/shellinabox/shellinaboxd.include
index 8d2befa..405a323 100644
--- a/abs/extra/shellinabox/shellinaboxd.include
+++ b/abs/extra/shellinabox/shellinaboxd.include
@@ -1,3 +1,16 @@
+#redirect http to https for /shell
+server.modules += ( "mod_redirect" )
+
+$HTTP["url"] =~ "^/shell" {
+  $HTTP["scheme"] == "http" {
+    # capture vhost name with regex conditiona -> %0 in redirect pattern
+    # must be the most inner block to the redirect rule
+    $HTTP["host"] =~ ".*" {
+      url.redirect = (".*" => "https://%0$0")
+    }
+  }
+}
+
 #proxy for shellinaboxd
 $HTTP["url"] =~ "/shell/" {
     proxy.server = ( "" => (
-- 
cgit v0.12