diff options
author | devega <ma.devega@globunet.com> | 2019-05-24 15:04:18 +0200 |
---|---|---|
committer | devega <ma.devega@globunet.com> | 2019-05-24 15:04:18 +0200 |
commit | 63fa47a1eec0ed52f8f93e78d17245631c23e8a8 (patch) | |
tree | cb22d5df5438101fcdb71f0435fc149ce27b0dba | |
parent | 9709c56f87eb2bd2831b1967ca24f23988d4565d (diff) | |
parent | 9d70a3d4ee6af7137932a6cd10b2afe4d2c24754 (diff) |
Merge remote-tracking branch 'origin/webconsole3' into webconsole3
20 files changed, 142 insertions, 88 deletions
diff --git a/admin/Sources/Clients/ogagent/linux/debian/changelog b/admin/Sources/Clients/ogagent/linux/debian/changelog index 176cac0d..5bfa54df 100644 --- a/admin/Sources/Clients/ogagent/linux/debian/changelog +++ b/admin/Sources/Clients/ogagent/linux/debian/changelog @@ -1,8 +1,21 @@ +ogagent-oglive (3.0.0-20190520) unstable; urgency=medium + + * OGAgent for ogLive compatible with OpenGnsys 3 web API + + -- Ramón M. Gómez <ramongomez@us.es> Mon, 18 Jun 2018 13:00:00 +0200 + ogagent (1.1.1) unstable; urgency=medium - * OGAgent code retrieved from GitHub + * Set connection timeout + * Compatibility with "Exam Mode" from the University of Seville + + -- Ramón M. Gómez <ramongomez@us.es> Thu, 23 May 2019 13:00:00 +0200 + +ogagent (1.1.0a) stable; urgency=medium + + * Fix a bug when activating the agent with some network devices - -- Ramón M. Gómez <ramongomez@us.es> Sun, 3 Jun 2018 13:00:00 +0200 + -- Ramón M. Gómez <ramongomez@us.es> Wed, 22 May 2019 18:00:00 +0200 ogagent (1.1.0) stable; urgency=medium diff --git a/admin/Sources/Clients/ogagent/oglive/Makefile b/admin/Sources/Clients/ogagent/oglive/Makefile index 84e06107..707bc67c 100644 --- a/admin/Sources/Clients/ogagent/oglive/Makefile +++ b/admin/Sources/Clients/ogagent/oglive/Makefile @@ -22,12 +22,12 @@ install-ogagent: mkdir -p $(SBINDIR) mkdir -p $(APPSDIR) mkdir -p $(CFGDIR) - + mkdir $(LIBDIR)/img - + # Cleans up .pyc and cache folders rm -f $(PYC) $(CACHES) - + cp -r $(SOURCEDIR)/opengnsys $(LIBDIR)/opengnsys cp -r $(SOURCEDIR)/cfg $(LIBDIR)/cfg ln -fs $(LIBDIR)/cfg/ogagent.cfg $(CFGDIR) @@ -35,7 +35,7 @@ install-ogagent: cp scripts/ogagent $(BINDIR) chmod 755 $(BINDIR)/ogagent - + uninstall: rm -rf $(LIBDIR) rm -f $(BINDIR)/ogagent diff --git a/admin/Sources/Clients/ogagent/oglive/debian/changelog b/admin/Sources/Clients/ogagent/oglive/debian/changelog index 57a05aba..43bde3d4 100644 --- a/admin/Sources/Clients/ogagent/oglive/debian/changelog +++ b/admin/Sources/Clients/ogagent/oglive/debian/changelog @@ -1,3 +1,9 @@ +ogagent-oglive (3.0.0-20190520) unstable; urgency=medium + + * OGAgent for ogLive compatible with OpenGnsys 3 web API + + -- Ramón M. Gómez <ramongomez@us.es> Mon, 18 Jun 2018 13:00:00 +0200 + ogagent-oglive (1.1.1) unstable; urgency=medium * Initial release. diff --git a/admin/Sources/Clients/ogagent/src/OGAgent.manifest b/admin/Sources/Clients/ogagent/src/OGAgent.manifest index 6f202f5a..307101fc 100644 --- a/admin/Sources/Clients/ogagent/src/OGAgent.manifest +++ b/admin/Sources/Clients/ogagent/src/OGAgent.manifest @@ -2,8 +2,8 @@ <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity type="win32" - name="UDSActorService" - version="1.6.0.0" + name="OGAgentService" + version="3.0.0.0" processorArchitecture="x86" /> <description>Description</description> diff --git a/admin/Sources/Clients/ogagent/src/VERSION b/admin/Sources/Clients/ogagent/src/VERSION index 524cb552..4a36342f 100644 --- a/admin/Sources/Clients/ogagent/src/VERSION +++ b/admin/Sources/Clients/ogagent/src/VERSION @@ -1 +1 @@ -1.1.1 +3.0.0 diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py b/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py index ab31fb39..223875af 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -111,7 +111,7 @@ class OpenGnSysWorker(ServerWorker): name = 'opengnsys' interface = None # Bound interface for OpenGnsys REST = None # REST object - loggedin = False # User session flag + logged_in = False # User session flag browser = {} # Browser info commands = [] # Running commands random = None # Random string for secure connections @@ -160,8 +160,7 @@ class OpenGnSysWorker(ServerWorker): route = route[len(self.REST.endpoint):] # Send back exit status and outputs (base64-encoded) self.REST.sendMessage(route, {'mac': self.interface.mac, 'ip': self.interface.ip, 'trace': op_id, - 'status': stat, 'output': out.encode('utf8').encode('base64'), - 'error': err.encode('utf8').encode('base64')}) + 'status': stat, 'output': out.encode('base64'), 'error': err.encode('base64')}) # Show latest menu, if OGAgent runs on ogLive if os_type == 'oglive': # Send configuration data, if needed @@ -174,6 +173,9 @@ class OpenGnSysWorker(ServerWorker): """ Sends OGAgent activation notification to OpenGnsys server """ + t = 0 + # Generate random secret to send on activation + self.random = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(self.length)) # Ensure cfg has required configuration variables or an exception will be thrown url = self.service.config.get('opengnsys', 'remote') server_client = self.service.config.get('opengnsys', 'client') @@ -201,55 +203,72 @@ class OpenGnSysWorker(ServerWorker): # Raise error after timeout if not self.interface: raise e - # Delete marking files - for f in ['ogboot.me', 'ogboot.firstboot', 'ogboot.secondboot']: - try: - os.remove(os.sep + f) - except OSError: - pass - # Copy file "HostsFile.FirstOctetOfIPAddress" to "HostsFile", if it exists - # (used in "exam mode" from the University of Seville) - hosts_file = os.path.join(operations.get_etc_path(), 'hosts') - new_file = hosts_file + '.' + self.interface.ip.split('.')[0] - if os.path.isfile(new_file): - shutil.copy2(new_file, hosts_file) - # Generate random secret to send on activation - self.random = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(self.length)) # Compose login route login_route = 'oauth/v2/token?client_id=' + server_client + '&client_secret=' + server_secret + \ '&grant_type=' + self.grant_type + '&ip=' + self.interface.ip + '&mac=' + self.interface.mac + \ '&token=' + self.random # Send initialization login message response = None - try: + # Loop to send initialization message + for t in range(0, 100): try: - # New web compatibility. - response = self.REST.sendMessage(login_route) + try: + # New web compatibility. + self.REST = REST(self.service.config.get('opengnsys', 'remote')) + response = self.REST.sendMessage(login_route) + break + except: + # Trying to initialize on alternative server, if defined + # (used in "exam mode" from the University of Seville) + self.REST = REST(self.service.config.get('opengnsys', 'altremote')) + response = self.REST.sendMessage(login_route) + break except: - # Trying to initialize on alternative server, if defined - # (used in "exam mode" from the University of Seville) - self.REST = REST(self.service.config.get('opengnsys', 'altremote')) - response = self.REST.sendMessage(login_route) - except: - raise Exception('Initialization error: Cannot connect to the server') - finally: - if response['access_token'] is None: - raise Exception('Initialization error: Cannot obtain access token') + time.sleep(3) + # Raise error after timeout or authentication failure + if 0 < t < 100: + logger.debug('Successful connection after {} tries'.format(t)) + elif t == 100: + raise Exception('Initialization error: Cannot connect to remote server') + if response['access_token'] is None: + raise Exception('Initialization error: Cannot obtain access token') + # Read access tokens self.access_token = response['access_token'] self.refresh_token = response['refresh_token'] # Once authenticated with the server, change the API URL for private request self.REST = REST(url + 'api/private') # Set authorization tokens in the REST object, so in each request this token will be used self.REST.set_authorization_headers(self.access_token, self.refresh_token) - # Completing ogLive initialization process + # Completing OGAgent initialization process os_type = operations.os_type.lower() if os_type == 'oglive': # Create HTML file (TEMPORARY) message = """ <html> <head></head> +<style> + #barra { width: 20px; height: 10px; position: relative; background: darkslategrey; } +</style> <body> -<h1 style="margin: 5em; font-size: xx-large;">OpenGnsys 3</h1> +<h1 style="margin: 5em 0 0 5em; font-size: 250%; color: darkslategrey;"> + <span id="opengnsys"><span style="font-weight: lighter;">Open</span>Gnsys 3</div> + <div id="barra"></span> +</h1> +<script> + var elem = document.getElementById("barra"); + var max = document.getElementById("opengnsys").offsetWidth; + var pos = 0; + var inc = true; + var id = setInterval(frame, 5); + function frame() { + if (inc) { + if (pos == max - 20) { inc = false; } else { pos++; } + } else { + if (pos == 0) { inc = true; } else { pos--; } + } + elem.style.left = pos + 'px'; + } +</script> </body> </html>""" f = open('/tmp/init.html', 'w') @@ -266,6 +285,19 @@ class OpenGnSysWorker(ServerWorker): # menu_url = self.REST.sendMessage('menus?mac' + self.interface.mac + '&ip=' + self.interface.ip) menu_url = '/opt/opengnsys/log/' + self.interface.ip + '.info.html' # TEMPORARY menu self._launch_browser(menu_url) + else: + # Delete marking files + for f in ['ogboot.me', 'ogboot.firstboot', 'ogboot.secondboot']: + try: + os.remove(os.sep + f) + except OSError: + pass + # Copy file "HostsFile.FirstOctetOfIPAddress" to "HostsFile", if it exists + # (used in "exam mode" from the University of Seville) + hosts_file = os.path.join(operations.get_etc_path(), 'hosts') + new_file = hosts_file + '.' + self.interface.ip.split('.')[0] + if os.path.isfile(new_file): + shutil.copy2(new_file, hosts_file) # Return status message self.REST.sendMessage('clients/statuses', {'mac': self.interface.mac, 'ip': self.interface.ip, 'status': os_type}) @@ -288,7 +320,7 @@ class OpenGnSysWorker(ServerWorker): """ user, sep, language = data.partition(',') logger.debug('Received login for {} with language {}'.format(user, language)) - self.loggedin = True + self.logged_in = True self.REST.sendMessage('ogagent/loggedin', {'ip': self.interface.ip, 'user': user, 'language': language, 'ostype': operations.os_type, 'osversion': operations.os_version}) @@ -297,7 +329,7 @@ class OpenGnSysWorker(ServerWorker): Sends session logout notification to OpenGnsys server """ logger.debug('Received logout for {}'.format(user)) - self.loggedin = False + self.logged_in = False self.REST.sendMessage('ogagent/loggedout', {'ip': self.interface.ip, 'user': user}) def process_ogclient(self, path, get_params, post_params, server): @@ -330,14 +362,14 @@ class OpenGnSysWorker(ServerWorker): def process_status(self, path, get_params, post_params, server): """ - Returns client status (OS type or execution status) and login status. + Returns client status (OS type or execution status) and login status :param path: :param get_params: :param post_params: :param server: :return: JSON object {"status": "status_code", "loggedin": boolean} """ - res = {'loggedin': self.loggedin} + res = {'loggedin': self.logged_in} try: res['status'] = operations.os_type.lower() except KeyError: @@ -350,7 +382,7 @@ class OpenGnSysWorker(ServerWorker): @check_secret def process_reboot(self, path, get_params, post_params, server): """ - Launches a system reboot operation. + Launches a system reboot operation :param path: :param get_params: :param post_params: @@ -369,7 +401,7 @@ class OpenGnSysWorker(ServerWorker): @check_secret def process_poweroff(self, path, get_params, post_params, server): """ - Launches a system power off operation. + Launches a system power off operation :param path: :param get_params: :param post_params: @@ -423,20 +455,20 @@ class OpenGnSysWorker(ServerWorker): @check_secret def process_logoff(self, path, get_params, post_params, server): """ - Closes user session. + Closes user session """ logger.debug('Received logoff operation') - # Send log off message to OGAgent client. + # Send log off message to OGAgent client self.sendClientMessage('logoff', {}) return {'op': 'sent to client'} @check_secret def process_popup(self, path, get_params, post_params, server): """ - Shows a message popup on the user's session. + Shows a message popup on the user's session """ logger.debug('Received message operation') - # Send popup message to OGAgent client. + # Send popup message to OGAgent client self.sendClientMessage('popup', post_params) return {'op': 'launched'} diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/oglive/operations.py b/admin/Sources/Clients/ogagent/src/opengnsys/oglive/operations.py index 3cdeef09..9ec907c1 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/oglive/operations.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/oglive/operations.py @@ -39,6 +39,7 @@ import subprocess import struct import array import six +import chardet from opengnsys import utils @@ -209,7 +210,8 @@ def exec_command(cmd): proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = proc.communicate() stat = proc.returncode - return stat, out, err + return stat, out.decode(chardet.detect(out)['encoding']).encode('utf8'),\ + err.decode(chardet.detect(err)['encoding']).encode('utf8') def get_hardware(): diff --git a/admin/WebConsole3/backend/app/doc/engine.json b/admin/WebConsole3/backend/app/doc/engine.json index dee603c5..2820f22b 100644 --- a/admin/WebConsole3/backend/app/doc/engine.json +++ b/admin/WebConsole3/backend/app/doc/engine.json @@ -523,6 +523,10 @@ "name": "initializing" }, { + "id": "oglive", + "name": "oglive" + }, + { "id": "busy", "name": "busy" }, @@ -547,4 +551,4 @@ "name": "windows_session" } ] -}
\ No newline at end of file +} diff --git a/admin/WebConsole3/frontend/src/environments/environment.ts b/admin/WebConsole3/frontend/src/environments/environment.ts index ef17e26d..3ba05adc 100644 --- a/admin/WebConsole3/frontend/src/environments/environment.ts +++ b/admin/WebConsole3/frontend/src/environments/environment.ts @@ -108,8 +108,8 @@ export const environment = { 'HISTORY_LOG': '/cgi-bin/httpd-history-log.sh', 'REALTIME_LOG': '/cgi-bin/httpd-log.sh', 'SOFTWARE_INVENTORY': '/opt/opengnsys/interfaceAdm/InventarioSoftware', - 'REBOOT': 'reboot 1 &', - 'POWER_OFF': 'poweroff &', + 'REBOOT': 'reboot 1', + 'POWER_OFF': 'poweroff', 'HARDWARE_INVENTORY': '/opt/opengnsys/interfaceAdm/InventarioHardware', 'REFRESH_INFO': 'sendConfigToServer' }, diff --git a/client/boot-tools/boottoolsfunctions.lib b/client/boot-tools/boottoolsfunctions.lib index 7f7bbb38..da9cca2c 100755 --- a/client/boot-tools/boottoolsfunctions.lib +++ b/client/boot-tools/boottoolsfunctions.lib @@ -126,7 +126,14 @@ case "${1,,}" in bionic-4.18) # ogLive 1.1.1-rc3 basado en Ubuntu 18.04 y Kernel 4.18. OSDISTRIB="ubuntu" OSCODENAME="bionic" - OSRELEASE="4.18.0-17-generic" + OSRELEASE="4.18.0-20-generic" + OSARCH="amd64" + OSHTTP="http://es.archive.ubuntu.com/ubuntu/" + ;; + bionic-5.0) # ogLive 1.1.1-rc4 basado en Ubuntu 18.04 y Kernel 5.0. + OSDISTRIB="ubuntu" + OSCODENAME="bionic" + OSRELEASE="5.0.0-15-generic" OSARCH="amd64" OSHTTP="http://es.archive.ubuntu.com/ubuntu/" ;; diff --git a/client/boot-tools/includes/etc/initramfs-tools/scripts/VERSION.txt b/client/boot-tools/includes/etc/initramfs-tools/scripts/VERSION.txt index bc92b96f..2c8efadf 100644 --- a/client/boot-tools/includes/etc/initramfs-tools/scripts/VERSION.txt +++ b/client/boot-tools/includes/etc/initramfs-tools/scripts/VERSION.txt @@ -1 +1 @@ -OpenGnsys Client 1.1.1-rc3 +OpenGnsys Client 1.1.1-rc4 diff --git a/client/boot-tools/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh b/client/boot-tools/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh index 9a9fb764..32a9c733 100755 --- a/client/boot-tools/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh +++ b/client/boot-tools/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh @@ -19,26 +19,6 @@ which ms-sys || ms-sys install &>/dev/null echo "spartlnx" which spartlnx.run || $(wget http://damien.guibouret.free.fr/savepart.zip &>/dev/null; unzip -o savepart.zip -d /sbin/) -# Mach-O loader for Linux -#echo "maloader" -#apt-get install -y uuid-dev lib64z1 lib32z1 -#wget https://github.com/shinh/maloader/archive/master.zip -#unzip master.zip -#cd maloader-master -#perl -pi -le 'print "#include <unistd.h>" if $. == 45' ld-mac.cc -#if [ "$(arch)" == "x86_64" ]; then -# ln -fs /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/libcrypto.so 2>/dev/null -# make release -#else -# ln -fs /lib/i386-linux-gnu/libcrypto.so.1.0.0 /lib/libcrypto.so 2>/dev/null -# make clean -# make all BITS=32 -#fi -#cp -va ld-mac /usr/bin -#cp -va libmac.so /usr/lib -#cd .. -#rm -fr master.zip maloader-master - popd export LANGUAGE=$OLDLANGUAGE export LC_ALL=$OLDLC_ALL diff --git a/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.basic b/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.basic index 31f2b559..73e1c2b9 100644 --- a/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.basic +++ b/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.basic @@ -4,7 +4,7 @@ install man-db install fbset install gdebi-core install bash-static -install busybox-static +install busybox-static install console-data install locales install lshw diff --git a/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.cloning b/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.cloning index 0092bd29..3e6a7666 100644 --- a/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.cloning +++ b/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.cloning @@ -5,7 +5,7 @@ install pxe-kexec install mbuffer install parted install gdisk -install chntpw +install chntpw install clonezilla install registry-tools install reglookup diff --git a/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.testing b/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.testing index 13cd2665..eca18286 100644 --- a/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.testing +++ b/client/boot-tools/includes/usr/bin/boot-tools/listpackages/sw.testing @@ -16,7 +16,7 @@ install python-requests install fusioninventory-agent install nvme-cli install disktype -install laptop-detect +install laptop-detect #install discover #install casper #install lupin-casper diff --git a/client/shared/etc/init/default.sh b/client/shared/etc/init/default.sh index 2fc3ede9..229278ea 100755 --- a/client/shared/etc/init/default.sh +++ b/client/shared/etc/init/default.sh @@ -18,7 +18,7 @@ echo "${MSG_LAUNCHCLIENT:-.}" [ -f /usr/local/etc/${LANG%_*}.qmap ] && export QWS_KEYBOARD="TTY:keymap=/usr/local/etc/${LANG%_*}.qmap" source /scripts/client.cfg -VERSION="1.1.1" # TEMPORAL +VERSION="3.0.0-20190520" # TEMPORAL if [ -f "$OPENGNSYS/images/ogagent-oglive_${VERSION}_all.deb" -a "$ogstatus" != "offline" ]; then # Instalar, configurar e iniciar agente. dpkg -i "$OPENGNSYS/images/ogagent-oglive_${VERSION}_all.deb" diff --git a/client/shared/etc/preinit/fileslinks.sh b/client/shared/etc/preinit/fileslinks.sh index b6fc7e2f..442c2920 100755 --- a/client/shared/etc/preinit/fileslinks.sh +++ b/client/shared/etc/preinit/fileslinks.sh @@ -32,7 +32,7 @@ if [ -n "$OPENGNSYS" ]; then # Enlaces para Qt Embeded. QTDIR="/usr/local" mkdir -p $QTDIR/{etc,lib,plugins} - for i in $OGLIB/qtlib/*; do + for i in $OGLIB/qtlib/* $OGLIB/fonts; do [ -f $QTDIR/lib/$i ] || ln -fs $i $QTDIR/lib 2>/dev/null done for i in $OGLIB/qtplugins/*; do diff --git a/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt index d40e0f7d..93ea6067 100644 --- a/doc/CHANGELOG.es.txt +++ b/doc/CHANGELOG.es.txt @@ -52,9 +52,11 @@ Tickets resueltos en módulo OpenGnsys Cloning Engine: #851 Ampliar parámetros de una sesión multicast para los clientes (corrección) #868 ConfiguraOs: error al desinstalar el agente de sistema operativo antiguo (corrección) #871 Error al crear particiones lógicas en discos con sectores de 4 KB (corrección) +#910 El control del éxito se verifica por la longitud de la cadena que retorna la función ogGetPath (corrección) Tickets resueltos en módulo OpenGnsys Client: #852 Apagado del cliente si tiempo de espera cambia de día (corrección) +#913 OGAgent no conecta para algunas tarjetas de red con IP estática (corrección) Tickets resueltos en módulo OpenGnsys Server: #846 Configuración de logrotate para que incluya todos los servicios de OpenGnsys (corrección) @@ -69,6 +71,7 @@ Tickets resueltos en módulo OpenGnsys Web Admin Console: #849 Incorporar ordenadores de dhcp no admite comentarios tras la declarción de un host (corrección) #867 La ayuda en la consola incluirá más información #870 Netboot avanzado no crea la plantilla de arranque si el equipo no tiene asignado un repositorio (corrección) +#909 Formulario asistente updateCache no asigna el REPO asociado a la imagen (corrección) Tickets resueltos en módulo OpenGnsys Installer: #876 Problemas al actualizar desde Subversion a Git (corrección) diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index ff2605d8..297da723 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1076,7 +1076,10 @@ read -e APIID APISECRET <<< \ "$(php app/console doctrine:query:sql "SELECT random_id, secret FROM og_core__clients WHERE id=1;" | \ awk -F\" '$2~/^(random_id|secret)$/ {getline; printf("%s ", $2)}')" read -e CLIENTID CLIENTSECRET <<< \ - "$(php app/console opengnsys:oauth-server:client:create --no-ansi | \ + "$(php app/console opengnsys:oauth-server:client:create --no-ansi \ + --grant-type="password" --grant-type="refresh_token" \ + --grant-type="token" \ + --grant-type="http://opengnsys.es/grants/og_client" | \ awk 'BEGIN {RS=" "} /^(id|secret)$/ {getline; gsub(/,/, ""); printf("%s ", $0)}')" [ -f $jsonfile ] || echo "{}" > $jsonfile diff --git a/installer/vagrant/Vagrantfile-webconsole3-vbox b/installer/vagrant/Vagrantfile-webconsole3-vbox index 6cf4f037..3f305c95 100644 --- a/installer/vagrant/Vagrantfile-webconsole3-vbox +++ b/installer/vagrant/Vagrantfile-webconsole3-vbox @@ -61,18 +61,22 @@ REQ=$(curl -sk -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/j REPOID=$(echo $REQ | jq -r .id) REQ=$(curl -sk -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"name":"Aula virtual", "description":"Despliegue virtual con Vagrant.", "networkSettings":{"mcastMode":"full-duplex", "mcastIp":"239.194.2.11", "mcastPort":9000, "mcastPort":9000, "mcastSpeed":100, "netmask":"#{NETPREFIX}.0", "router":"#{NETPREFIX}.1", "p2pMode":"peer", "p2pTime":60} }' https://localhost/opengnsys3/backend/web/app_dev.php/api/private/organizationalunits) OUID=$(echo $REQ | jq -r .id) +MACPREFIX="#{MACPREFIX}" for ((i=11; i<=10+#{NCLIENTS}; i++)); do - sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf + sed -i "/^}$/ i host pc${i} { hardware ethernet ${MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf [ $i == 11 ] && BOOTID=5 || BOOTID=6 REQ=$(curl -sk -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"name":"pc'$i'", "ip":"#{NETPREFIX}.'$i'", "mac":"#{MACPREFIX}:'$i'", "serialno":"", "netiface":"eth0", "netdriver":"generic", "netboot":'"$BOOTID"', "organizationalUnit":'"$OUID"', "repository":'"$REPOID"'}' https://localhost/opengnsys3/backend/web/app_dev.php/api/private/clients) + sed -i "s/ISODIR=$/ISODIR=ogLive/; s/::1/#{SERVERIP}/g; s/#{NETPREFIX}.0/255.255.255.0/" /opt/opengnsys/tftpboot/menu.lst/01-$(echo "${MACPREFIX^^}:${i}" | tr ":" "-") done systemctl restart isc-dhcp-server +sed -i "/\\[global\\]/a \\ \\ ntlm auth = ntlmv1-permitted" /etc/samba/smb.conf +systemctl restart smbd #/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM #for ((i=12; i<=#{NCLIENTS+10}; i++)); do # /opt/opengnsys/bin/setclientmode ogLive pc$i PERM #done -sed -i "s,\(url = 'https://\)[^/]*,\1localhost:#{LOCALWEBPORT}," /opt/opengnsys/www3/frontend/main.js -sed -i "s,\(url = 'https://\)[^/]*,\1localhost:#{LOCALWEBPORT}," /opt/opengnsys/www3/frontend/main.js.map +sed -i "s,\\(url = 'https://\\)[^/]*,\\1localhost:#{LOCALWEBPORT}," /opt/opengnsys/www3/frontend/main.js +sed -i "s,\\(url = 'https://\\)[^/]*,\\1localhost:#{LOCALWEBPORT}," /opt/opengnsys/www3/frontend/main.js.map echo "Notes:" echo "- New OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys3/frontend/" EOT @@ -104,6 +108,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # OpenGnsys AngularJS VM definition. config.vm.define "ogAngular", primary: true do |ag| + # VM base and host name. + ag.vm.box = "bento/ubuntu-18.04" + ag.vm.hostname = "ogAngular" # Specific VirtualBox configuration. ag.vm.provider "virtualbox" do |vb| # VM name, memory and CPUs. @@ -125,9 +132,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Attach repo virtual disk. vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] end - # VM base and host name. - ag.vm.box = "bento/ubuntu-18.04" - ag.vm.hostname = "ogAngular" # Network settings. ag.vm.network "forwarded_port", guest: 443, host: LOCALWEBPORT, host_ip: "127.0.0.1" ag.vm.network "private_network", mac: "#{MACPREFIX}10".tr(":",""), ip: "#{SERVERIP}", virtualbox__intnet: true |