summaryrefslogtreecommitdiff
blob: 19450cbee1bce69c94af512a686fafda7dc5e8d7 (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
diff --git a/paramiko/transport.py b/paramiko/transport.py
index f72eebaf..ec7a1445 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -110,6 +110,8 @@ from paramiko.ssh_exception import (
 from paramiko.util import retry_on_signal, ClosingContextManager, clamp_value
 
 
+SERVER_DISABLED_BY_GENTOO = True
+
 # for thread cleanup
 _active_threads = []
 
@@ -633,6 +635,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 2b509c5c..bb23ac74 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -4,7 +4,7 @@ import shutil
 import threading
 
 import pytest
-from paramiko import RSAKey, SFTPServer, SFTP, Transport
+from paramiko import RSAKey, SFTPServer, SFTP, Transport, transport
 
 from .loop import LoopSocket
 from .stub_sftp import StubServer, StubSFTPServer
@@ -15,6 +15,10 @@ from .util import _support
 # 'nicer'.
 
 
+# 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