diff --git a/atelier_secu.md b/atelier_secu.md index 2e7ac28e8199d7e82cd80ebf0bbf0f62f4162bfc..c3f57d3b6385a015547d2b80f132628d39e4a812 100644 --- a/atelier_secu.md +++ b/atelier_secu.md @@ -4,7 +4,7 @@ - **Certificat** : Dans le contexte de la sécurité informatique, un certificat est un document numérique permettant d’identifier et d'authentifier un utilisateur ou un service. Il contient aussi les informations nécessaires à l'établissement d'une communication sécurisée (clef publique, protocoles de chiffrements utilisés, etc). - **Infrastructure à clef publique ou PKI (Public Key Infrastructure)** : Une PKI est un ensemble de processus basés sur l'utilisation de certificats qui permettent de chiffrer et d'authentifier les communications entre utilisateurs et services ou de service à service. -- **Politique de certification** : +- **Politique de certification** : Ensemble de décisions qui définissent les caractéristique des certificats émis. La politique de certification définit le temps de vie des certificats, la chaîne de confiance, les politiques de révocations, etc. - **Autorité de certification ou CA (Certificate Authority)** : Une autorité de certification est un organisme qui agit comme tiers de confiance. La CA est responsable de l'émission de certificats et de leur validation. Pour être considérée comme un tiers de confiance valide, l'autorité doit être reconnue par les principaux navigateurs et systèmes d'exploitation. https://fr.wikipedia.org/wiki/Autorit%C3%A9_de_certification @@ -39,8 +39,9 @@ Nous avons choisi de concevoir une entreprise fournissant une version simplifié ## Outils : -- MicroK8s (infra) -- https://www.vaultproject.io/ +- [**MicroK8s**](https://microk8s.io/) : Déploiement Kubernetes dans un seul package. +- [**Vault**](https://www.vaultproject.io/) : Outil de gestion de secrets qui propose de nombreuses fonctionnalité facilitant la mise en place d'une infrastructure à clé publique. +- [**Cert-manager**](https://cert-manager.io/) : Outil de gestion de certificat pour Kubernetes ## Schéma de l'infrastructure à clef publique @@ -48,7 +49,7 @@ Nous avons choisi de concevoir une entreprise fournissant une version simplifié - ChepiA -## Commandes : +## Mise en place de l'infrastructure : ### Set up k8s cluster + install Vault @@ -72,6 +73,8 @@ Initial Root Token: hvs.zWAYhaUkch0hfgfi18fduTvl --> Pour déverrouiller Vault, il faut que 3 des 5 tokens créés soit renseignés. On doit ensuite se logger avec le token root + + ### Install tools on pod - jq (json parsing) @@ -218,25 +221,38 @@ spec: #### 1. Création du service -- Nous allons utiliser un simple serveur web Nginx pour représenter la page d'accueil de notre entreprise : +- Nous allons utiliser un simple serveur web Nginx pour représenter la page d'accueil de notre entreprise. Les étapes suivantes montrent comment créer un stockage pour le code source de notre site et déployer une instance Nginx qui monte ce stockage dans le dossier `/usr/share/nginx/html`. -1. Créer le fichier de config de la page d'accueil : +1. Créer le fichier de config des volumes qui vont stocker nos fichiers HTML (`html_volume.yaml`) : ```yaml apiVersion: v1 -kind: ConfigMap +kind: PersistentVolume metadata: - name: nginx-configmap - namespace: default -data: - index.html: | - <html> - <h1> Bienvenue sur l'intranet de CHEPIA </h1> - <h3> Certificats gratos !! </h3> - </html> + name: pv-volume-html +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/home/mezmer/Documents/atelier_secu/html" +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pv-claim-html +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + volumeName: pv-volume-html + resources: + requests: + storage: 1Gi ``` -2. Créer le fichier de config du serveur : +2. Créer le fichier de config du serveur (`nginx.yaml`) : ```yaml apiVersion: apps/v1 @@ -260,16 +276,15 @@ spec: ports: - containerPort: 80 volumeMounts: - - name: nginx-index - mountPath: /usr/share/nginx/index.html - subPath: index.html + - name: nginx-index-storage + mountPath: /usr/share/nginx/html volumes: - - name: nginx-index - configMap: - name: nginx-configmap + - name: nginx-index-storage + persistentVolumeClaim: + claimName: pv-claim-html ``` -3. Appliquer les configs : `microk8s kubectl apply -f nginx-configmap.yaml`, `microk8s kubectl apply -f nginx.yaml` +3. Appliquer les configs : `microk8s kubectl apply -f html-volumes.yaml`, `microk8s kubectl apply -f nginx.yaml` #### 2. Création du certificat du service : @@ -365,7 +380,7 @@ Une fois le certificat importé, on retrouve notre autorité dans la liste des C Si on retourne sur *www.chepia.ch*, l'alerte a disparu. - + ### Mise à jour des certificats @@ -468,10 +483,15 @@ metadata: name: chepia-ch spec: acme: - server: http://127.0.0.1:8200/v1/pki_int - caBundle: <root cert in PEM format encoded in base64> + server: http://127.0.0.1:8200/v1/pki_int/acme/directory + caBundle: <intermediate CA cert in PEM format encoded in base64> privateKeySecretRef: name: issuer-token-lmzpj + solvers: + - selector: {} + http01: + ingress: + ingressClassName: nginx ``` - Activation de la config avec `microk8s kubectl apply -f acme.yaml ` diff --git a/atelier_secu.pdf b/atelier_secu.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6b7a729d869aaffc93ff2c3adea4d34ccd4e3510 Binary files /dev/null and b/atelier_secu.pdf differ diff --git a/html/images/god.jpg b/html/images/god.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2b68e839ae9fca0a2797cdc8b9ee787b9e200a89 Binary files /dev/null and b/html/images/god.jpg differ diff --git a/html/images/logo/logo-black.png b/html/images/logo/logo-black.png new file mode 100644 index 0000000000000000000000000000000000000000..0c6ab487802354347b24a73b107c432a51573c14 Binary files /dev/null and b/html/images/logo/logo-black.png differ diff --git a/html/images/logo/logo-color.png b/html/images/logo/logo-color.png new file mode 100644 index 0000000000000000000000000000000000000000..88b4524e92a227418083b61f5ba97ae680286625 Binary files /dev/null and b/html/images/logo/logo-color.png differ diff --git a/html/images/logo/logo-no-background.png b/html/images/logo/logo-no-background.png new file mode 100644 index 0000000000000000000000000000000000000000..0ecb6312d98dc0dcb96d0862303c3963ba9e7977 Binary files /dev/null and b/html/images/logo/logo-no-background.png differ diff --git a/html/images/logo/logo-white.png b/html/images/logo/logo-white.png new file mode 100644 index 0000000000000000000000000000000000000000..6334f23c0030fcdaebfaba22fbfd02016cad6ce9 Binary files /dev/null and b/html/images/logo/logo-white.png differ diff --git a/html/images/secure.jpg b/html/images/secure.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b039e8f6ae4008f9c9db5797ece44f43c7596414 Binary files /dev/null and b/html/images/secure.jpg differ diff --git a/html/images/ssl-certificate.png b/html/images/ssl-certificate.png new file mode 100644 index 0000000000000000000000000000000000000000..1a829f6dd11aa355f7b16ef7aed23319977de8f5 Binary files /dev/null and b/html/images/ssl-certificate.png differ diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000000000000000000000000000000000000..35f490482f392e6780410388a0370e4f02179eb2 --- /dev/null +++ b/html/index.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Chepia</title> + <style> + body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + box-sizing: border-box; + } + .container { + max-width: 1200px; + margin: 0 auto; + padding: 20px; + text-align: center; + } + img { + width: 80%; + display: block; + margin: 0 auto; + max-width: 100%; + } + </style> +</head> +<body> + <div class="container"> + <h1>Chepia - Certifications for the plebs</h1> + <img src="images/god.jpg"> + </div> +</body> +</html> diff --git a/html_volumes.yaml b/html_volumes.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f952cda0da53eb61f067f6f32b7b7373e95882aa --- /dev/null +++ b/html_volumes.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv-volume-html +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/home/mezmer/Documents/atelier_secu/html" +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pv-claim-html +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + volumeName: pv-volume-html + resources: + requests: + storage: 1Gi diff --git a/images/lock.png b/images/lock.png index 4a85bcfdea467b82ae30f37230bae42b36f25253..f072385ed4f4e5f8d299f126e521749d79ec2fd8 100644 Binary files a/images/lock.png and b/images/lock.png differ diff --git a/nginx.yaml b/nginx.yaml index 2f74c63e6e429383c5cc0dbe73346488094939a2..238ca6cec5ef0c2d660a30ae4a5f1ce13c4ff7e5 100644 --- a/nginx.yaml +++ b/nginx.yaml @@ -19,10 +19,9 @@ spec: ports: - containerPort: 80 volumeMounts: - - name: nginx-index - mountPath: /usr/share/nginx/index.html - subPath: index.html + - name: nginx-index-storage + mountPath: /usr/share/nginx/html volumes: - - name: nginx-index - configMap: - name: nginx-configmap + - name: nginx-index-storage + persistentVolumeClaim: + claimName: pv-claim-html