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 select
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
SERVER_KEY = paramiko.Ed25519Key.from_private_key_file("daemon.key")
|
||||||
|
|
||||||
|
|
||||||
class CustomServer(paramiko.ServerInterface):
|
class CustomServer(paramiko.ServerInterface):
|
||||||
def __init__(self, username):
|
def __init__(self, username):
|
||||||
|
@ -70,9 +72,7 @@ def handle_tcp_forwarding(channel, origin, destination):
|
||||||
def handle_client(client_sock):
|
def handle_client(client_sock):
|
||||||
try:
|
try:
|
||||||
transport = paramiko.Transport(client_sock)
|
transport = paramiko.Transport(client_sock)
|
||||||
transport.add_server_key(
|
transport.add_server_key(SERVER_KEY)
|
||||||
paramiko.Ed25519Key.from_private_key_file("daemon.key")
|
|
||||||
)
|
|
||||||
|
|
||||||
server = CustomServer(None)
|
server = CustomServer(None)
|
||||||
transport.start_server(server=server)
|
transport.start_server(server=server)
|
||||||
|
|
Loading…
Reference in a new issue