Several fixes:

* Extended windows domain OU
* Addded certification check in connections to UDS clients
* Removed empty paths from REST api
This commit is contained in:
Adolfo Gómez García 2020-04-28 11:02:36 +02:00
parent c1adf35c99
commit e758ec36ff
4 changed files with 28 additions and 3 deletions

View File

@ -94,6 +94,10 @@ class Dispatcher(View):
content_type = path[0].split('.')[1]
clean_path = path[0].split('.')[0]
if not clean_path: # Skip empty path elements, so /x/y == /x////y for example (due to some bugs detected on some clients)
path = path[1:]
continue
if clean_path in service:
service = service[clean_path]
full_path_lst.append(path[0])

View File

@ -310,6 +310,10 @@ class ChangeIp(ActorV3Action):
# Generates a certificate and send it to client. Currently, we do not store it locally
privateKey, cert, password = certs.selfSignedCert(self._params['ip'])
# Store certificate with userService
userService.setProperty('cert', cert)
userService.setProperty('priv', privateKey)
userService.setProperty('priv_passwd', password)
return ActorV3Action.actorResult({'private_key': privateKey, 'server_certificate': cert, 'password': password})

View File

@ -1,5 +1,7 @@
import os
import json
import base64
import tempfile
import logging
import typing
@ -48,16 +50,31 @@ def _requestActor(
if proxy:
r = proxy.doProxyRequest(url=url, data=data, timeout=TIMEOUT)
else:
verify: typing.Union[bool, str]
# cert = userService.getProperty('cert')
cert = '' # Untils more tests, keep as previous.... TODO: Fix this when fully tested
if cert:
# Generate temp file, and delete it after
verify = tempfile.mktemp('udscrt')
with open(verify, 'wb') as f:
f.write(cert.encode()) # Save cert
else:
verify = False
if data is None:
r = requests.get(url, verify=False, timeout=TIMEOUT)
r = requests.get(url, verify=verify, timeout=TIMEOUT)
else:
r = requests.post(
url,
data=json.dumps(data),
headers={'content-type': 'application/json'},
verify=False,
verify=verify,
timeout=TIMEOUT
)
if verify:
try:
os.remove(typing.cast(str, verify))
except Exception:
logger.exception('removing verify')
js = r.json()
if version >= '3.0.0':

View File

@ -67,7 +67,7 @@ class WinDomainOsManager(WindowsOsManager):
domain = gui.TextField(length=64, label=_('Domain'), order=1, tooltip=_('Domain to join machines to (use FQDN form, Netbios name not supported for most operations)'), required=True)
account = gui.TextField(length=64, label=_('Account'), order=2, tooltip=_('Account with rights to add machines to domain'), required=True)
password = gui.PasswordField(length=64, label=_('Password'), order=3, tooltip=_('Password of the account'), required=True)
ou = gui.TextField(length=64, label=_('OU'), order=4, tooltip=_('Organizational unit where to add machines in domain (check it before using it). i.e.: ou=My Machines,dc=mydomain,dc=local'))
ou = gui.TextField(length=128, label=_('OU'), order=4, tooltip=_('Organizational unit where to add machines in domain (check it before using it). i.e.: ou=My Machines,dc=mydomain,dc=local'))
grp = gui.TextField(length=64, label=_('Machine Group'), order=7, tooltip=_('Group to which add machines on creation. If empty, no group will be used. (experimental)'), tab=_('Advanced'))
removeOnExit = gui.CheckBoxField(label=_('Machine clean'), order=8, tooltip=_('If checked, UDS will try to remove the machine from the domain USING the provided credentials'), tab=_('Advanced'), defvalue=gui.TRUE)
serverHint = gui.TextField(length=64, label=_('Server Hint'), order=9, tooltip=_('In case of several AD servers, which one is preferred'), tab=_('Advanced'))