Skip to content

Commit 240f02a

Browse files
Add function to print VPN access credentials after core startup
1 parent 007f6d0 commit 240f02a

1 file changed

Lines changed: 32 additions & 26 deletions

File tree

scripts/dappnode_install.sh

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,36 @@ wait_for_internal_ip() {
193193
done
194194
}
195195

196+
# Print VPN access credentials (Wireguard + OpenVPN) after core has started.
197+
# Works on both Linux and macOS as long as the relevant containers are running.
198+
print_vpn_access_credentials() {
199+
echo ""
200+
echo "Waiting for VPN initialization..."
201+
wait_for_internal_ip "DAppNodeCore-dappmanager.dnp.dappnode.eth" 120 20
202+
203+
echo ""
204+
echo "##############################################"
205+
echo "# DAppNode VPN Access Credentials #"
206+
echo "##############################################"
207+
echo ""
208+
echo "Your DAppNode is ready! Connect using your preferred VPN client."
209+
echo "Choose either Wireguard (recommended) or OpenVPN and import the"
210+
echo "credentials below into your VPN app to access your DAppNode."
211+
echo ""
212+
213+
echo "--- Wireguard ---"
214+
docker exec -i DAppNodeCore-api.wireguard.dnp.dappnode.eth getWireguardCredentials --localhost 2>&1 || \
215+
echo "Wireguard credentials not yet available. Try later with: dappnode_wireguard --localhost"
216+
217+
echo ""
218+
echo "--- OpenVPN ---"
219+
docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get dappnode_admin --localhost 2>&1 || \
220+
echo "OpenVPN credentials not yet available. Try later with: dappnode_openvpn_get dappnode_admin --localhost"
221+
222+
echo ""
223+
echo "Import the configuration above into your VPN client of choice to access your DAppNode at http://my.dappnode"
224+
}
225+
196226
# Build docker compose "-f <file>" args from downloaded compose files.
197227
# This avoids depending on alias expansion or profile-generated strings.
198228
build_dncore_compose_args() {
@@ -986,6 +1016,7 @@ main() {
9861016
if [ ! -f "${DAPPNODE_DIR}/.firstboot" ]; then
9871017
echo "DAppNode installed" 2>&1 | tee -a "$LOGFILE"
9881018
dappnode_core_start
1019+
print_vpn_access_credentials
9891020
fi
9901021

9911022
# Run test in interactive terminal (first boot only)
@@ -1000,32 +1031,7 @@ main() {
10001031
if $IS_MACOS; then
10011032
echo "DAppNode installed" 2>&1 | tee -a "$LOGFILE"
10021033
dappnode_core_start
1003-
1004-
echo ""
1005-
echo "Waiting for VPN initialization..."
1006-
wait_for_internal_ip "DAppNodeCore-dappmanager.dnp.dappnode.eth" 120 20
1007-
1008-
echo ""
1009-
echo "##############################################"
1010-
echo "# DAppNode VPN Access Credentials #"
1011-
echo "##############################################"
1012-
echo ""
1013-
echo "Your DAppNode is ready! Connect using your preferred VPN client."
1014-
echo "Choose either Wireguard (recommended) or OpenVPN and import the"
1015-
echo "credentials below into your VPN app to access your DAppNode."
1016-
echo ""
1017-
1018-
echo "--- Wireguard ---"
1019-
docker exec -i DAppNodeCore-api.wireguard.dnp.dappnode.eth getWireguardCredentials --localhost 2>&1 || \
1020-
echo "Wireguard credentials not yet available. Try later with: dappnode_wireguard --localhost"
1021-
1022-
echo ""
1023-
echo "--- OpenVPN ---"
1024-
docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get dappnode_admin --localhost 2>&1 || \
1025-
echo "OpenVPN credentials not yet available. Try later with: dappnode_openvpn_get dappnode_admin --localhost"
1026-
1027-
echo ""
1028-
echo "Import the configuration above into your VPN client of choice to access your DAppNode at http://my.dappnode"
1034+
print_vpn_access_credentials
10291035
fi
10301036
}
10311037

0 commit comments

Comments
 (0)