Custom domain certificate issue: Bad request & etc...
-
-
Save dcb9/07e2353affd2bc9cc92e to your computer and use it in GitHub Desktop.
ngrok self-hosting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. ./include.sh | |
mkdir -p bin | |
mkdir -p etc | |
if [ ! -f "${ROOT_CA_KEY}" ]; then | |
openssl genrsa -out "${ROOT_CA_KEY}" 2048 | |
openssl req -x509 -new -nodes -key "${ROOT_CA_KEY}" -subj "/CN=${DOMAIN}" -days 5000 -out "${ROOT_CA_PEM}" | |
openssl genrsa -out "${DOMAIN_KEY}" 2048 | |
openssl req -new -key "${DOMAIN_KEY}" -subj "/CN=${DOMAIN}" -out "${DOMAIN_CSR}" | |
openssl x509 -req -in "${DOMAIN_CSR}" -CA "${ROOT_CA_PEM}" -CAkey "${ROOT_CA_KEY}" -CAcreateserial -out "${DOMAIN_CRT}" -days 5000 | |
cat << EOL > "${DOMAIN_CONFIG}" | |
server_addr: "${DOMAIN}:${PORT}" | |
trust_host_root_certs: false | |
inspect_addr: "0.0.0.0:4040" | |
EOL | |
fi | |
if [ -f "src/Makefile" ]; then | |
pushd src | |
git reset --hard HEAD | |
else | |
git clone https://github.com/inconshreveable/ngrok.git src | |
pushd src | |
fi | |
cp "../${ROOT_CA_PEM}" assets/client/tls/ngrokroot.crt | |
GOOS="${OS}" GOARCH="${ARCH}" make release-server release-client | |
cp bin/ngrokd ../${SERVER_BINARY} | |
cp bin/ngrok ../${CLIENT_BINARY} | |
popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
rm -rf etc bin | |
if [ -f src/Makefile ]; then | |
cd src | |
git reset --hard HEAD | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. ./include.sh | |
./${CLIENT_BINARY} -config="${DOMAIN_CONFIG}" 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DOMAIN="tun.cluelist.com" | |
PORT="8291" | |
OS="linux" | |
ARCH="amd64" | |
# darwin / 386, amd64 | |
# linux / 386, amd64, arm | |
# windows / 386, amd64 | |
DOMAIN_CANONICAL="$(echo "$DOMAIN" | sed 's/\./_/g' )" | |
DOMAIN_CONFIG="etc/config-${DOMAIN_CANONICAL}" | |
ROOT_CA_KEY="etc/rootCA-${DOMAIN_CANONICAL}.key" | |
ROOT_CA_PEM="etc/rootCA-${DOMAIN_CANONICAL}.pem" | |
DOMAIN_KEY="etc/domain-${DOMAIN_CANONICAL}.key" | |
DOMAIN_CSR="etc/domain-${DOMAIN_CANONICAL}.csr" | |
DOMAIN_CRT="etc/domain-${DOMAIN_CANONICAL}.crt" | |
SERVER_BINARY="bin/ngrokd-${OS}_${ARCH}-${DOMAIN_CANONICAL}" | |
CLIENT_BINARY="bin/ngrok-${OS}_${ARCH}-${DOMAIN_CANONICAL}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. ./include.sh | |
./${SERVER_BINARY} \ | |
-domain="${DOMAIN}" \ | |
-tlsKey="${DOMAIN_KEY}" \ | |
-tlsCrt="${DOMAIN_CRT}" \ | |
-httpAddr=":80" \ | |
-httpsAddr=":443" \ | |
-tunnelAddr=":${PORT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment