Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions 12 .dappnode_profile
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ alias dappnode_stop='docker-compose $DNCORE_YMLS stop && docker stop $(docker co
# Start docker core containers
alias dappnode_start='docker-compose $DNCORE_YMLS up -d && docker start $(docker container ls -a -q -f name=DAppNode*)'
# Return open-vpn credentials from a specific user. e.g: dappnode_get dappnode_admin
alias dappnode_get='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get'
alias dappnode_openvpn_get='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get'
# Return open-vpn admin credentials
alias dappnode_connect='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth getAdminCredentials'
alias dappnode_openvpn='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth getAdminCredentials || echo -e "Open VPN may not be installed. Try with wireguard \e[32mdappnode_wireguard\e[0m"'
# Return wifi credentials (ssid and password)
alias dappnode_wifi='cat /usr/src/dappnode/DNCORE/docker-compose-wifi.yml | grep "SSID\|WPA_PASSPHRASE"'
# Return remote credentials in plain text. OPTIONS:
# --qr (QR format). --local (local creds for NAT loopback issues)
alias dappnode_wireguard='docker exec -i DAppNodeCore-api.wireguard.dnp.dappnode.eth getWireguardCredentials'
alias dappnode_wireguard='docker exec -i DAppNodeCore-api.wireguard.dnp.dappnode.eth getWireguardCredentials || echo -e "Wireguard may not be installed. Try with Open VPN \e[32mdappnode_openvpn\e[0m" '
# Execute access_credentials.sh script to check for connectivity methods
alias dappnode_connect='/usr/bin/bash /usr/src/dappnode/scripts/dappnode_access_credentials.sh'
# Return all available commands
HELP_MESSAGE="\n\tDAppNode commands available:\n\n\tdappnode_help\t\tprints out this message\n\n\tdappnode_wifi\t\tget wifi credentials (SSID and password)\n\n\tdappnode_openvpn\treturn Open VPN credentials\n\n\tdappnode_wireguard\treturn Wireguard VPN credentials (dappnode_wireguard --help for more info)\n\n\tdappnode_connect\tcheck connectivity methods available in DAppNode\n\n\tdappnode_status\t\treturn status of dappnode containers\n\n\tdappnode_start\t\tstart dappnode containers\n\n\tdappnode_stop\t\tstop dappnode containers\n"
alias dappnode_help='echo -e ${HELP_MESSAGE}'

return

2 changes: 1 addition & 1 deletion 2 Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM docker:dind
# hadolint ignore=DL3018
RUN apk update && \
apk add --no-cache xorriso git xz curl ca-certificates iptables cpio bash \
apk add --no-cache xorriso git xz curl ca-certificates iptables cpio bash perl-utils \
docker-compose && \
rm -rf /var/cache/apk/*

Expand Down
29 changes: 11 additions & 18 deletions 29 iso/scripts/generate_dappnode_iso_debian.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
#!/bin/bash
set -e

#echo "Downloading debian ISO image: debian-firmware-testing-amd64-netinst-2020-06-22.iso..."
#if [ ! -f /images/debian-firmware-testing-amd64-netinst-2020-06-22.iso ]; then
# wget http://vdo.dappnode.io/debian-firmware-testing-amd64-netinst-2020-06-22.iso \
# -O /images/debian-firmware-testing-amd64-netinst-2020-06-22.iso
#fi
#echo "Done!"
# Source = https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current/amd64/iso-cd/
ISO_NAME=firmware-edu-11.0.0-amd64-netinst.iso
ISO_PATH="/images/${ISO_NAME}"
ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current/amd64/iso-cd
SHASUM="7621912ef67ff89d65dc078c94aaea9d652150ef62e1ed02781367bb9657d908 ${ISO_PATH}"

#ISO_NAME=firmware-testing-amd64-netinst.iso
#ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/weekly-builds/amd64/iso-cd/

#ISO_NAME=firmware-bullseye-DI-alpha3-amd64-netinst.iso
#ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/bullseye_di_alpha3+nonfree/amd64/iso-cd/

ISO_NAME=firmware-bullseye-DI-alpha3-amd64-netinst.iso
ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/bullseye_di_alpha3+nonfree/amd64/iso-cd/

echo "Downloading debian ISO image: firmware-bullseye-DI-alpha2-amd64-netinst.iso..."
if [ ! -f /images/${ISO_NAME} ]; then
echo "Downloading debian ISO image: ${ISO_NAME}..."
if [ ! -f ${ISO_PATH} ]; then
wget ${ISO_URL}/${ISO_NAME} \
-O /images/${ISO_NAME}
-O ${ISO_PATH}
fi
echo "Done!"

echo "Verifying download..."
[[ "$(shasum -a 256 ${ISO_PATH})" != "$SHASUM" ]] && { echo "ERROR: wrong shasum"; exit 1; }

echo "Clean old files..."
rm -rf dappnode-isoº
rm -rf DappNode-debian-*
Expand Down
44 changes: 24 additions & 20 deletions 44 scripts/dappnode_access_credentials.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash

# This script will iterate over the access methods in dappnode
# and display its credentials based on priority.
# PRIORITY: Wi-Wi > Avahi > VPN (Wireguard > OpenVpn)
# and return the credentials for each service available

#############
#0.VARIABLES#
Expand All @@ -21,28 +20,27 @@ WIFI_GET_CREDS=$(grep 'SSID\|WPA_PASSPHRASE' /usr/src/dappnode/DNCORE/docker-com
AVAHI_ENDPOINT="dappnode.local"
DAPPNODE_ADMINUI_URL="http://my.dappnode"
DAPPNODE_ADMINUI_LOCAL_URL="http://${AVAHI_ENDPOINT}"
DAPPNODE_WELCOME_URL="http://welcome.dappnode"
DAPPNODE_WELCOME_URL="http://welcome.dappnode.io"

#############
#1.FUNCTIONS#
#############

function dappnode_startup_check () {
echo -n "Wait until DAppNode initializes (press ctrl+c to stop) "
sleep 5
echo -ne "Checking DAppNode connectivity methods (press ctrl+c to stop)...\n"
n=0
until [ "$n" -ge 8 ]
do
[ "$(docker inspect -f '{{.State.Running}}' ${DAPPMANAGER_CONTAINER} 2> /dev/null)" = "true" ] && break
n=$((n+1))
echo -n "."
sleep 8
sleep 4
done
}

# $1 Connection method $2 Credentials
function create_connection_message () {
echo -e "\n\e[32mConnect to DAppNode through $1 using the following credentials:\e[0m\n$2\n\nAccess your DAppNode at \e[4m$DAPPNODE_ADMINUI_URL\e\n\n[0mDiscover more ways to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n"
echo -e "\e[32mConnect to DAppNode through $1 using the following credentials:\e[0m\n$2\n\nAccess your DAppNode at \e[4m$DAPPNODE_ADMINUI_URL\e\n\n[0mDiscover more ways to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m"
}

function wifi_connection () {
Expand All @@ -52,24 +50,23 @@ function wifi_connection () {
[ "$(docker inspect -f '{{.State.Running}}' ${WIFI_CONTAINER} 2> /dev/null)" = "true" ] && \
# Check interface variable is set
[ -n "$(docker exec -it $WIFI_CONTAINER iw dev | grep 'Interface' | awk 'NR==1{print $2}')" ] && \
create_connection_message "Wi-Fi" "$WIFI_GET_CREDS" && \
exit 0 || echo -e "\nWifi not detected"
create_connection_message "Wi-Fi" "$WIFI_GET_CREDS" || \
echo -e "\e[33mWifi not detected\e[0m"
}

function avahi_connection () {
# Ping to avahi endpoint: -c: number of pings. -w: timeout
avahi-resolve -n $AVAHI_ENDPOINT > /dev/null 2>&1 || { echo "Avahi-daemon not detected" ; return ; }
# Https container exists
# shellcheck disable=SC2143
avahi-resolve -n $AVAHI_ENDPOINT > /dev/null 2>&1 && \
# Https container exists
[ "$(docker ps -a | grep ${HTTPS_CONTAINER})" ] && \
# Https container running
[ "$(docker inspect -f '{{.State.Running}}' ${HTTPS_CONTAINER})" = "true" ] && \
# Https env variable LOCAL_PROXYING="true"
[ "$(docker exec -i ${HTTPS_CONTAINER} sh -c 'echo "$LOCAL_PROXYING"')" = "true" ] && \
# avahi-daemon running => systemctl is-active avahi-daemon RETURNS "active" or "inactive"
[ "$(systemctl is-active avahi-daemon)" = "active" ] && \
echo -e "\n\e[32mConnect to DAppNode through Local Proxying.\e[0m\n\nVisit \e[4m$DAPPNODE_ADMINUI_LOCAL_URL\e\n\n[0mCheck out all the access methods available to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n" && \
exit 0 || echo "Avahi-daemon not detected"
echo -e "\n\e[32mConnect to DAppNode through Local Proxying.\e[0m\n\nVisit \e[4m$DAPPNODE_ADMINUI_LOCAL_URL\e\n\n[0mCheck out all the access methods available to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n" || \
echo -e "\e[33mLocal Proxy not detected\e[0m"
}

function wireguard_connection () {
Expand All @@ -78,8 +75,8 @@ function wireguard_connection () {
[ "$(docker ps -a | grep ${WIREGUARD_CONTAINER})" ] && \
# wireguard container running
[ "$(docker inspect -f '{{.State.Running}}' ${WIREGUARD_CONTAINER})" = "true" ] && \
create_connection_message "Wireguard" "$($WIREGUARD_GET_CREDS)" && \
exit 0 || echo "Wireguard not detected"
create_connection_message "Wireguard" "$($WIREGUARD_GET_CREDS)" || \
echo -e "\e[33mWireguard not detected\e[0m"
}

function openvpn_connection () {
Expand All @@ -88,19 +85,26 @@ function openvpn_connection () {
[ "$(docker ps -a | grep ${OPENVPN_CONTAINER})" ] && \
# openvpn container running
[ "$(docker inspect -f '{{.State.Running}}' ${OPENVPN_CONTAINER})" = "true" ] && \
create_connection_message "Open-VPN" "$($OPENVPN_GET_CREDS)" && \
exit 0 || echo "Open-VPN not detected"
create_connection_message "Open-VPN" "$($OPENVPN_GET_CREDS)" || \
echo -e "\e[33mOpen VPN not detected\e[0m"
}

function line_separator () {
echo "====================="
}

########
#2.MAIN#
########

dappnode_startup_check
line_separator
wifi_connection
line_separator
avahi_connection
line_separator
wireguard_connection
line_separator
openvpn_connection

echo -e "\e[33mWARNING: no connection services detected\e[0m Check out all the access methods available to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n"
exit 0
exit 0
17 changes: 10 additions & 7 deletions 17 scripts/dappnode_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SWGET="wget -q -O-"
# Other
CONTENT_HASH_PKGS=(geth openethereum nethermind)
ARCH=$(dpkg --print-architecture)
WELCOME_MESSAGE="echo -e '\nChoose a way to connect to your DAppNode, then go to \e[1mhttp://my.dappnode\e[0m\n\n\e[1m- Wifi\e[0m\t\tScan and connect to DAppNodeWIFI. Get wifi credentials with \e[32mdappnode_wifi\e[0m\n\n\e[1m- Local Proxy\e[0m\tConnect to the same router as your DAppNode. Then go to \e[1mhttp://dappnode.local\e[0m\n\n\e[1m- Wireguard\e[0m\tDownload Wireguard app on your device. Get your dappnode wireguard credentials with \e[32mdappnode_wireguard\e[0m\n\n\e[1m- Open VPN\e[0m\tDownload OPen VPN app on your device. Get your openVPN creds with \e[32mdappnode_openvpn\e[0m\n\n\nTo see a full list of commands available execute \e[32mdappnode_help\e[0m\n'"

# Clean if update
if [ "$UPDATE" = true ]; then
Expand Down Expand Up @@ -231,21 +232,23 @@ dappnode_start() {
echo -e "source ${DAPPNODE_PROFILE}\n" >>$PROFILE
fi

# Remove return from profile
sed -i '/return/d' $DAPPNODE_PROFILE | tee -a $LOGFILE

if ! grep -q "$DAPPNODE_ACCESS_CREDENTIALS" "$DAPPNODE_PROFILE"; then
[ -f $DAPPNODE_ACCESS_CREDENTIALS ] || ${WGET} -O ${DAPPNODE_ACCESS_CREDENTIALS} ${DAPPNODE_ACCESS_CREDENTIALS_URL}
# shellcheck disable=SC2216
sed -i "/return/i /bin/bash $DAPPNODE_ACCESS_CREDENTIALS" $DAPPNODE_PROFILE | echo "/bin/bash $DAPPNODE_ACCESS_CREDENTIALS" >>$DAPPNODE_PROFILE
fi
# Append welcome message execution at end of profile
# shellcheck disable=SC1003
sed -i '$a\'"${WELCOME_MESSAGE}"'' $DAPPNODE_PROFILE

# Download access_credentials script
[ -f $DAPPNODE_ACCESS_CREDENTIALS ] || ${WGET} -O ${DAPPNODE_ACCESS_CREDENTIALS} ${DAPPNODE_ACCESS_CREDENTIALS_URL}

# Delete dappnode_install.sh execution from rc.local if exists, and is not the unattended firstboot
if [ -f "/etc/rc.local" ] && [ ! -f "/usr/src/dappnode/.firstboot" ]; then
sed -i '/\/usr\/src\/dappnode\/scripts\/dappnode_install.sh/d' /etc/rc.local 2>&1 | tee -a $LOGFILE
fi

# Display credentials to the user
[ -f $DAPPNODE_ACCESS_CREDENTIALS ] && /bin/bash $DAPPNODE_ACCESS_CREDENTIALS
# Display help message to the user
echo -e "Execute \e[32mdappnode_help\e[0m to see a full list with commands available"
}

installExtraDpkg() {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.