|
Dmitry Belyavskiy |
640f24 |
diff -up openssh-8.7p1/pathnames.h.kill-scp openssh-8.7p1/pathnames.h
|
|
Dmitry Belyavskiy |
640f24 |
--- openssh-8.7p1/pathnames.h.kill-scp 2021-09-16 11:37:57.240171687 +0200
|
|
Dmitry Belyavskiy |
640f24 |
+++ openssh-8.7p1/pathnames.h 2021-09-16 11:42:29.183427917 +0200
|
|
Dmitry Belyavskiy |
640f24 |
@@ -42,6 +42,7 @@
|
|
Dmitry Belyavskiy |
640f24 |
#define _PATH_HOST_XMSS_KEY_FILE SSHDIR "/ssh_host_xmss_key"
|
|
Dmitry Belyavskiy |
640f24 |
#define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key"
|
|
Dmitry Belyavskiy |
640f24 |
#define _PATH_DH_MODULI SSHDIR "/moduli"
|
|
Dmitry Belyavskiy |
72aea6 |
+#define _PATH_SCP_KILL_SWITCH SSHDIR "/disable_scp"
|
|
Dmitry Belyavskiy |
640f24 |
|
|
Dmitry Belyavskiy |
640f24 |
#ifndef _PATH_SSH_PROGRAM
|
|
Dmitry Belyavskiy |
640f24 |
#define _PATH_SSH_PROGRAM "/usr/bin/ssh"
|
|
Dmitry Belyavskiy |
640f24 |
diff -up openssh-8.7p1/scp.1.kill-scp openssh-8.7p1/scp.1
|
|
Dmitry Belyavskiy |
640f24 |
--- openssh-8.7p1/scp.1.kill-scp 2021-09-16 12:09:02.646714578 +0200
|
|
Dmitry Belyavskiy |
640f24 |
+++ openssh-8.7p1/scp.1 2021-09-16 12:26:49.978628226 +0200
|
|
Dmitry Belyavskiy |
640f24 |
@@ -278,6 +278,13 @@ to print debugging messages about their
|
|
Dmitry Belyavskiy |
f561c6 |
By default a 32KB buffer is used.
|
|
Dmitry Belyavskiy |
f561c6 |
.El
|
|
Dmitry Belyavskiy |
640f24 |
.El
|
|
Dmitry Belyavskiy |
640f24 |
+.Pp
|
|
Dmitry Belyavskiy |
640f24 |
+Usage of SCP protocol can be blocked by creating a world-readable
|
|
Dmitry Belyavskiy |
72aea6 |
+.Ar /etc/ssh/disable_scp
|
|
Dmitry Belyavskiy |
640f24 |
+file. If this file exists, when SCP protocol is in use (either remotely or
|
|
Dmitry Belyavskiy |
640f24 |
+via the
|
|
Dmitry Belyavskiy |
640f24 |
+.Fl O
|
|
Dmitry Belyavskiy |
640f24 |
+option), the program will exit.
|
|
Dmitry Belyavskiy |
640f24 |
.Sh EXIT STATUS
|
|
Dmitry Belyavskiy |
640f24 |
.Ex -std scp
|
|
Dmitry Belyavskiy |
640f24 |
.Sh SEE ALSO
|
|
Dmitry Belyavskiy |
640f24 |
diff -up openssh-8.7p1/scp.c.kill-scp openssh-8.7p1/scp.c
|
|
Dmitry Belyavskiy |
640f24 |
--- openssh-8.7p1/scp.c.kill-scp 2021-09-16 11:42:56.013650519 +0200
|
|
Dmitry Belyavskiy |
640f24 |
+++ openssh-8.7p1/scp.c 2021-09-16 11:53:03.249713836 +0200
|
|
Dmitry Belyavskiy |
640f24 |
@@ -596,6 +596,14 @@ main(int argc, char **argv)
|
|
Dmitry Belyavskiy |
640f24 |
if (iamremote)
|
|
Dmitry Belyavskiy |
640f24 |
mode = MODE_SCP;
|
|
Dmitry Belyavskiy |
640f24 |
|
|
Dmitry Belyavskiy |
640f24 |
+ if (mode == MODE_SCP) {
|
|
Dmitry Belyavskiy |
640f24 |
+ FILE *f = fopen(_PATH_SCP_KILL_SWITCH, "r");
|
|
Dmitry Belyavskiy |
640f24 |
+ if (f != NULL) {
|
|
Dmitry Belyavskiy |
640f24 |
+ fclose(f);
|
|
Dmitry Belyavskiy |
640f24 |
+ fatal("SCP protocol is forbidden via %s", _PATH_SCP_KILL_SWITCH);
|
|
Dmitry Belyavskiy |
640f24 |
+ }
|
|
Dmitry Belyavskiy |
640f24 |
+ }
|
|
Dmitry Belyavskiy |
640f24 |
+
|
|
Dmitry Belyavskiy |
640f24 |
if ((pwd = getpwuid(userid = getuid())) == NULL)
|
|
Dmitry Belyavskiy |
640f24 |
fatal("unknown user %u", (u_int) userid);
|
|
Dmitry Belyavskiy |
640f24 |
|