summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* #1008 Add support to work with GPT tablesJavier Sánchez Parra2020-11-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | ogServer /setup do not support to indicate which table type the user want to use. It always supposes that the partition table is MBR/MSDOS. Add ogServer support to work with GPT tables. Add new field table type to /setup that expects a string with "MSDOS" or "GPT". Example old JSON: { "clients": [...], "disk": "1", "cache": "0", "cache_size": "0", "partition_setup": [...] } Example new JSON: { "clients": [...], "type": "GPT", "disk": "1", "cache": "0", "cache_size": "0", "partition_setup": [...] }
* #1008 Restore support for 4 disks and 16 partitionsJavier Sánchez Parra2020-11-182-15/+18
| | | | | | | | ogServer expects to receive information of 1 disk and 4 partitions from ogClient. Previous ogServer versions support several disks and partitions. Add ogServer support for 4 disks and 16 partitions.
* #941 Fix get computer center idJavier Sánchez Parra2020-10-271-0/+1
| | | | | | | | | Creating a software profile failed. ogServer obtained the information of a computer without center id because commit cbd9421 removed it unintentionally, making all computer had center id equal to zero. This commit restores the gathering of computer center id from the database.
* #942 Add GET /session REST API functionRoberto Hueso Gómez2020-10-201-2/+99
| | | | | | | | | | | | | | | | | | | | | | | This function returns the installed and available OSs in a client to be booted from. Request: GET /session { "client": ["192.168.56.11"] } Response 200 OK { "sessions": [ { "disk": 1, "name": "Ubuntu 18.04.4 LTS", "partition": 1 } ] }
* #942 Use client's IP as filter in GET /hardwareRoberto Hueso Gómez2020-10-201-17/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses client's IP instead of scope ID as a filter for the request. Request: GET /hardware { "client": ["192.168.56.11"] } Response: 200 OK { "hardware": [ { "description": "BIOS", "type": "Tipo de proceso de arranque" }, { "description": "QEMU Standard PC (i440FX + PIIX, 1996) v.pc-i440fx-5.1", "type": "Marca y modelo del equipo" }, { "description": "Intel Corp. Intel Core Processor (Haswell, no TSX, IBRS) 2GHz v.pc-i440fx-5.1", "type": "Microprocesadores" }, { "description": "QEMU 2049MiB (DIMM 0)", "type": "Memorias" }, { "description": "Red Hat, Inc. Virtio network device v.00", "type": "Tarjetas de Red" } ] }
* #942 Add GET /software REST API functionRoberto Hueso Gómez2020-10-161-2/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function retrieves a list of the software installed in a specific disk and partition of a client. This list can be updated by using POST /software beforehand. Request: GET /software { "client": ["192.168.56.11"], "disk": 1, "partition": 1 } Response: 200 OK { "software": [ "grub-pc-bin 2", "grub-pc 2.02", "grub2-common 2.02", "groff-base 1.22.3", "gpg 2.2.4", "gnupg-utils 2.2.4", "gnupg-l10n 2.2.4", "gnupg 2.2.4", "gnome-video-effects 0.4.3", "gnome-user-guide 3.28.2+git20180715", "gnome-user-docs 3.28.2+git20180715", "gnome-todo-common 3.28.1", "gnome-mines 3.28.0", "gnome-menus 3.13.3", "gnome-mahjongg 3.22.0", "gnome-keyring-pkcs11 3.28.0.2", "gnome-keyring 3.28.0.2", "gnome-initial-setup 3.28.0", "accountsservice 0.6.45" ] }
* #942 Extend GET /images functionRoberto Hueso Gómez2020-10-142-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This extension removes replaces the field 'filename' for 'name' and adds new fields (software_id, type and id). These new fields are useful when restoring an image. Request: GET /images Response: 200 OK { "disk": { "free": 37091418112, "total": 52573995008 }, "images": [ { "datasize": 5939200000, "id": 25, "modified": "Wed Oct 14 11:49:00 2020", "name": "archlinux", "permissions": "744", "size": 1844222333, "software_id": 19, "type": 1 } ] }
* #942 Create DB image when calling POST /image/createRoberto Hueso Gómez2020-10-143-6/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | In case the DB entry for an image does not exist when POST /image/create is called, this patch takes care of calling it. This adds few optional json parameters to the POST /image/create API. If optional parameters are included then this patch creates the DB entry, otherwise it just creates the actual image and updates the existing entry. Request: POST /image/create { "clients":["192.168.56.11"], "disk":"1", "partition":"1", "name":"archlinux", "repository":"192.168.56.10", "id":"24", "code":"131", "description":"This is a test", "group_id":0, "center_id":1 } Response: 200 OK
* Add REST POST /client/delete methodRoberto Hueso Gómez2020-10-081-0/+61
| | | | | | | | | | | | | | | This method deletes a client from the DB. Request: POST /client/delete { "clients": ["192.168.56.30"] } Response: 200 OK Co-authored-by: Javier Sánchez Parra <jsanchez@soleta.eu>
* #971 remove unused contieneIP function in ogAdmLibOpenGnSys Support Team2020-10-071-31/+0
|
* #988 remove legacy configurationOpenGnSys Support Team2020-10-0710-88/+36
| | | | | Use og_server_cfg everywhere. Convert port to string to make it easy for the dbi API since it expects a string. Remove legacy example configuration file.
* #988 rename og_server_cfg to cfgOpenGnSys Support Team2020-10-073-7/+7
| | | | to avoid clash with existing variable cfg in client.c
* #941 Use fixed length strings in og_computer and og_dbi_get_computer_infoRoberto Hueso Gómez2020-10-064-71/+63
| | | | | | This patch is a refactor for og_computer and og_dbi_get_computer_info. It now uses fixed lenght strings to make it more reliable and avoid errors if the DB is not returning a null ended string.
* #941 Add og_json_parse_string_copy(...) functionRoberto Hueso Gómez2020-10-062-0/+16
| | | | | This function provides an easy way to copy the content of a json string into a regular C string.
* #1004 set default path to repositoryOpenGnSys Support Team2020-10-062-3/+7
| | | | This is /opt/opengnsys/images if not specified.
* #988 remove legacy configuration fileOpenGnSys Support Team2020-10-054-207/+32
| | | | Add getopt parser and use json configuration file instead.
* #1004 Fix integer overflow in datasizeJavier Sánchez Parra2020-09-291-1/+1
| | | | ogClient datasize is now in bytes, update format to fix a possible overflow.
* #1004 Add GET /imagesJavier Sánchez Parra2020-09-294-1/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds GET /images to the ogServer REST API. This call returns information of all the images in ogServer. Example response: { "images": [ { "filename": "ubuntu.img", "datasize": 2150400000, "size": 613476223, "modified": "Wed Sep 23 10:37:36 2020", "permissions": "744" }, { "filename": "test.img", "datasize": 2150400000, "size": 613236475, "modified": "Tue Sep 29 08:57:47 2020", "permissions": "744" } ], "disk": { "total": 52573995008, "free": 39624544256 } }
* #988 Add global config variableJavier Sánchez Parra2020-09-292-1/+4
| | | | | | This commit makes configuration variable global. To use this variable you have to #import "cfg.h".
* #942 Add POST /client/add HTTP REST methodRoberto Hueso Gómez2020-09-241-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method adds a new client. This new client's IP cannot be duplicated in the DB. Request: POST /client/add { "boot": "19pxeADMIN", "center": 0, "hardware_id": 0, "id": 2, "ip": "192.168.56.12", "livedir": "ogLive", "mac": "0800270E6512", "maintenance": true, "name": "pc12", "netdriver": "generic", "netiface": "eth1", "netmask": "255.255.255.0", "remote": false, "repo_id": 1, "room": 1, "serial_number": "" } Response: 200 OK
* #988 use-after-free in json configuration parserOpenGnSys Support Team2020-09-222-10/+20
| | | | | The cfg structure stores pointers to the string in this json tree. Do not release the json tree, keep it as field in the cfg structure.
* #1004 Add GET /client/info HTTP REST methodRoberto Hueso Gómez2020-09-221-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method provides information about a specific client. The request must contain exactly 1 client's IP. Request: GET /client/info {"client": ["192.168.56.12"]} Response: 200 OK { "boot": "19pxeADMIN", "center": 0, "hardware_id": 0, "id": 2, "ip": "192.168.56.12", "livedir": "ogLive", "mac": "0800280E6871", "maintenance": true, "name": "pc12", "netdriver": "generic", "netiface": "eth1", "netmask": "255.255.255.0", "remote": false, "repo_id": 1, "room": 1, "serial_number": "" }
* #941 Extend og_dbi_get_computer_info(...)Roberto Hueso Gómez2020-09-223-16/+80
| | | | | | For the strings in og_computer we do not need to know the max size in advance but instead we need to free up memmory using og_dbi_free_computer_info(...) function.
* #941 pass og_dbi to og_dbi_get_computer_info()OpenGnSys Support Team2020-09-183-52/+55
| | | | Reuse the existing dbi handler, instead of opening a new one.
* #941 move og_dbi_get_computer_info() to dbiOpenGnSys Support Team2020-09-183-59/+65
| | | | Move this function to the dbi.{h,c} files.
* #988 fix compilation warning in json configuration file to legacyOpenGnSys Support Team2020-09-151-8/+8
| | | | | src/cfg.c: In function ‘from_json_to_legacy’: src/cfg.c:161:2: warning: format not a string literal and no format arguments [-Wformat-security]
* Fix size of og_cmd_get_client_setup() return arrayRoberto Hueso Gómez2020-09-151-1/+2
| | | | The return array needs to store 1 extra element for the disk setup.
* #1004 Add GET /client/setup HTTP REST methodRoberto Hueso Gómez2020-09-141-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | This method provides the partitions setup for a specific client. The request must contain exactly 1 client's IP. Request: GET /client/setup {'client': ['192.168.56.12']} Response: 200 OK { "partitions": [ { "disk": 1, "partition": 0, "code": 0, "size": 20971520, "used_size": 0, "filesystem": 0, "os": 0, "image": 0, "software": 0 } ] }
* #971 replace reservaMemoria() by calloc()OpenGnSys Support Team2020-09-102-21/+1
| | | | reservaMemoria() is only used once, remove it.
* #971 remove unused functions in ogAdmLibOpenGnSys Support Team2020-09-102-127/+0
| | | | Remove unused legacy code.
* #1004 Handle new fields in /image/create responseJavier Sánchez Parra2020-09-103-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | ogClient now includes more information regarding the new image. This patch modifies ogServer to support new elements sent in ogClient /image/create response and store them in the database. Example of new /image/create response: { "disk": "1", "partition": "1", "code": "131", "id": "1", "name": "ubuntu", "repository": "192.168.56.10", "software": "Ubuntu 18.04.5 LTS \naccountsservice 0.6.45\n...", "clonator": "PARTCLONE", "compressor": "LZOP", "filesystem": "EXTFS", "datasize": 2100000 } New fields are "clonator", "compressor", "filesystem" and "datasize".
* #980 do not report busy client if probing is pendingOpenGnSys Support Team2020-08-211-1/+6
| | | | og_client_status() should not report busy when probing is going on.
* #980 Add 'ip' field in GET /scopes requestRoberto Hueso Gómez2020-08-141-4/+4
| | | | | The 'ip' field is added to the json for scopes that have an IP (i.e. computers).
* #980 Select POST /mode clients by ip instead of scope nameRoberto Hueso Gómez2020-08-141-14/+18
| | | | | | This patch selects clients whose modes need to be changed in the current request. This patch makes POST /mode consistent with the rest of the REST API where clients are selected and filtered by ip.
* #998 disable incremental image APIOpenGnSys Support Team2020-08-146-566/+0
| | | | This API is not supported by ogClient yet and it uses the obsolete socket hydra API.
* #990 add wol_socket_open()OpenGnSys Support Team2020-08-063-20/+25
| | | | Add wol_socket_open() to initialize the WoL socket
* #980 fix compile warning in og_set_client_modeOpenGnSys Support Team2020-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | CC src/rest.o src/rest.c: In function ‘og_cmd_post_modes.isra.27’: src/rest.c:966:4: warning: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size between 3018 and 4041 -Wformat-truncation=] "MODE_FILE='%s'\nMAC='%s'\nDATA='%s'\n" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/rest.c:1085:7: template_name, scope_name); ~~~~~~~~~~~~~ src/rest.c:967:33: note: format string is defined here "MODE='PERM'\nTEMPLATE_NAME='%s'", ^~ src/rest.c:965:2: note: ‘snprintf’ output 57 or more bytes (assuming 5176) into a destination of size 4096 snprintf(cmd_params, sizeof(cmd_params), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MODE_FILE='%s'\nMAC='%s'\nDATA='%s'\n" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MODE='PERM'\nTEMPLATE_NAME='%s'", ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mode, mac, params, template_name); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* #980 error reporting in setclientmodeOpenGnSys Support Team2020-08-061-1/+3
| | | | Add syslog and use exit()
* #986 Fixs error in 'Advanced Netboot' caused by loss information from ↵Irina Gómez2020-08-051-7/+12
| | | | ogserver process owner (author Roberto Hueso Gómez).
* #980 Change GET and POST /modes URI to /modeRoberto Hueso Gómez2020-08-031-2/+2
| | | | | This patch changes the URI since it is semantically more correct to use the singular.
* #980 Fix POST /modes to use 'setclientmode' scriptRoberto Hueso Gómez2020-07-291-35/+140
| | | | | | | | | | | Now POST /modes does not only write to the database, it also uses the external bash script 'setclientmode' to generate configured PXE templates for each machine. NOTE: This fix requires that room and computer names are unique in the OpenGnsys DB. This behaviour is inherited from the previous 'setclientmode' script but, eventually, it should be replaced for an actual scope selector.
* #988 Check DB port size is in [0, UINT16_MAX]Roberto Hueso Gómez2020-07-151-1/+2
| | | | | Max port number is UINT16_MAX, so this checks whether this config parameter is in the correct range.
* #988 Add DB port option to ogserver.json config fileRoberto Hueso Gómez2020-07-106-0/+13
| | | | | This patch provides functionality to select a database port. It also adds a default IP for the database.
* Add GET /hardware REST requestRoberto Hueso Gómez2020-07-081-2/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements HTTP GET /hardware request which returns a list of the hardware associated with a particular computer. Request: GET /hardware { "scope": { "id": 6, "type": "computer" } } Response: 200 OK { "hardware": [ { "type": "Microprocesadores", "description": "CPU arch:x86 target:x86_64 cores:4" }, { "type": "Memorias", "description": "QEMU 4096MiB" }, { "type": "Tarjetas gráficas", "description": "Red Hat, Inc Virtio GPU" }, { "type": "Tarjetas de Red", "description": "Intel Corporation 82540EM Gigabit Ethernet Controller QEMU Virtual Machine" }, { "type": "Controladores IDE", "description": "Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] Qemu virtual machine" } ] }
* Add POST /modes REST requestRoberto Hueso Gómez2020-07-063-2/+136
| | | | | | | | | | | | | This patch implements HTTP POST /modes request which can change the mode of any particular scope. Request: POST /modes { "scope": {"id": 1, "type": "computer"}, "mode": "pxe" } Response: 200 OK
* #971 split wake on lan codeOpenGnSys Support Team2020-07-063-68/+91
| | | | Add wol.c and wol.h that implements WakeOnLan.
* #990 Use client broadcast address on WoLJavier Sánchez Parra2020-07-034-12/+35
| | | | | | | | | | | | | | | | Some universities have computers in a different subnet where the ogServer is, but ogServer WoL functionality only supported to send packet to its own subnets. This commit solves this. Now ogServer sends two WoL packets per client, one with the broadcast address of the interface indicated in the config file, the other with the broadcast address calculated with the address and netmask of the client. To ensure that the second WoL works correctly you must configure correctly the IP and netmask of the clients. Also, you have to configure the network of your organization to route WoL packet to the correct subnet.
* #971 linkage error after splitOpenGnSys Support Team2020-07-025-26/+27
| | | | | | | | | /usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmServer.h:25: multiple definition of `servidoradm'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmServer.h:25: first defined here /usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmServer.h:26: multiple definition of `puerto'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmServer.h:26: first defined here /usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmServer.h:35: multiple definition of `tbsockets'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmServer.h:35: first defined here /usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmLib.h:81: multiple definition of `ndebug'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmLib.h:81: first defined here /usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmLib.h:80: multiple definition of `szPathFileLog'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmLib.h:80: first defined here /usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmLib.h:80: multiple definition of `szPathFileCfg'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmLib.h:80: first defined here
* #980 Refactor GET /scopes backendRoberto Hueso Gómez2020-07-021-64/+68
| | | | | | This improves style and fixes some memleaks. Co-authored-by: OpenGnSys Support Team <soporte-og@soleta.eu>
* #980 Fix memleak in og_cmd_get_modes()OpenGnSys Support Team2020-06-301-0/+1
| | | | Missing closedir() call.