« Le portail self-service » : différence entre les versions
Aucun résumé des modifications |
|||
| (9 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 ====== | |||
https://go.dev/doc/install pour golang | |||
= | apt install -y git build-essential screen | ||
go install github.com/ | 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 ====== | ====== Construction ====== | ||
| Ligne 24 : | Ligne 55 : | ||
api: | api: | ||
address: "[::]:8080" | address: "[::]:8080" | ||
blocklist: | blocklist: | ||
- 1.2.3.4 | - 1.2.3.4 | ||
feedback: | feedback: | ||
enabled: false | enabled: false | ||
| Ligne 36 : | Ligne 65 : | ||
to: ADDRESS | to: ADDRESS | ||
subject: User feedback from try-it | subject: User feedback from try-it | ||
limits: # 64 machines au total, chaque IP peut en demander 10 | |||
limits: | |||
total: 64 | total: 64 | ||
ip: 10 | ip: 10 | ||
maintenance: | maintenance: | ||
enabled: false | enabled: false | ||
message: Custom downtime message | message: Custom downtime message | ||
proxy: | proxy: | ||
address: "" | address: "" | ||
certificate: |- | certificate: |- | ||
key: |- | key: |- | ||
PEM | PEM | ||
statistics: | statistics: | ||
keys: | keys: | ||
- 69280011-c8a5-4ef9-ae3d-e7caf4d06e06 | - 69280011-c8a5-4ef9-ae3d-e7caf4d06e06 | ||
terms: |- | terms: |- | ||
ToS<nowiki><br /></nowiki> | |||
<nowiki><ul></nowiki> | <nowiki><ul></nowiki> | ||
<nowiki><li>Access to this service may be revoked at any time for any reason</li></nowiki> | <nowiki><li>Access to this service may be revoked at any time for any reason</li></nowiki> | ||
| Ligne 64 : | Ligne 87 : | ||
<nowiki><li>Any abuse of this service may lead to a ban or other applicable actions</li></nowiki> | <nowiki><li>Any abuse of this service may lead to a ban or other applicable actions</li></nowiki> | ||
<nowiki></ul></nowiki> | <nowiki></ul></nowiki> | ||
incus: | 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: | 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: |- | certificate: |- | ||
target: | target: nomDuCluster | ||
instance: | instance: | ||
allocate: | allocate: | ||
count: 4 | count: 4 | ||
| Ligne 81 : | Ligne 108 : | ||
source: | source: | ||
# | #instance: "self1" #nom de l'image créée | ||
# | image: "alpine/3.18" | ||
type: "container" #ou "virtual-machine" | |||
# | |||
profiles: | profiles: | ||
- default | - default #Profil Incus à utiliser | ||
limits: | limits: | ||
| Ligne 98 : | Ligne 121 : | ||
memory: 512MiB | memory: 512MiB | ||
session: | session: | ||
command: ["sh"] | |||
command: [" | |||
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