Browse Source

linux connect fixes

tags/v1.4.28
Jonathan Cobb 4 years ago
parent
commit
ae12475757
1 changed files with 16 additions and 10 deletions
  1. +16
    -10
      bin/linux_connect_bubble

+ 16
- 10
bin/linux_connect_bubble View File

@@ -3,12 +3,16 @@
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
# #
# Connect a Linux system to a Bubble # Connect a Linux system to a Bubble
# You must run this as a user who has "sudo" privileges
# #
# Usage: # Usage:
# #
# bubble_linux_connect [hostname] # bubble_linux_connect [hostname]
# #
# hostname : hostname of the bubble to connect this Linux system to
# hostname : bubble to connect this Linux system to
# If not specified, an env var will be used (see below)
# If neither BUBBLE_HOST (hostname) or BUBBLE_API (URL) are specified,
# then you'll be asked to enter the Bubble hostname
# #
# Environment Variables # Environment Variables
# #
@@ -17,14 +21,14 @@
# BUBBLE_USER : account to use # BUBBLE_USER : account to use
# BUBBLE_PASS : password for account # BUBBLE_PASS : password for account
# #
# What this command does:
# * Disconnects from any current Bubble
# * Checks if the device already exists for the Bubble. If not, creates the device.
# * Checks if we have a local copy of the certificate and vpn.conf files. If not, download them.
# * Ensures routing configuration is correct
# * Installs the certificate (this step requires your interaction)
# * Installs the VPN config
# * Starts the VPN
# This command will:
# * Disconnect from any current Bubble
# * Check if the device already exists for the Bubble. If not, creates the device
# * Check if we have a local copy of the certificate and vpn.conf files. If not, download them
# * Ensure routing configuration is correct
# * Install the certificate (this step requires your interaction)
# * Install the VPN config
# * Start the VPN
# #
function die() { function die() {
echo 1>&2 "$0: fatal error: ${1}" echo 1>&2 "$0: fatal error: ${1}"
@@ -79,11 +83,13 @@ if [[ -z "$(which bget)" ]]; then
fi fi
fi fi


echo "Logging in to Bubble ${BUBBLE_API} ..."
bget me || die "Error logging into Bubble with API: ${BUBBLE_API}" bget me || die "Error logging into Bubble with API: ${BUBBLE_API}"


# Ensure WireGuard is not running # Ensure WireGuard is not running
if [[ ! -z "$(wg show)" ]]; then if [[ ! -z "$(wg show)" ]]; then
wg-quick down wg0
echo "Stopping WireGuard VPN ..."
sudo wg-quick down wg0
fi fi


BUBBLE_DEVICE_BASE="${HOME}/bubble_devices" BUBBLE_DEVICE_BASE="${HOME}/bubble_devices"


Loading…
Cancel
Save