Ssh: globalvar for ssh key
This commit is contained in:
parent
984425021e
commit
b39e36e11d
1 changed files with 3 additions and 3 deletions
|
@ -4,6 +4,8 @@ import threading
|
|||
import select
|
||||
import sys
|
||||
|
||||
SERVER_KEY = paramiko.Ed25519Key.from_private_key_file("daemon.key")
|
||||
|
||||
|
||||
class CustomServer(paramiko.ServerInterface):
|
||||
def __init__(self, username):
|
||||
|
@ -70,9 +72,7 @@ def handle_tcp_forwarding(channel, origin, destination):
|
|||
def handle_client(client_sock):
|
||||
try:
|
||||
transport = paramiko.Transport(client_sock)
|
||||
transport.add_server_key(
|
||||
paramiko.Ed25519Key.from_private_key_file("daemon.key")
|
||||
)
|
||||
transport.add_server_key(SERVER_KEY)
|
||||
|
||||
server = CustomServer(None)
|
||||
transport.start_server(server=server)
|
||||
|
|
Loading…
Reference in a new issue