forked from shaba/openuds
Fixes to MFAs
This commit is contained in:
parent
94cf5582e2
commit
93ba05f6cb
@ -212,13 +212,17 @@ class Authenticators(ModelHandler):
|
|||||||
self, fields: typing.Dict[str, typing.Any]
|
self, fields: typing.Dict[str, typing.Any]
|
||||||
) -> None: # pylint: disable=too-many-branches,too-many-statements
|
) -> None: # pylint: disable=too-many-branches,too-many-statements
|
||||||
logger.debug(self._params)
|
logger.debug(self._params)
|
||||||
|
if fields['mfa_id']:
|
||||||
try:
|
try:
|
||||||
mfa = MFA.objects.get(
|
mfa = MFA.objects.get(
|
||||||
uuid=processUuid(fields['mfa_id'])
|
uuid=processUuid(fields['mfa_id'])
|
||||||
)
|
)
|
||||||
fields['mfa_id'] = mfa.id
|
fields['mfa_id'] = mfa.id
|
||||||
except Exception: # not found
|
return
|
||||||
del fields['mfa_id']
|
except MFA.DoesNotExist:
|
||||||
|
pass # will set field to null
|
||||||
|
|
||||||
|
fields['mfa_id'] = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,9 +107,8 @@ class InternalDBAuth(auths.Authenticator):
|
|||||||
|
|
||||||
def mfaIdentifier(self, username: str) -> str:
|
def mfaIdentifier(self, username: str) -> str:
|
||||||
try:
|
try:
|
||||||
self.dbAuthenticator().users.get(name=username, state=State.ACTIVE).mfaData
|
return self.dbAuthenticator().users.get(name=username, state=State.ACTIVE).mfaData
|
||||||
except Exception:
|
finally:
|
||||||
pass
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def transformUsername(self, username: str) -> str:
|
def transformUsername(self, username: str) -> str:
|
||||||
|
@ -141,7 +141,7 @@ class SMSMFA(mfas.MFA):
|
|||||||
label=_('SMS response OK regex'),
|
label=_('SMS response OK regex'),
|
||||||
order=30,
|
order=30,
|
||||||
tooltip=_(
|
tooltip=_(
|
||||||
'Regex for SMS response OK. If emty, the response is considered OK if status code is 200.'
|
'Regex for SMS response OK. If empty, the response is considered OK if status code is 200.'
|
||||||
),
|
),
|
||||||
required=False,
|
required=False,
|
||||||
tab=_('HTTP Response'),
|
tab=_('HTTP Response'),
|
||||||
@ -183,7 +183,7 @@ class SMSMFA(mfas.MFA):
|
|||||||
rows=5,
|
rows=5,
|
||||||
order=32,
|
order=32,
|
||||||
tooltip=_('Networks for SMS authentication'),
|
tooltip=_('Networks for SMS authentication'),
|
||||||
required=True,
|
required=False,
|
||||||
tab=_('Config'),
|
tab=_('Config'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -222,6 +222,10 @@ class SMSMFA(mfas.MFA):
|
|||||||
)
|
)
|
||||||
# Any other value means no authentication
|
# Any other value means no authentication
|
||||||
|
|
||||||
|
# If set ignoreCertificateErrors, do it
|
||||||
|
if self.ignoreCertificateErrors.isTrue():
|
||||||
|
session.verify = False
|
||||||
|
|
||||||
# Add headers. Headers are in the form of "Header: Value". (without the quotes)
|
# Add headers. Headers are in the form of "Header: Value". (without the quotes)
|
||||||
if self.headersParameters.value.strip():
|
if self.headersParameters.value.strip():
|
||||||
for header in self.headersParameters.value.split('\n'):
|
for header in self.headersParameters.value.split('\n'):
|
||||||
|
@ -49,7 +49,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'UDS Actor for Debian, Ubuntu, ... Linux machines <b>(Requires python >= 3.6)</b>'
|
'UDS Actor for Debian, Ubuntu, ... Linux machines <b>(Requires python >= 3.6)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor_{version}_all.deb'.format(version=VERSION),
|
+ '/files/udsactor_{version}_all.deb'.format(version=VERSION),
|
||||||
'application/x-debian-package',
|
'application/x-debian-package',
|
||||||
)
|
)
|
||||||
@ -59,7 +59,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'UDS Actor for Centos, Fedora, RH, Suse, ... Linux machines <b>(Requires python >= 3.6)</b>'
|
'UDS Actor for Centos, Fedora, RH, Suse, ... Linux machines <b>(Requires python >= 3.6)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor-{version}-1.noarch.rpm'.format(version=VERSION),
|
+ '/files/udsactor-{version}-1.noarch.rpm'.format(version=VERSION),
|
||||||
'application/x-redhat-package-manager',
|
'application/x-redhat-package-manager',
|
||||||
)
|
)
|
||||||
@ -69,7 +69,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'UDS Actor for Debian based Linux machines. Used ONLY for static machines. <b>(Requires python >= 3.6)</b>'
|
'UDS Actor for Debian based Linux machines. Used ONLY for static machines. <b>(Requires python >= 3.6)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor-unmanaged_{version}_all.deb'.format(version=VERSION),
|
+ '/files/udsactor-unmanaged_{version}_all.deb'.format(version=VERSION),
|
||||||
'application/x-debian-package',
|
'application/x-debian-package',
|
||||||
)
|
)
|
||||||
@ -79,7 +79,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'UDS Actor for Centos, Fedora, RH, Suse, ... Linux machines. Used ONLY for static machines. <b>(Requires python >= 3.6)</b>'
|
'UDS Actor for Centos, Fedora, RH, Suse, ... Linux machines. Used ONLY for static machines. <b>(Requires python >= 3.6)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor-unmanaged-{version}-1.noarch.rpm'.format(version=VERSION),
|
+ '/files/udsactor-unmanaged-{version}-1.noarch.rpm'.format(version=VERSION),
|
||||||
'application/x-redhat-package-manager',
|
'application/x-redhat-package-manager',
|
||||||
)
|
)
|
||||||
@ -89,7 +89,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'<b>Legacy</b> UDS Actor for Debian, Ubuntu, ... Linux machines <b>(Requires python 2.7)</b>'
|
'<b>Legacy</b> UDS Actor for Debian, Ubuntu, ... Linux machines <b>(Requires python 2.7)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor_2.2.0_legacy.deb',
|
+ '/files/udsactor_2.2.0_legacy.deb',
|
||||||
'application/x-debian-package',
|
'application/x-debian-package',
|
||||||
)
|
)
|
||||||
@ -99,7 +99,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'<b>Legacy</b> UDS Actor for Centos, Fedora, RH, ... Linux machines <b>(Requires python 2.7)</b>'
|
'<b>Legacy</b> UDS Actor for Centos, Fedora, RH, ... Linux machines <b>(Requires python 2.7)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor-legacy-2.2.1-1.noarch.rpm',
|
+ '/files/udsactor-legacy-2.2.1-1.noarch.rpm',
|
||||||
'application/x-redhat-package-manager',
|
'application/x-redhat-package-manager',
|
||||||
)
|
)
|
||||||
@ -109,7 +109,7 @@ downloadsManager().registerDownloadable(
|
|||||||
_(
|
_(
|
||||||
'<b>Legacy</b> UDS Actor for OpenSUSE, ... Linux machines <b>(Requires python 2.7)</b>'
|
'<b>Legacy</b> UDS Actor for OpenSUSE, ... Linux machines <b>(Requires python 2.7)</b>'
|
||||||
),
|
),
|
||||||
os.path.dirname(sys.modules[__package__].__file__)
|
os.path.dirname(sys.modules[__package__].__file__) # type: ignore
|
||||||
+ '/files/udsactor-opensuse-legacy-2.2.1-1.noarch.rpm',
|
+ '/files/udsactor-opensuse-legacy-2.2.1-1.noarch.rpm',
|
||||||
'application/x-redhat-package-manager',
|
'application/x-redhat-package-manager',
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user