Merge pull request #177 from jabbate19/apikey

Use Token over User/PW
This commit is contained in:
Joe Abbate 2022-10-20 00:24:52 -04:00 committed by GitHub
commit 5ca4d710bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View file

@ -23,7 +23,8 @@ PROXSTAR_REDIRECT_URI=https://proxstar.csh.rit.edu/logout
# Proxmox
PROXSTAR_PROXMOX_HOSTS= # Host list that Proxstar can use (proxstar01, etc...)
PROXSTAR_PROXMOX_USER=api@pve
PROXSTAR_PROXMOX_PASS= # Password for proxstar user
PROXSTAR_PROXMOX_TOKEN_NAME= # Token name for user
PROXSTAR_PROXMOX_TOKEN_VALUE= # Token value for user
PROXSTAR_PROXMOX_ISO_STORAGE=nfs-iso
PROXSTAR_PROXMOX_VM_STORAGE=ceph

View file

@ -34,7 +34,8 @@ OIDC_CLIENT_CONFIG = {
# Proxmox
PROXMOX_HOSTS = [host.strip() for host in environ.get('PROXSTAR_PROXMOX_HOSTS', '').split(',')]
PROXMOX_USER = environ.get('PROXSTAR_PROXMOX_USER', '')
PROXMOX_PASS = environ.get('PROXSTAR_PROXMOX_PASS', '')
PROXMOX_TOKEN_NAME = environ.get('PROXSTAR_PROXMOX_TOKEN_NAME', '')
PROXMOX_TOKEN_VALUE = environ.get('PROXSTAR_PROXMOX_TOKEN_VALUE', '')
PROXMOX_ISO_STORAGE = environ.get('PROXSTAR_PROXMOX_ISO_STORAGE', 'nfs-iso')
PROXMOX_VM_STORAGE = environ.get('PROXSTAR_PROXMOX_VM_STORAGE', 'ceph')
# STARRS

View file

@ -12,7 +12,8 @@ def connect_proxmox():
proxmox = ProxmoxAPI(
host,
user=app.config['PROXMOX_USER'],
password=app.config['PROXMOX_PASS'],
token_name=app.config['PROXMOX_TOKEN_NAME'],
token_value=app.config['PROXMOX_TOKEN_VALUE'],
verify_ssl=False,
)
proxmox.version.get()

View file

@ -75,7 +75,7 @@ def delete_vnc_target(node=None, port=None, token=None):
def open_vnc_session(vmid, node, proxmox):
"""Pings the Proxmox API to request a VNC Proxy connection. Authenticates
against the API using a Uname/Pass, gets a few tokens back, then uses those
against the API using a Uname/Token, gets a few tokens back, then uses those
tokens to open the VNC Proxy. Use these to connect to the VM's host with
websockify proxy.
Returns: Ticket to use as the noVNC password, and a port.