Skip to content
This repository was archived by the owner on Mar 25, 2022. It is now read-only.

Commit a5c7ce7

Browse files
author
Lars Gierth
committed
ipfs: create preload.ipfs.io gateways
License: MIT Signed-off-by: Lars Gierth <[email protected]>
1 parent 7caba55 commit a5c7ce7

File tree

5 files changed

+77
-2
lines changed

5 files changed

+77
-2
lines changed

ipfs/pages/build.sh

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ printf %s\\n "$(lookup pages_bootstrap_ssl_key)" > out/bootstrap.libp2p.io.key
3030
printf %s\\n "$(lookup pages_bootstrap_ssl_trustchain)" > out/bootstrap.libp2p.io.trustchain.crt
3131
printf %s\\n "$(lookup pages_bootstrap_ssl_dhparam)" > out/bootstrap.libp2p.io.dhparam.pem
3232

33+
printf %s\\n "$(lookup pages_preload_ssl_cert)" > out/preload.ipfs.io.crt
34+
printf %s\\n "$(lookup pages_preload_ssl_key)" > out/preload.ipfs.io.key
35+
printf %s\\n "$(lookup pages_preload_ssl_trustchain)" > out/preload.ipfs.io.trustchain.crt
36+
printf %s\\n "$(lookup pages_preload_ssl_dhparam)" > out/preload.ipfs.io.dhparam.pem
37+
3338
printf %s\\n "$(lookup pages_ipld_ssl_cert)" > out/ipld.io.crt
3439
printf %s\\n "$(lookup pages_ipld_ssl_key)" > out/ipld.io.key
3540
printf %s\\n "$(lookup pages_ipld_ssl_trustchain)" > out/ipld.io.trustchain.crt

ipfs/pages/install.sh

+24
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ if [ ! -z "$(diff -Naur "$cert_dest/bootstrap.libp2p.io.dhparam.pem" "out/bootst
132132
reload=1
133133
fi
134134

135+
if [ ! -z "$(diff -Naur "$cert_dest/preload.ipfs.io.crt" "out/preload.ipfs.io.crt")" ]; then
136+
echo "ipfs/pages *.preload.ipfs.io ssl cert changed"
137+
reload=1
138+
fi
139+
140+
if [ ! -z "$(diff -Naur "$cert_dest/preload.ipfs.io.key" "out/preload.ipfs.io.key")" ]; then
141+
echo "ipfs/pages *.preload.ipfs.io ssl key changed"
142+
reload=1
143+
fi
144+
145+
if [ ! -z "$(diff -Naur "$cert_dest/preload.ipfs.io.trustchain.crt" "out/preload.ipfs.io.trustchain.crt")" ]; then
146+
echo "ipfs/pages *.preload.ipfs.io ssl trustchain changed"
147+
reload=1
148+
fi
149+
150+
if [ ! -z "$(diff -Naur "$cert_dest/preload.ipfs.io.dhparam.pem" "out/preload.ipfs.io.dhparam.pem")" ]; then
151+
echo "ipfs/pages *.preload.ipfs.io ssl dhparam changed"
152+
reload=1
153+
fi
154+
135155
if [ ! -z "$(diff -Naur "$cert_dest/ipld.io.crt" "out/ipld.io.crt")" ]; then
136156
echo "ipfs/pages ipld.io ssl cert changed"
137157
reload=1
@@ -556,6 +576,10 @@ if [ "reload$reload" == "reload1" ]; then
556576
cp "out/bootstrap.libp2p.io.key" "$cert_dest/bootstrap.libp2p.io.key"
557577
cp "out/bootstrap.libp2p.io.trustchain.crt" "$cert_dest/bootstrap.libp2p.io.trustchain.crt"
558578
cp "out/bootstrap.libp2p.io.dhparam.pem" "$cert_dest/bootstrap.libp2p.io.dhparam.pem"
579+
cp "out/preload.ipfs.io.crt" "$cert_dest/preload.ipfs.io.crt"
580+
cp "out/preload.ipfs.io.key" "$cert_dest/preload.ipfs.io.key"
581+
cp "out/preload.ipfs.io.trustchain.crt" "$cert_dest/preload.ipfs.io.trustchain.crt"
582+
cp "out/preload.ipfs.io.dhparam.pem" "$cert_dest/preload.ipfs.io.dhparam.pem"
559583
cp "out/ipld.io.crt" "$cert_dest/ipld.io.crt"
560584
cp "out/ipld.io.key" "$cert_dest/ipld.io.key"
561585
cp "out/ipld.io.trustchain.crt" "$cert_dest/ipld.io.trustchain.crt"

ipfs/pages/nginx.conf.tpl

+46
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,52 @@ server {
133133
# 31536000 seconds = 12 months, as advised by hstspreload.org
134134
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
135135
136+
location / {
137+
proxy_set_header Host $(var pages_bootstrap_hostname).bootstrap.libp2p.io:443;
138+
proxy_set_header Upgrade \$http_upgrade;
139+
proxy_set_header Connection \$http_connection;
140+
proxy_set_header Sec-WebSocket-Key \$http_sec_websocket_key;
141+
proxy_set_header Sec-WebSocket-Extensions \$http_sec_websocket_extensions;
142+
proxy_set_header Sec-WebSocket-Version \$http_sec_websocket_version;
143+
proxy_pass http://ws_bootstrap;
144+
proxy_pass_header Server;
145+
proxy_read_timeout 60s;
146+
}
147+
}
148+
149+
server {
150+
server_name *.preload.ipfs.io;
151+
access_log /var/log/nginx/access.log mtail;
152+
153+
listen 443 ssl;
154+
listen [::]:443 ssl;
155+
ssl_certificate /etc/nginx/certs/preload.ipfs.io.crt;
156+
ssl_certificate_key /etc/nginx/certs/preload.ipfs.io.key;
157+
ssl_dhparam /etc/nginx/certs/preload.ipfs.io.dhparam.pem;
158+
ssl_trusted_certificate /etc/nginx/certs/preload.ipfs.io.trustchain.crt;
159+
160+
# HSTS (ngx_http_headers_module is required)
161+
# 31536000 seconds = 12 months, as advised by hstspreload.org
162+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
163+
164+
location /ipfs {
165+
proxy_set_header Host \$host:443;
166+
proxy_set_header X-Ipfs-Gateway-Prefix "";
167+
proxy_pass http://gateway;
168+
}
169+
170+
location /ipns {
171+
proxy_set_header Host \$host:443;
172+
proxy_set_header X-Ipfs-Gateway-Prefix "";
173+
proxy_pass http://gateway;
174+
}
175+
176+
location /api {
177+
proxy_set_header Host \$host:443;
178+
proxy_set_header X-Ipfs-Gateway-Prefix "";
179+
proxy_pass http://gateway;
180+
}
181+
136182
location / {
137183
proxy_set_header Host \$host:80;
138184
proxy_set_header Upgrade \$http_upgrade;

secrets_secure

ssl/nginx.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# 2. Obtain lets-encrypt-x3-cross-signed.pem and isrgrootx1.pem
1717
#
1818
# 3. Fetch the certificate and key from the certs host:
19-
# scp '[email protected]:/root/.caddy/acme/acme-v01.api.letsencrypt.org/sites/wikipedia-on-ipfs.org/*.{crt,key}' secrets/
19+
# scp '[email protected]:/root/.caddy/acme/acme-v02.api.letsencrypt.org/sites/wikipedia-on-ipfs.org/*.{crt,key}' secrets/
2020
#
2121
# 4. Build trustchains:
2222
# cat lets-encrypt-x3-cross-signed.pem >> secrets/wikipedia-on-ipfs.org.crt

0 commit comments

Comments
 (0)