Skip to content
Snippets Groups Projects
Commit f86d953b authored by Florent Gluck's avatar Florent Gluck
Browse files

Updated docs/install.md according to the new nexus-exam changes

User exam credentials are now embedded into nexus-exam
parent bd1f9422
Branches
No related tags found
No related merge requests found
......@@ -218,6 +218,10 @@ check_server_var:
check_login_var:
$(call check_defined, LOGIN)
check_nexus_exam_vars:
$(call check_defined, EXAM_USER)
$(call check_defined, EXAM_PWD)
help_client:
@echo ""
@echo "┌──────────────────────────────────────────────────────────────────────────────┐"
......@@ -230,7 +234,10 @@ help_client:
@echo " build_nexush Build nexush for Linux/amd64; require the SERVER variable"
@echo " and optionally CERT (see below)"
@echo " build_nexus-cli Build nexus-cli for Linux/amd64; same as above"
@echo " build_nexus-exam Build nexus-exam for Linux/amd64"
@echo " build_nexus-exam Build nexus-exam for Linux/amd64; require EXAM_USER and"
@echo " and EXAM_PWD variables which define the credentials for"
@echo " the user used by nexus-exam to connect to nexus server"
@echo " the user nexus-exam uses to connect to nexus server"
@echo " clean_client Delete $(BUILD_DIR_CLIENT) directory (generated binaries)"
@echo ""
@echo "┌──────────────────────────────────────────────────────────────────────────────┐"
......@@ -291,10 +298,13 @@ build_nexus-cli: check_server_var copy_resources_client $(BUILD_DIR_CLIENT) $(SR
@echo "[Building nexus-cli into $(BUILD_DIR_CLIENT) directory]"
@cd $(SRC_CLIENT)/nexus-cli && go $(BUILD_CLIENT_FLAGS) && mv nexus-cli $(BUILD_ABS_CLIENT)
build_nexus-exam: $(BUILD_DIR_CLIENT) $(SRC_CLIENT)/nexus-exam
build_nexus-exam: check_nexus_exam_vars $(BUILD_DIR_CLIENT) $(SRC_CLIENT)/nexus-exam
@echo -n $(EXAM_USER) > src/client/nexus-exam/nexus_exam_user.val
@echo -n $(EXAM_PWD) > src/client/nexus-exam/nexus_exam_pwd.val
@echo "[Building nexus-exam into $(BUILD_DIR_CLIENT) directory]"
@cd $(SRC_CLIENT)/nexus-exam && go $(BUILD_CLIENT_FLAGS) && mv nexus-exam $(BUILD_ABS_CLIENT)
@strip -s $(BUILD_DIR_CLIENT)/nexus-exam
@rm src/client/nexus-exam/nexus_exam_user.val src/client/nexus-exam/nexus_exam_pwd.val
clean_client:
@/bin/rm -rf $(BUILD_DIR_CLIENT) $(RESOURCES_DIR_CLIENT)
......
......@@ -179,16 +179,16 @@ The `CERT` environment variable is optional:
- If defined, specifies the directory where resides the public certificate `ca-cert.pem` (typically `nexus-server/certs/`)
- in this case, it is embedded in the nexus client being built
- If not defined, the nexus client being built won't embed a certificate
- in this case, the public certificate must be specified when executing the client via the variable `NEXUS_CERT`, e.g.:
- in this case, the full path to the public certificate must be specified when executing the client via the variable `NEXUS_CERT`, e.g.:
```
NEXUS_CERT=/tmp/ca-cert.pem nexush janedoe@nexus.org
NEXUS_CERT=$HOME/nexus-server/certs/ca-cert.pem nexush janedoe@nexus.org
```
Both nexush and nexus-cli clients are built for multiple OSes (Linux, Windows, Mac) and architectures (amd64, i386 and arm64).
The line below builds nexush for all supported OSes and architectures, where the public certificate (`ca-cert.pem`) is located in /tmp and the server to use is at ip 10.0.2.15 and listens to port 1077:
The line below builds nexush for all supported OSes and architectures, where the public certificate (`ca-cert.pem`) is located in `$HOME/nexus-server/certs` and the server to use is at ip 10.0.2.15 and listens to port 1077:
```sh
make xbuild_client BIN=nexush CERT=$HOME SERVER=10.0.2.15:1077
make xbuild_client BIN=nexush CERT=$HOME/nexus-server/certs SERVER=10.0.2.15:1077
```
Below, we build nexus-cli for all supported OSes and architectures, without an embedded certificate, and the server to use is at ip 127.0.0.1 and listens to port 1077:
......@@ -234,7 +234,7 @@ For this specific case, only `SERVER` and `CERT` environment variables are used,
To only build nexush for Linux/amd64:
```sh
make build_nexush CERT=$HOME SERVER=10.0.2.15:1077
make build_nexush CERT=$HOME/nexus-server/certs SERVER=10.0.2.15:1077
```
To only build nexus-cli for Linux/amd64 uses the `build_nexus-cli` target instead.
......@@ -255,21 +255,26 @@ To run nexush for Mac/arm64 with user admin@nexus.org:
To run nexus-cli for Linux/i386 with user janedoe@nexus.org and with an external public certificate (i.e. not embedded):
```sh
NEXUS_CERT=/tmp/ca-cert.pem ./build/386/linux/nexus-cli janedoe@nexus.org
NEXUS_CERT=$HOME/nexus-server/certs/ca-cert.pem ./build/386/linux/nexus-cli janedoe@nexus.org
```
## Building nexus-exam and running it
## Building nexus-exam
For now, the only supported combination of OS and architecture for nexus-exam is Linux/amd64. Furthermore, it cannot be built statically as some static libraries are missing.
Two variables are required to build nexus-exam, `EXAM_USER` and `EXAM_PWD`. These variables define the credentials for the user used by nexus-exam to connect to nexus server. On the server side, make sure this user has the `VM_ATTACH_ANY` capability.
Here is an example of how to build nexus-exam:
```sh
make build_nexus-exam
make build_nexus-exam EXAM_USER=exam@nexus.org EXAM_PWD='3k0%tjslk$g42'
```
Running nexus-exam requires `SERVER_IP` and `CERT` environment variables. The former defines the nexus-server ip address; it must match the address defined in `config/certs/nexus-server.info` (typically 127.0.0.1 for a development server). The latter specifies the directory where the public certificate `ca-cert.pem` resides (typically in `nexus-server/certs/`):
## Running nexus-exam
Running nexus-exam requires `SERVER` and `CERT` environment variables which have the same meaning as what was explained previously with nexush and nexus-cli:
```sh
make run_nexus-exam SERVER_IP=10.0.2.15 CERT=$HOME
make run_nexus-exam SERVER=10.0.2.15:1077 CERT=$HOME/nexus-server/certs
```
## Deleting all nexus clients
......
......@@ -4,6 +4,7 @@ import (
"os"
"errors"
"strings"
_ "embed"
"encoding/json"
"nexus-common/vm"
"nexus-common/utils"
......@@ -24,8 +25,14 @@ import (
const (
windowTitle = "Live Exam"
env_nexus_exam_user = "NEXUS_EXAM_USER"
env_nexus_exam_pwd = "NEXUS_EXAM_PWD"
)
var (
//go:embed nexus_exam_user.val
nexus_exam_user string
//go:embed nexus_exam_pwd.val
nexus_exam_pwd string
)
func errorDialog(parent fyne.Window, msg string) {
......@@ -96,14 +103,14 @@ func run() int {
abortWindow(err.Error())
}
nexus_exam_user, found := os.LookupEnv(env_nexus_exam_user)
if !found {
abortWindow("environment variable \""+env_nexus_exam_user+"\" is not set!")
}
nexus_exam_pwd, found := os.LookupEnv(env_nexus_exam_pwd)
if !found {
abortWindow("environment variable \""+env_nexus_exam_pwd+"\" is not set!")
}
// nexus_exam_user, found := os.LookupEnv(env_nexus_exam_user)
// if !found {
// abortWindow("environment variable \""+env_nexus_exam_user+"\" is not set!")
// }
// nexus_exam_pwd, found := os.LookupEnv(env_nexus_exam_pwd)
// if !found {
// abortWindow("environment variable \""+env_nexus_exam_pwd+"\" is not set!")
// }
serverEnvVar, found := os.LookupEnv(g.ENV_NEXUS_SERVER)
if !found {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment