summary refs log tree commit diff
diff options
context:
space:
mode:
authorWout Mertens <Wout.Mertens@gmail.com>2021-01-15 15:18:55 +0100
committerWout Mertens <Wout.Mertens@gmail.com>2021-01-16 14:38:18 +0100
commitcd0fa5ae486525cda83515a5bb52e1f444202bae (patch)
tree181df7e716692ebab79db9829d66150c756c9ebf
parent17631db07caeb9cfb6acefd6a91cdd995b5b3f3f (diff)
downloadnixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.tar
nixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.tar.gz
nixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.tar.bz2
nixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.tar.lz
nixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.tar.xz
nixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.tar.zst
nixpkgs-cd0fa5ae486525cda83515a5bb52e1f444202bae.zip
scponly: init at 4.8
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
-rw-r--r--pkgs/shells/scponly/default.nix39
-rw-r--r--pkgs/shells/scponly/scponly-fix-make.patch21
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/shells/scponly/default.nix b/pkgs/shells/scponly/default.nix
new file mode 100644
index 00000000000..c0c39d8e316
--- /dev/null
+++ b/pkgs/shells/scponly/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, lib, fetchFromGitHub, openssh, debugLevel ? 0 }:
+
+stdenv.mkDerivation {
+  pname = "scponly";
+  version = "4.8";
+
+  src = fetchFromGitHub {
+    owner = "scponly";
+    repo = "scponly";
+    rev = "d8ca58257b9905186aa5706f35813d5f80ea07c1";
+    sha256 = "U0K7lOp18ytNjh3KVFmc6vL+/tG4ETnwLEPQEhM4lXE=";
+  };
+
+  patches = [ ./scponly-fix-make.patch ];
+
+  buildInputs = [ openssh ];
+
+  # Add path to sftp-server so configure finds it
+  preConfigure = "export PATH=$PATH:${openssh}/libexec";
+
+  # chroot doesn't seem to work, so not enabling
+  # rsync could also be optionally enabled
+  configureFlags = [ "--enable-winscp-compat" ];
+
+  postInstall = lib.optionalString (debugLevel > 0) ''
+    mkdir -p $out/etc/scponly && echo ${
+      toString debugLevel
+    } > $out/etc/scponly/debuglevel
+  '';
+
+  passthru.shellPath = "/bin/scponly";
+
+  meta = with lib; {
+    description = "A shell that only permits scp and sftp-server";
+    homepage = "https://github.com/scponly/scponly";
+    license = with licenses; [ bsd2 ];
+    maintainers = with maintainers; [ wmertens ];
+  };
+}
diff --git a/pkgs/shells/scponly/scponly-fix-make.patch b/pkgs/shells/scponly/scponly-fix-make.patch
new file mode 100644
index 00000000000..e8522ec8e6e
--- /dev/null
+++ b/pkgs/shells/scponly/scponly-fix-make.patch
@@ -0,0 +1,21 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -41,14 +41,14 @@
+ 	${INSTALL} -d ${DESTDIR}${bindir}
+ 	${INSTALL} -d ${DESTDIR}${mandir}/man8
+ 	${INSTALL} -d ${DESTDIR}${CONFDIR}
+-	${INSTALL} -o 0 -g 0 scponly ${DESTDIR}${bindir}/scponly
+-	${INSTALL} -o 0 -g 0 -m 0644 scponly.8 ${DESTDIR}${mandir}/man8/scponly.8
+-	${INSTALL} -o 0 -g 0 -m 0644 debuglevel ${DESTDIR}${DEBUGFILE}
++	${INSTALL} scponly ${DESTDIR}${bindir}/scponly
++	${INSTALL} -m 0644 scponly.8 ${DESTDIR}${mandir}/man8/scponly.8
++	${INSTALL} -m 0644 debuglevel ${DESTDIR}${DEBUGFILE}
+ 	if test "x${CHROOTED_NAME}" != "x"; then			\
+ 		${INSTALL} -d ${DESTDIR}${sbindir};				\
+ 		rm -f ${DESTDIR}${sbindir}/${CHROOTED_NAME};			\
+ 		cp scponly ${CHROOTED_NAME};				\
+-		${INSTALL} -o 0 -g 0 -m 4755 ${CHROOTED_NAME} ${DESTDIR}${sbindir}/${CHROOTED_NAME};	\
++		${INSTALL} ${CHROOTED_NAME} ${DESTDIR}${sbindir}/${CHROOTED_NAME};	\
+ 	fi
+ 
+ debuglevel:
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9a2eed406c7..ccd2fd0cdfb 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9168,6 +9168,8 @@ in
 
   pash = callPackage ../shells/pash { };
 
+  scponly = callPackage ../shells/scponly { };
+
   tcsh = callPackage ../shells/tcsh { };
 
   rush = callPackage ../shells/rush { };