-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
119 lines (99 loc) · 3.22 KB
/
Dockerfile
File metadata and controls
119 lines (99 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Dockerfile pour OQS avec TLS en Python - Version optimisée
FROM ubuntu:22.04
# Éviter les invites interactives pendant l'installation
ENV DEBIAN_FRONTEND=noninteractive
# Mise à jour et installation des dépendances de base
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
python3 \
python3-pip \
python3-dev \
libssl-dev \
pkg-config \
ninja-build \
wget \
curl \
vim \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*
# Installation de liboqs (Open Quantum Safe) avec configuration optimisée
WORKDIR /tmp
RUN git clone -b main https://github.com/open-quantum-safe/liboqs.git
WORKDIR /tmp/liboqs
RUN mkdir build && cd build && \
cmake -GNinja .. \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DOQS_BUILD_ONLY_LIB=ON \
-DOQS_DIST_BUILD=ON \
-DOQS_MINIMAL_BUILD="KEM_kyber_512;KEM_kyber_768;KEM_kyber_1024;SIG_dilithium_2;SIG_dilithium_3;SIG_falcon_512" && \
ninja && \
ninja install
# Utilisation d'OpenSSL système avec patch OQS (approche alternative plus rapide)
WORKDIR /tmp
# Installation des dépendances Python d'abord
RUN pip3 install --upgrade pip setuptools wheel
# Installation des packages Python OQS et cryptographiques
RUN pip3 install \
cffi \
cryptography \
pyOpenSSL \
requests \
flask \
asyncio \
aiohttp \
pycryptodome \
pytest \
pytest-asyncio \
pytest-timeout
# Installation de liboqs-python avec une approche simplifiée
WORKDIR /tmp
RUN git clone -b main https://github.com/open-quantum-safe/liboqs-python.git
WORKDIR /tmp/liboqs-python
# Installation avec gestion d'erreur
RUN pip3 install . || (echo "Installation directe échouée, essai avec --no-cache-dir" && pip3 install --no-cache-dir .)
# Mise à jour des bibliothèques
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/local.conf && \
ldconfig
# Création du répertoire de travail
WORKDIR /app
# Variables d'environnement
ENV PYTHONPATH=/app:/usr/local/lib/python3.10/site-packages
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Exposition des ports pour les tests TLS
EXPOSE 8443 8080
# Script de démarrage qui vérifie l'installation
COPY <<EOF /app/check_oqs.py
#!/usr/bin/env python3
import sys
try:
import oqs
print("✅ OQS successfully installed!")
print(f"OQS version: {oqs.oqs_version()}")
# Test des algorithmes KEM
kems = oqs.get_enabled_KEM_mechanisms()
print(f"Available KEMs: {len(kems)} algorithms")
for kem in kems[:5]:
print(f" - {kem}")
# Test des algorithmes de signature
sigs = oqs.get_enabled_sig_mechanisms()
print(f"Available Signatures: {len(sigs)} algorithms")
for sig in sigs[:5]:
print(f" - {sig}")
# Test basique KEM
if 'Kyber512' in kems:
client = oqs.KeyEncapsulation('Kyber512')
public_key = client.generate_keypair()
print("✅ Kyber512 KEM test successful!")
print("🎉 OQS environment ready!")
except ImportError as e:
print(f"❌ Error importing OQS: {e}")
sys.exit(1)
except Exception as e:
print(f"❌ Error testing OQS: {e}")
sys.exit(1)
EOF
RUN chmod +x /app/check_oqs.py
# Commande par défaut pour vérifier l'installation
CMD ["python3", "/app/check_oqs.py"]