« Le portail self-service » : différence entre les versions
Aucun résumé des modifications |
|||
| (4 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 10 : | Ligne 10 : | ||
==== Le fork ==== | ==== Le fork ==== | ||
https://github.com/yrougy/incus-demo | https://github.com/yrougy/incus-demo | ||
=== Authentification par certificat TLS === | |||
Il est nécessaire de générer un certificat TLS X.509 pour l'authentification par clés. Voir sur [[Certificat X.509]] pour les détails. | |||
Le certificat auto-signé est à importer dans le serveur incus ('''pas sur le portail''') pour que le portail puisse créer des instances. Appelons incus-portal.crt ce certificat. Sur le serveur: | |||
<code>yves@mini-incus:~$ '''incus config trust add-certificate incus-portal.crt'''</code> | |||
<code>yves@mini-incus:~$ '''incus config trust list'''</code> | |||
<code>+------------------+--------+-------------+--------------+----------------------+</code> | |||
<code>| NOM | TYPE | DESCRIPTION | EMPREINTE | DATE D'EXPIRATION |</code> | |||
<code>+------------------+--------+-------------+--------------+----------------------+</code> | |||
<code>| incus-portal.crt | client | | 1e8d62510140 | 2026/02/26 13:26 CET |</code> | |||
<code>+------------------+--------+-------------+--------------+----------------------+</code> | |||
<code>| incus-ui.crt | client | | acedea6eff7d | 2027/11/19 18:31 CET |</code> | |||
<code>+------------------+--------+-------------+--------------+----------------------+</code> | |||
<code>| mini-incus | server | | bbf8ec7eb3d8 | 2035/02/20 18:28 CET |</code> | |||
<code>+------------------+--------+-------------+--------------+----------------------+</code> | |||
=== Usage === | === Usage === | ||
====== Dépendances ====== | ====== Dépendances ====== | ||
https://go.dev/doc/install pour golang | https://go.dev/doc/install pour golang | ||
| Ligne 21 : | Ligne 46 : | ||
cd incus-demo-server | cd incus-demo-server | ||
export CGO_ENABLED=1 # pour permettre l'intégration de C dans le projet GO | export CGO_ENABLED=1 # pour permettre l'intégration de C dans le projet GO | ||
go install github.com/ | go install github.com/yrougy/incus-demo/cmd/incus-demo-server@main | ||
====== Construction ====== | ====== Construction ====== | ||
| Ligne 68 : | Ligne 93 : | ||
# et ça sera dans le incus-ui.pem | # et ça sera dans le incus-ui.pem | ||
client: | client: | ||
certificate: |- | certificate: |- # incusPortal.crt | ||
key: |- | key: |- # incusPortal.key | ||
project: default | project: default | ||
server: | server: | ||
url: "" | url: "https://nomdelinstance:8443" | ||
# Certificate est le certificat de l'interface web | # Certificate est le certificat de l'interface web | ||
certificate: |- | certificate: |- | ||
target: | target: nomDuCluster | ||
instance: | instance: | ||
| Ligne 83 : | Ligne 108 : | ||
source: | source: | ||
instance: "self1" #nom de l'image créée | #instance: "self1" #nom de l'image créée | ||
image: "alpine/3.18" | |||
type: "container" #ou "virtual-machine" | type: "container" #ou "virtual-machine" | ||
| Ligne 96 : | Ligne 122 : | ||
session: | session: | ||
command: [" | command: ["sh"] | ||
expiry: 900 | expiry: 900 | ||
console_only: false | console_only: false | ||
Dernière version du 26 février 2025 à 13:35
L'idée derrière le portail self-service, est d'avoir une plateforme pour accéder à des machines préconfigurées pour des cours ou des expérimentations:
- La machine a une durée de vie définie à l'avance
- Il y a un contrôle de limite par adresse IP
- Basé sur des images créées localement
Projet d'origine
https://github.com/lxc/incus-demo-server
Le fork
https://github.com/yrougy/incus-demo
Authentification par certificat TLS
Il est nécessaire de générer un certificat TLS X.509 pour l'authentification par clés. Voir sur Certificat X.509 pour les détails.
Le certificat auto-signé est à importer dans le serveur incus (pas sur le portail) pour que le portail puisse créer des instances. Appelons incus-portal.crt ce certificat. Sur le serveur:
yves@mini-incus:~$ incus config trust add-certificate incus-portal.crt
yves@mini-incus:~$ incus config trust list
+------------------+--------+-------------+--------------+----------------------+
| NOM | TYPE | DESCRIPTION | EMPREINTE | DATE D'EXPIRATION |
+------------------+--------+-------------+--------------+----------------------+
| incus-portal.crt | client | | 1e8d62510140 | 2026/02/26 13:26 CET |
+------------------+--------+-------------+--------------+----------------------+
| incus-ui.crt | client | | acedea6eff7d | 2027/11/19 18:31 CET |
+------------------+--------+-------------+--------------+----------------------+
| mini-incus | server | | bbf8ec7eb3d8 | 2035/02/20 18:28 CET |
+------------------+--------+-------------+--------------+----------------------+
Usage
Dépendances
https://go.dev/doc/install pour golang
apt install -y git build-essential screen git clone https://github.com/lxc/incus-demo-server cd incus-demo-server export CGO_ENABLED=1 # pour permettre l'intégration de C dans le projet GO go install github.com/yrougy/incus-demo/cmd/incus-demo-server@main
Construction
make
Configuration
server:
api:
address: "[::]:8080"
blocklist:
- 1.2.3.4
feedback:
enabled: false
timeout: 20
email:
smtp: SERVER:PORT
from: ADDRESS
to: ADDRESS
subject: User feedback from try-it
limits: # 64 machines au total, chaque IP peut en demander 10
total: 64
ip: 10
maintenance:
enabled: false
message: Custom downtime message
proxy:
address: ""
certificate: |-
key: |-
PEM
statistics:
keys:
- 69280011-c8a5-4ef9-ae3d-e7caf4d06e06
terms: |-
ToS<br />
<ul>
<li>Access to this service may be revoked at any time for any reason</li>
<li>Access to this service is solely provided to test</li>
<li>Your IP address, access time and activity on the test server may be recorded</li>
<li>Any abuse of this service may lead to a ban or other applicable actions</li>
</ul>
incus:
# certificate est la clé publique du certificat d'authentification
# key est la clé privée du certificat d'authentification
# on peut la faire avec openssl pkcs12 -in incus-ui.pfx -out incus-ui.pem -nodes
# et ça sera dans le incus-ui.pem
client:
certificate: |- # incusPortal.crt
key: |- # incusPortal.key
project: default
server:
url: "https://nomdelinstance:8443"
# Certificate est le certificat de l'interface web
certificate: |-
target: nomDuCluster
instance:
allocate:
count: 4
expiry: 21600
source: #instance: "self1" #nom de l'image créée image: "alpine/3.18" type: "container" #ou "virtual-machine"
profiles: - default #Profil Incus à utiliser
limits: cpu: 1 disk: 10GiB processes: 200 memory: 512MiB
session: command: ["sh"] expiry: 900 console_only: false network: ipv6
Appel
~/go/bin/incus-demo-server