Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding timeout to authentication section #96

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vdiclient.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ hostpool = {
auth_backend = pve
# If enabled, 2FA TOTP entry dialog will show
auth_totp = false
# Set timeout in seconds for login. Defaults to 5
# auth_timeout = 15
# If disabled, TLS certificate will not be checked
tls_verify = false
# User name (if using token)
Expand Down
8 changes: 7 additions & 1 deletion vdiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def loadconfig(config_location = None, config_type='file', config_username = Non
'verify_ssl' : True,
'pwresetcmd' : None,
'auto_vmid' : None,
'timeout' : 5,
'knock_seq': []
}
try:
Expand All @@ -198,6 +199,8 @@ def loadconfig(config_location = None, config_type='file', config_username = Non
G.hosts[group]['token_value'] = config[section]['token_value']
if 'auth_totp' in config[section]:
G.hosts[group]['totp'] = config[section].getboolean('auth_totp')
if 'auth_timeout' in config[section]:
G.hosts[group]['timeout'] = config[section].getint('auth_timeout')
if 'tls_verify' in config[section]:
G.hosts[group]['verify_ssl'] = config[section].getboolean('tls_verify')
if 'pwresetcmd' in config[section]:
Expand Down Expand Up @@ -698,7 +701,8 @@ def pveauth(username, passwd=None, totp=None):
user=f"{username}@{G.hosts[G.current_hostset]['backend']}",
token_name=G.hosts[G.current_hostset]['token_name'],
token_value=G.hosts[G.current_hostset]['token_value'],
verify_ssl=G.hosts[G.current_hostset]['verify_ssl'],
verify_ssl=G.hosts[G.current_hostset]['verify_ssl'],
timeout=G.hosts[G.current_hostset]['timeout'],
port=port
)
elif totp:
Expand All @@ -708,6 +712,7 @@ def pveauth(username, passwd=None, totp=None):
otp=totp,
password=passwd,
verify_ssl=G.hosts[G.current_hostset]['verify_ssl'],
timeout=G.hosts[G.current_hostset]['timeout'],
port=port
)
else:
Expand All @@ -716,6 +721,7 @@ def pveauth(username, passwd=None, totp=None):
user=f"{username}@{G.hosts[G.current_hostset]['backend']}",
password=passwd,
verify_ssl=G.hosts[G.current_hostset]['verify_ssl'],
timeout=G.hosts[G.current_hostset]['timeout'],
port=port
)
connected = True
Expand Down