summaryrefslogtreecommitdiff
path: root/dev-python/paramiko/files/paramiko-3.2.0-disable-server.patch
blob: 942f5161ee6f2af41106595694d33deddd0ed7c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From a47e9bdc80224c9ceafcea6da5cea1539ddfbd4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 26 May 2023 06:05:13 +0200
Subject: [PATCH 3/3] Disable server component due to security issues

---
 paramiko/transport.py | 4 ++++
 tests/conftest.py     | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/paramiko/transport.py b/paramiko/transport.py
index 8785d6bb..803d07d1 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -120,6 +120,8 @@ from paramiko.util import (
 )
 
 
+SERVER_DISABLED_BY_GENTOO = True
+
 # for thread cleanup
 _active_threads = []
 
@@ -768,6 +770,8 @@ class Transport(threading.Thread, ClosingContextManager):
             `.SSHException` -- if negotiation fails (and no ``event`` was
             passed in)
         """
+        if SERVER_DISABLED_BY_GENTOO:
+            raise Exception("Disabled by Gentoo for security reasons. Enable with 'server' USE flag")
         if server is None:
             server = ServerInterface()
         self.server_mode = True
diff --git a/tests/conftest.py b/tests/conftest.py
index 7546aae4..804a289e 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -16,6 +16,7 @@ from paramiko import (
     Ed25519Key,
     ECDSAKey,
     PKey,
+    transport,
 )
 
 from ._loop import LoopSocket
@@ -23,6 +24,10 @@ from ._stub_sftp import StubServer, StubSFTPServer
 from ._util import _support
 
 
+# We need the server component for testing
+transport.SERVER_DISABLED_BY_GENTOO = False
+
+
 # Perform logging by default; pytest will capture and thus hide it normally,
 # presenting it on error/failure. (But also allow turning it off when doing
 # very pinpoint debugging - e.g. using breakpoints, so you don't want output
-- 
2.40.1