1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-07-14 15:35:41 +00:00

Compare commits

..

No commits in common. "9977c650db6d4b011cec436b29ecb1203b73da09" and "53240548a22cec66b0143669b51bf64ac1d0817b" have entirely different histories.

20 changed files with 15601 additions and 15963 deletions

View file

@ -1,4 +1,4 @@
FROM phusion/baseimage:focal-1.1.0 FROM phusion/baseimage:focal-1.0.0
EXPOSE 80 EXPOSE 80
EXPOSE 6080 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) ## Quick Install with Installer (Beta)
Install an OS and run specified commands. Installer supported OSes: Ubuntu 18.04/20.04, Debian 10/11, Centos/OEL/RHEL 8. Install an OS and run specified commands. Installer supported OSes: Ubuntu 18.04, Debian 10, Centos/OEL/RHEL 8.
It can be installed on a virtual machine, physical host or on a KVM host. It can be installed on a virtual machine, physical host or on a KVM host.
```bash ```bash

View file

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

View file

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

View file

@ -342,17 +342,15 @@ def migrate(request, pk):
compress = request.POST.get("compress", False) compress = request.POST.get("compress", False)
postcopy = request.POST.get("postcopy", False) postcopy = request.POST.get("postcopy", False)
current_host = instance.compute.hostname new_compute = Compute.objects.get(id=compute_id)
target_host = Compute.objects.get(id=compute_id)
try: try:
utils.migrate_instance(target_host, instance, request.user, live, unsafe, xml_del, offline) utils.migrate_instance(new_compute, instance, request.user, live, unsafe, xml_del, offline)
except libvirtError as err: except libvirtError as err:
messages.error(request, err) messages.error(request, err)
migration_method = "live" if live is True else "offline" msg = _("Instance is migrated to %(hostname)s") % {"hostname": new_compute.hostname}
msg = _("Instance is migrated(%(method)s) to %(hostname)s") % {"hostname": target_host.hostname, "method": migration_method} addlogmsg(request.user.username, instance.compute.hostname, instance.name, msg)
addlogmsg(request.user.username, current_host, instance.name, msg)
return redirect(request.META.get("HTTP_REFERER")) 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,13 +12,14 @@ try:
class LdapAuthenticationBackend(ModelBackend): class LdapAuthenticationBackend(ModelBackend):
def get_LDAP_user(self, username, password, filterString): def get_LDAP_user(self, username, password, filterString):
print('get_LDAP_user {}'.format(username)) print('get_LDAP_user')
try: try:
server = Server(settings.LDAP_URL, port=settings.LDAP_PORT, server = Server(settings.LDAP_URL, port=settings.LDAP_PORT,
use_ssl=settings.USE_SSL,get_info=ALL) use_ssl=settings.USE_SSL,get_info=ALL)
connection = Connection(server, connection = Connection(server,
settings.LDAP_MASTER_DN, settings.LDAP_MASTER_DN,
settings.LDAP_MASTER_PW, auto_bind=True) settings.LDAP_MASTER_PW, auto_bind=True)
connection.search(settings.LDAP_ROOT_DN, connection.search(settings.LDAP_ROOT_DN,
'(&({attr}={login})({filter}))'.format( '(&({attr}={login})({filter}))'.format(
attr=settings.LDAP_USER_UID_PREFIX, attr=settings.LDAP_USER_UID_PREFIX,
@ -30,10 +31,11 @@ try:
return None return None
specificUser = connection.response[0] specificUser = connection.response[0]
userDn = str(specificUser.get('raw_dn'),'utf-8') userDn = str(specificUser.get('raw_dn'),'utf-8')
with Connection(server, userDn, password) as con: with Connection(server,
userDn,
password) as con:
return username return username
except Exception as e: except:
print("LDAP Exception: {}".format(e))
return None return None
return None return None
@ -48,7 +50,6 @@ 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_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_STAFF) is None:
if self.get_LDAP_user(username, password, settings.LDAP_SEARCH_GROUP_FILTER_USERS) 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 return None
else: else:
isStaff = True isStaff = True
@ -61,7 +62,7 @@ try:
attributes = UserAttributes.objects.get(user=user) attributes = UserAttributes.objects.get(user=user)
# TODO VERIFY # TODO VERIFY
except User.DoesNotExist: except User.DoesNotExist:
print("authenticate-create new user: {}".format(username)) print("authenticate-create new user")
user = User(username=username) user = User(username=username)
user.is_active = True user.is_active = True
user.is_staff = isStaff user.is_staff = isStaff

View file

@ -268,7 +268,6 @@ LDAP_MASTER_PW = ''
LDAP_ROOT_DN = '' LDAP_ROOT_DN = ''
## Queries to identify the users, i use groupOfUniqueNames on openldap ## 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 ## e.g. memberOf=cn=admins,cn=staff,cn=webvirtcloud,ou=groups,dc=kendar,dc=org
LDAP_SEARCH_GROUP_FILTER_ADMINS = '' LDAP_SEARCH_GROUP_FILTER_ADMINS = ''
## e.g. memberOf=cn=staff,cn=webvirtcloud,ou=groups,dc=kendar,dc=org ## e.g. memberOf=cn=staff,cn=webvirtcloud,ou=groups,dc=kendar,dc=org