@geogirafe/lib-geoportal 1.2.0-dev.2751114005 → 1.2.0-dev.2754564983
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
set +x
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
echo "certutil not found. Please install it first (e.g. libnss3-tools on Ubuntu)"
|
|
7
|
-
exit 1
|
|
8
|
-
fi
|
|
4
|
+
YELLOW='\033[1;33m'
|
|
5
|
+
NC='\033[0m'
|
|
9
6
|
|
|
10
|
-
# Ensure that
|
|
11
|
-
if ! command -v
|
|
12
|
-
echo "
|
|
7
|
+
# Ensure that openssl is installed (it ships by default on virtually every Linux distribution)
|
|
8
|
+
if ! command -v openssl &> /dev/null; then
|
|
9
|
+
echo "openssl not found. Please install it first (e.g. 'sudo apt install openssl' on Ubuntu)"
|
|
13
10
|
exit 1
|
|
14
11
|
fi
|
|
15
12
|
|
|
@@ -21,24 +18,63 @@ TARGET_DIR="${1:-buildtools/certs}"
|
|
|
21
18
|
mkdir -p "$TARGET_DIR"
|
|
22
19
|
cd "$TARGET_DIR"
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
DOMAINS="app.localhost,localhost"
|
|
22
|
+
IPS="127.0.0.1"
|
|
23
|
+
|
|
25
24
|
echo Generating development certificates
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
# Generate a local root CA (self-signed), reused across runs if it already exists
|
|
27
|
+
if [ ! -f rootCA.pem ] || [ ! -f rootCA-key.pem ]; then
|
|
28
|
+
openssl genrsa -out rootCA-key.pem 4096 2> /dev/null
|
|
29
|
+
openssl req -x509 -new -nodes -key rootCA-key.pem -sha256 -days 3650 \
|
|
30
|
+
-subj "/O=GeoGirafe Development CA/CN=GeoGirafe Local Dev Root CA" \
|
|
31
|
+
-addext "basicConstraints=critical,CA:TRUE" \
|
|
32
|
+
-addext "keyUsage=critical,keyCertSign,cRLSign" \
|
|
33
|
+
-out rootCA.pem
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Build the Subject Alternative Name list for the leaf (server) certificate
|
|
37
|
+
SAN=$(echo "$DOMAINS" | tr ',' '\n' | sed 's/^/DNS:/' | paste -sd,)
|
|
38
|
+
SAN="$SAN,$(echo "$IPS" | tr ',' '\n' | sed 's/^/IP:/' | paste -sd,)"
|
|
39
|
+
|
|
40
|
+
# Generate the leaf certificate for the dev server, signed by the local root CA
|
|
41
|
+
openssl genrsa -out app.localhost.key.pem 2048 2> /dev/null
|
|
42
|
+
openssl req -new -key app.localhost.key.pem \
|
|
43
|
+
-subj "/CN=app.localhost" \
|
|
44
|
+
-out app.localhost.csr.pem
|
|
45
|
+
|
|
46
|
+
openssl x509 -req -in app.localhost.csr.pem \
|
|
47
|
+
-CA rootCA.pem -CAkey rootCA-key.pem -CAcreateserial \
|
|
48
|
+
-days 825 -sha256 \
|
|
49
|
+
-extfile <(printf "subjectAltName=%s\nextendedKeyUsage=serverAuth" "$SAN") \
|
|
50
|
+
-out app.localhost.cert.pem
|
|
51
|
+
|
|
52
|
+
rm -f app.localhost.csr.pem
|
|
53
|
+
|
|
54
|
+
sudo chmod a+r app.localhost.* rootCA.pem
|
|
29
55
|
|
|
30
56
|
# Add root certificate to system trusted store
|
|
31
57
|
echo Trusting development certificates at the system level
|
|
32
58
|
sudo cp rootCA.pem /usr/local/share/ca-certificates/geogirafe-dev.crt
|
|
33
59
|
sudo update-ca-certificates
|
|
34
60
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
echo Trusting development certificates in
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
# Firefox, and older Chrome builds, keep their own certificate store (NSS) instead of relying on
|
|
62
|
+
# the system one. Importing into it requires certutil, which is optional: if it isn't installed
|
|
63
|
+
# we just skip this step and let the user trust the certificate manually in their browser.
|
|
64
|
+
if command -v certutil &> /dev/null; then
|
|
65
|
+
echo Trusting development certificates in Chrome
|
|
66
|
+
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "GeoGirafe LocalDevCert" -i rootCA.pem
|
|
67
|
+
|
|
68
|
+
echo Trusting development certificates in Firefox
|
|
69
|
+
FIREFOX_PROFILE=$(grep -E 'Path=' ~/.mozilla/firefox/profiles.ini 2> /dev/null | grep default-release | cut -d'=' -f2)
|
|
70
|
+
if [ -n "$FIREFOX_PROFILE" ]; then
|
|
71
|
+
certutil -d sql:$HOME/.mozilla/firefox/$FIREFOX_PROFILE -A -t "C,,C" -n "GeoGirafe LocalDevCert" -i rootCA.pem
|
|
72
|
+
fi
|
|
73
|
+
else
|
|
74
|
+
echo -e "${YELLOW}certutil not found (optional, part of the libnss3-tools package on Ubuntu/Debian).${NC}"
|
|
75
|
+
echo -e "${YELLOW}Skipping automatic trust in Firefox/Chrome's own certificate store.${NC}"
|
|
76
|
+
echo -e "${YELLOW}Install libnss3-tools and re-run this script, or manually import $TARGET_DIR/rootCA.pem as a trusted authority in your browser settings.${NC}"
|
|
77
|
+
fi
|
|
42
78
|
|
|
43
79
|
echo Certificate was added successfully.
|
|
44
80
|
echo Please restart your browser to take it into account.
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.2.0-dev.
|
|
1
|
+
{"version":"1.2.0-dev.2754564983", "build":"2754564983", "date":"12/08/2026"}
|