Skip to content

Commit

Permalink
Merge pull request #418 from mysteriumnetwork/release-03-fixes
Browse files Browse the repository at this point in the history
Backport of configuration fixes from #406
  • Loading branch information
soffokl authored Oct 2, 2018
2 parents 5027e5c + ab0ae5f commit b9dd5d6
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bin/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ COPY bin/helpers/prepare-run-env.sh /usr/local/bin/prepare-run-env.sh
COPY bin/docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

COPY bin/package/config /etc/mysterium-node
COPY bin/common_package /etc/mysterium-node
COPY bin/package/config/common /etc/mysterium-node
COPY bin/package/config/linux /etc/mysterium-node

COPY --from=builder /go/src/github.com/mysteriumnetwork/node/build/myst/myst /usr/bin/myst

Expand Down
9 changes: 9 additions & 0 deletions bin/helpers/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ function copy_client_config {
cp -vrp "bin/client_package/config/${OS_DIR}/." ${DST_DIR}/config
fi
}

function copy_config {
local OS_DIR=$1
local DST_DIR=$2
cp -vrp "bin/package/config/common/" ${DST_DIR}/config
if [[ -d "bin/package/config/${OS_DIR}/" ]]; then
cp -vrp "bin/package/config/${OS_DIR}/." ${DST_DIR}/config
fi
}
Binary file added bin/package/config/common/GeoLite2-Country.mmdb
Binary file not shown.
82 changes: 82 additions & 0 deletions bin/package/config/darwin/update-resolv-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash

# Mac name-resolution updater based on @cl's script here:
# https://blog.netnerds.net/2011/10/openvpn-update-client-dns-on-mac-os-x-using-from-the-command-line/
# Openvpn envar parsing taken from the script in debian's openvpn package.
# Smushed together and improved by @andrewgdotcom.

# Parses DHCP options from openvpn to update resolv.conf
# To use set as 'up' and 'down' script in your openvpn *.conf:
# up /etc/openvpn/update-resolv-conf
# down /etc/openvpn/update-resolv-conf

[ "$script_type" ] || exit 0
[ "$dev" ] || exit 0

NMSRVRS=()
SRCHS=()
adapters=()

NETWORKSETUP=/usr/sbin/networksetup

# Set bash delimeter to be line break (temporarily)
IFSSAVE=$IFS
IFS=$'\n'
# Get adapter list
for i in `$NETWORKSETUP -listallnetworkservices |grep -v denotes`; do
adapters=(${adapters[@]} "$i")
done
IFS=$IFSSAVE

split_into_parts()
{
part1="$1"
part2="$2"
part3="$3"
}

update_all_dns()
{
for adapter in "${adapters[@]}"
do
echo updating dns for $adapter
# set dns server to the vpn dns server
if [[ "${SRCHS[@]}" ]]; then
$NETWORKSETUP -setsearchdomains "$adapter" "${SRCHS[@]}"
fi
if [[ "${NMSRVRS[@]}" ]]; then
$NETWORKSETUP -setdnsservers "$adapter" "${NMSRVRS[@]}"
fi
done
}

clear_all_dns()
{
for adapter in "${adapters[@]}"
do
echo updating dns for $adapter
$NETWORKSETUP -setdnsservers "$adapter" empty
$NETWORKSETUP -setsearchdomains "$adapter" empty
done
}

case "$script_type" in
up)
for optionvarname in ${!foreign_option_*} ; do
option="${!optionvarname}"
echo "$option"
split_into_parts $option
if [ "$part1" = "dhcp-option" ] ; then
if [ "$part2" = "DNS" ] ; then
NMSRVRS=(${NMSRVRS[@]} $part3)
elif [ "$part2" = "DOMAIN" ] ; then
SRCHS=(${SRCHS[@]} $part3)
fi
fi
done
update_all_dns
;;
down)
clear_all_dns
;;
esac
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions bin/package_debian
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ printf "Building Debian package '$PACKAGE_FILE' for architecture '$ARCH' ..\n" \
--after-remove bin/package/installation/post-uninstall.sh \
-s dir -t deb \
${BINARY}=${OS_DIR_BIN}/myst \
bin/package/config/=${OS_DIR_CONFIG}/ \
bin/common_package/=${OS_DIR_CONFIG}/ \
bin/package/config/linux/=${OS_DIR_CONFIG}/ \
bin/package/config/common/=${OS_DIR_CONFIG}/ \
bin/package/sudoers/=${OS_DIR_SUDOERS}/ \
bin/package/installation/=${OS_DIR_INSTALLATION}/ \
INSTALL.md=${OS_DIR_DOC}/
Expand Down
4 changes: 1 addition & 3 deletions bin/package_standalone
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ else
cp -vp ${BINARY} ${DIR_TEMP}/myst
fi

copy_client_config $OS $DIR_TEMP
cp -vrp "bin/common_package/" ${DIR_TEMP}/config
cp -vrp "bin/package/config/." ${DIR_TEMP}/config
copy_config $OS $DIR_TEMP

# Tarball package directory
if [ "$OS" == "windows" ]; then
Expand Down

0 comments on commit b9dd5d6

Please sign in to comment.