diff --git a/Dockerfile b/Dockerfile index 82075b6..138f24d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,5 +7,5 @@ COPY start_worker.sh start_scheduler.sh . COPY .git ./.git COPY *.py . COPY proxstar ./proxstar -RUN touch proxmox_ssh_key targets && chmod a+w proxmox_ssh_key targets # This is some OKD shit. +RUN touch targets && chmod a+w targets # This is some OKD shit. ENTRYPOINT ddtrace-run gunicorn proxstar:app --bind=0.0.0.0:8080 diff --git a/HACKING/.env.template b/HACKING/.env.template index 0e0371a..264ed24 100644 --- a/HACKING/.env.template +++ b/HACKING/.env.template @@ -26,9 +26,6 @@ PROXSTAR_PROXMOX_USER=api@pve PROXSTAR_PROXMOX_PASS= # Password for proxstar user PROXSTAR_PROXMOX_ISO_STORAGE=nfs-iso PROXSTAR_PROXMOX_VM_STORAGE=ceph -PROXSTAR_PROXMOX_SSH_USER=root -PROXSTAR_PROXMOX_SSH_KEY="" # Ask an RTP. This is gonna look like a certificate. -PROXSTAR_PROXMOX_SSH_KEY_PASS= # Password for above certificate # STARRS PROXSTAR_STARRS_DB_HOST=proxstar-postgres diff --git a/HACKING/lint.sh b/HACKING/lint.sh new file mode 100755 index 0000000..e69de29 diff --git a/config.py b/config.py index 4632f92..6865dda 100644 --- a/config.py +++ b/config.py @@ -37,10 +37,6 @@ PROXMOX_USER = environ.get('PROXSTAR_PROXMOX_USER', '') PROXMOX_PASS = environ.get('PROXSTAR_PROXMOX_PASS', '') PROXMOX_ISO_STORAGE = environ.get('PROXSTAR_PROXMOX_ISO_STORAGE', 'nfs-iso') PROXMOX_VM_STORAGE = environ.get('PROXSTAR_PROXMOX_VM_STORAGE', 'ceph') -PROXMOX_SSH_USER = environ.get('PROXSTAR_PROXMOX_SSH_USER', '') -PROXMOX_SSH_KEY = environ.get('PROXSTAR_PROXMOX_SSH_KEY', '') -PROXMOX_SSH_KEY_PASS = environ.get('PROXSTAR_PROXMOX_SSH_KEY_PASS', '') - # STARRS STARRS_DB_HOST = environ.get('PROXSTAR_STARRS_DB_HOST', '') STARRS_DB_NAME = environ.get('PROXSTAR_DB_NAME', 'starrs') diff --git a/proxstar/__init__.py b/proxstar/__init__.py index d3c1d6e..e1b889b 100644 --- a/proxstar/__init__.py +++ b/proxstar/__init__.py @@ -77,12 +77,6 @@ sentry_sdk.init( environment=app.config['SENTRY_ENV'], ) -if not os.path.exists('proxmox_ssh_key'): - with open('proxmox_ssh_key', 'w') as ssh_key_file: - ssh_key_file.write(app.config['PROXMOX_SSH_KEY']) - -ssh_tunnels = [] - auth = get_auth(app) redis_conn = Redis(app.config['REDIS_HOST'], app.config['REDIS_PORT']) @@ -630,11 +624,6 @@ def health(): def exit_handler(): stop_websockify() - for tunnel in ssh_tunnels: - try: - tunnel.stop() - except: - pass atexit.register(exit_handler) diff --git a/proxstar/proxmox.py b/proxstar/proxmox.py index 867af28..c310a72 100644 --- a/proxstar/proxmox.py +++ b/proxstar/proxmox.py @@ -23,24 +23,6 @@ def connect_proxmox(): raise -def connect_proxmox_ssh(): - for host in app.config['PROXMOX_HOSTS']: - try: - proxmox = ProxmoxAPI( - host, - user=app.config['PROXMOX_SSH_USER'], - private_key_file='proxmox_ssh_key', - password=app.config['PROXMOX_SSH_KEY_PASS'], - backend='ssh_paramiko', - ) - proxmox.version.get() - return proxmox - except: - if app.config['PROXMOX_HOSTS'].index(host) == (len(app.config['PROXMOX_HOSTS']) - 1): - logging.error('unable to connect to any of the given Proxmox servers') - raise - - def get_node_least_mem(proxmox): nodes = proxmox.nodes.get() sorted_nodes = sorted(nodes, key=lambda x: ('mem' not in x, x.get('mem', None))) diff --git a/proxstar/vnc.py b/proxstar/vnc.py index a91bc27..25c9e82 100644 --- a/proxstar/vnc.py +++ b/proxstar/vnc.py @@ -6,7 +6,6 @@ import urllib.parse from deprecated import deprecated import requests from flask import current_app as app -from sshtunnel import SSHTunnelForwarder from proxstar import logging from proxstar.util import gen_password @@ -102,22 +101,3 @@ def open_vnc_session(vmid, node, proxmox_user, proxmox_pass): ).json()['data'] return urllib.parse.quote_plus(vncproxy_response_data['ticket']), vncproxy_response_data['port'] - - -@deprecated('No longer in use') -def start_ssh_tunnel(node, port): - """Forwards a port on a node - to the proxstar container - """ - port = int(port) - - server = SSHTunnelForwarder( - node, - ssh_username=app.config['PROXMOX_SSH_USER'], - ssh_pkey='proxmox_ssh_key', - ssh_private_key_password=app.config['PROXMOX_SSH_KEY_PASS'], - remote_bind_address=('127.0.0.1', port), - local_bind_address=('127.0.0.1', port), - ) - server.start() - return server diff --git a/requirements.txt b/requirements.txt index a70ebcf..ca69f24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,6 @@ rq==1.10.1 rq-dashboard==0.6.1 rq-scheduler==0.10.0 sqlalchemy==1.3.22 -sshtunnel==0.2.2 tenacity==5.0.2 websockify==0.9.0 pylint==2.13.9