File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ FROM ${BASE} AS rootfs
88COPY http_get.py /http_get.py
99COPY echo_server.py /echo_server.py
1010COPY urllib_get.py /urllib_get.py
11+ COPY https_test.py /https_test.py
1112
1213# --- CPIO rootfs builder ---
1314FROM alpine:3.20 AS cpio
14- RUN apk add --no-cache cpio findutils
15+ RUN apk add --no-cache cpio findutils ca-certificates
1516COPY --from=rootfs / /rootfs/
1617
1718# DNS configuration for glibc's getaddrinfo (added in the cpio stage
@@ -22,4 +23,9 @@ RUN mkdir -p /rootfs/etc && \
2223 echo "hosts: files dns" > /rootfs/etc/nsswitch.conf && \
2324 echo "127.0.0.1 localhost" > /rootfs/etc/hosts
2425
26+ # CA certificates for TLS
27+ RUN mkdir -p /rootfs/etc/ssl/certs /rootfs/usr/lib/ssl && \
28+ cp /etc/ssl/certs/ca-certificates.crt /rootfs/etc/ssl/certs/ && \
29+ ln -sf /etc/ssl/certs/ca-certificates.crt /rootfs/usr/lib/ssl/cert.pem
30+
2531RUN cd /rootfs && find . | cpio -o -H newc > /output.cpio 2>/dev/null
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ run-get:
2222run-urllib :
2323 hyperlight-unikraft {{ kernel}} --initrd {{ initrd}} --memory {{ memory}} -- / urllib_get.py
2424
25+ # Run HTTPS (TLS) test
26+ run-https :
27+ hyperlight-unikraft {{ kernel}} --initrd {{ initrd}} --memory {{ memory}} -- / https_test.py
28+
2529# Run echo server
2630run-echo :
2731 hyperlight-unikraft {{ kernel}} --initrd {{ initrd}} --memory {{ memory}} -- / echo_server.py
Original file line number Diff line number Diff line change 1+ import urllib .request
2+ import sys
3+
4+ print ("Testing HTTPS (TLS) through proxied sockets..." )
5+ try :
6+ r = urllib .request .urlopen ('https://api.github.com' , timeout = 10 )
7+ print (f"Status: { r .status } " )
8+ print ("SUCCESS: HTTPS works!" )
9+ except Exception as e :
10+ print (f"FAILED: { e } " )
11+ sys .exit (1 )
You can’t perform that action at this time.
0 commit comments