1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 15:15:22 +00:00

Merge pull request #484 from catborise/master

updates & fixes 1
This commit is contained in:
catborise 2022-01-12 13:41:10 +03:00 committed by GitHub
commit 9977c650db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 15412 additions and 15050 deletions

View file

@ -1,4 +1,4 @@
FROM phusion/baseimage:focal-1.0.0
FROM phusion/baseimage:focal-1.1.0
EXPOSE 80
EXPOSE 6080

View file

@ -32,7 +32,7 @@ WebVirtCloud is a virtualization web interface for admins and users. It can dele
## Quick Install with Installer (Beta)
Install an OS and run specified commands. Installer supported OSes: Ubuntu 18.04, Debian 10, Centos/OEL/RHEL 8.
Install an OS and run specified commands. Installer supported OSes: Ubuntu 18.04/20.04, Debian 10/11, Centos/OEL/RHEL 8.
It can be installed on a virtual machine, physical host or on a KVM host.
```bash

View file

@ -1,4 +1,4 @@
Django==3.2.10
Django==3.2.11
django_bootstrap5==21.2
django-icons==21.1
django-login-required-middleware==0.7

View file

@ -4,4 +4,4 @@ django-debug-toolbar==3.2.4
pycodestyle==2.8.0
pyflakes==2.4.0
pylint==2.12.2
yapf==0.31.0
yapf==0.32.0

View file

@ -342,15 +342,17 @@ def migrate(request, pk):
compress = request.POST.get("compress", False)
postcopy = request.POST.get("postcopy", False)
new_compute = Compute.objects.get(id=compute_id)
current_host = instance.compute.hostname
target_host = Compute.objects.get(id=compute_id)
try:
utils.migrate_instance(new_compute, instance, request.user, live, unsafe, xml_del, offline)
utils.migrate_instance(target_host, instance, request.user, live, unsafe, xml_del, offline)
except libvirtError as err:
messages.error(request, err)
msg = _("Instance is migrated to %(hostname)s") % {"hostname": new_compute.hostname}
addlogmsg(request.user.username, instance.compute.hostname, instance.name, msg)
migration_method = "live" if live is True else "offline"
msg = _("Instance is migrated(%(method)s) to %(hostname)s") % {"hostname": target_host.hostname, "method": migration_method}
addlogmsg(request.user.username, current_host, instance.name, msg)
return redirect(request.META.get("HTTP_REFERER"))

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -12,14 +12,13 @@ try:
class LdapAuthenticationBackend(ModelBackend):
def get_LDAP_user(self, username, password, filterString):
print('get_LDAP_user')
print('get_LDAP_user {}'.format(username))
try:
server = Server(settings.LDAP_URL, port=settings.LDAP_PORT,
use_ssl=settings.USE_SSL,get_info=ALL)
connection = Connection(server,
settings.LDAP_MASTER_DN,
settings.LDAP_MASTER_PW, auto_bind=True)
connection.search(settings.LDAP_ROOT_DN,
'(&({attr}={login})({filter}))'.format(
attr=settings.LDAP_USER_UID_PREFIX,
@ -31,11 +30,10 @@ try:
return None
specificUser = connection.response[0]
userDn = str(specificUser.get('raw_dn'),'utf-8')
with Connection(server,
userDn,
password) as con:
with Connection(server, userDn, password) as con:
return username
except:
except Exception as e:
print("LDAP Exception: {}".format(e))
return None
return None
@ -50,6 +48,7 @@ try:
if self.get_LDAP_user(username, password, settings.LDAP_SEARCH_GROUP_FILTER_ADMINS) is None:
if self.get_LDAP_user(username, password, settings.LDAP_SEARCH_GROUP_FILTER_STAFF) is None:
if self.get_LDAP_user(username, password, settings.LDAP_SEARCH_GROUP_FILTER_USERS) is None:
print("User does not belong to any search group. Check LDAP_SEARCH_GROUP_FILTER in settings.")
return None
else:
isStaff = True
@ -62,7 +61,7 @@ try:
attributes = UserAttributes.objects.get(user=user)
# TODO VERIFY
except User.DoesNotExist:
print("authenticate-create new user")
print("authenticate-create new user: {}".format(username))
user = User(username=username)
user.is_active = True
user.is_staff = isStaff

View file

@ -268,6 +268,7 @@ LDAP_MASTER_PW = ''
LDAP_ROOT_DN = ''
## Queries to identify the users, i use groupOfUniqueNames on openldap
### PLEASE BE SURE memberOf overlay is activated on slapd
## e.g. memberOf=cn=admins,cn=staff,cn=webvirtcloud,ou=groups,dc=kendar,dc=org
LDAP_SEARCH_GROUP_FILTER_ADMINS = ''
## e.g. memberOf=cn=staff,cn=webvirtcloud,ou=groups,dc=kendar,dc=org