From 507d09bbdf23cb8bda9318598efe7a88309034dc Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sat, 12 Sep 2020 10:54:34 -0400 Subject: [PATCH] avoid NPE --- README.md | 66 ++++++++++++++++++- .../bubble/model/account/AccountSshKey.java | 1 + .../java/bubble/model/device/FlexRouter.java | 1 + dist-README.md | 65 ------------------ dev-README.md => docs/dev.md | 22 ++++--- 5 files changed, 80 insertions(+), 75 deletions(-) delete mode 100644 dist-README.md rename dev-README.md => docs/dev.md (57%) diff --git a/README.md b/README.md index 52821f6d..8096cf2a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,65 @@ -bubble -====== +# Bubble: a privacy-first VPN +Bubble helps you start and manage your own private VPN. + +It also adds tools to this VPN to improve your internet experience by modifying your traffic: to +remove ads, block malware, and much more. + +## Operating System Support +Once your Bubble is running, any device can connect to it: Windows, Linux, Mac, iOS, Android; if it supports VPN connections, +it will probably work just fine. + +However, to launch your own Bubble using this software, you will need a Linux machine to run the launcher. +It *probably* works on MacOS, but it has not been tested and there are likely to be issues. Pull requests are welcome! + +If you'd like to enjoy all the benefits of Bubble without going through this hassle, please try out the Bubble launching +service available on [bubblev.com](https://bubblev.com). Any Bubble you launch from [bubblev.com](https://bubblev.com) +will also be "yours only" -- all Bubbles disconnect from their launcher during configuration. + +## Getting Started + +### Install OpenJDK 11 +Install [Java 11](https://openjdk.java.net/install/) from OpenJDK. +It will probably be easier to install using an OS package, for example `sudo apt install openjdk-11-jre-headless` + +### Install PostgreSQL and Redis +Install [PostgreSQL 10](https://www.postgresql.org/download/) if it is not installed on your system. +It will probably be easier to install using an OS package, for example `sudo apt install postgresql` + +Install [Redis](https://redis.io/download) if it is not already installed on your system. +It will probably be easier to install using an OS package, for example `sudo apt install redis` + +### Configure PostgreSQL +The Bubble launcher connects to a PostgreSQL database named 'bubble' as the PostgreSQL user 'bubble'. + +If your current OS user account has permissions to create PostgreSQL databases and users, you can skip this step +since the database and user will be created upon startup. + +Otherwise, please either: + * Update the PostgreSQL `pg_hba.conf` file to allow your current OS user to create databases and DB users, OR + * Create a PostgreSQL database named `bubble` and a database user named `bubble`. Set a password for the `bubble` user, + and set the environment variable `BUBBLE_PG_PASSWORD` to this password when starting the Bubble launcher. + +### Download a Bubble Distribution +Download and unzip the latest [Bubble Distribution ZIP](https://bubblev.com/download). + +### Start the Bubble launcher +Run the `./bin/run.sh` script to start the Bubble launcher. Once the server is running, it will try to open a browser window +to continue configuration. It will also print out the URL, so if the browser doesn't start correctly, you can paste this +into your browser's location bar. + +### Activate your local Bubble +Your Bubble is running locally in a "blank" mode. It needs an initial "root" account and some basic services configured. + +#### Activate via Web UI +The browser-based admin UI should be displaying an "Activate" page. Complete the information on this page and submit the +data. The Bubble Launcher will create an initial "root" account and other basic system configurations. + +#### Activate via command line +Copy the file in `config/activation.json`, then edit the file. There are comments in the file to guide you. +After saving the updated file, run this command: + + `./bin/bactivate /path/to/activation.json` + +### Launch a new Bubble! +Using the web UI, click "Bubbles", select "New Bubble". Fill out and submit the New Bubble form, and your Bubble will be created! diff --git a/bubble-server/src/main/java/bubble/model/account/AccountSshKey.java b/bubble-server/src/main/java/bubble/model/account/AccountSshKey.java index 2759798d..2039ea70 100644 --- a/bubble-server/src/main/java/bubble/model/account/AccountSshKey.java +++ b/bubble-server/src/main/java/bubble/model/account/AccountSshKey.java @@ -57,6 +57,7 @@ public class AccountSshKey extends IdentifiableBase implements HasAccount { @Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(10000+ENC_PAD)+") NOT NULL") @Getter private String sshPublicKey; public AccountSshKey setSshPublicKey(String k) { + if (k == null) k = ""; this.sshPublicKey = k.trim(); if (!empty(sshPublicKey)) this.sshPublicKeyHash = sha256_hex(sshPublicKey); return this; diff --git a/bubble-server/src/main/java/bubble/model/device/FlexRouter.java b/bubble-server/src/main/java/bubble/model/device/FlexRouter.java index 3f28acdf..12c04d39 100644 --- a/bubble-server/src/main/java/bubble/model/device/FlexRouter.java +++ b/bubble-server/src/main/java/bubble/model/device/FlexRouter.java @@ -67,6 +67,7 @@ public class FlexRouter extends IdentifiableBase implements HasAccount { @Getter private String key; public boolean hasKey () { return !empty(key); } public FlexRouter setKey(String k) { + if (k == null) k = ""; this.key = k.trim(); if (!empty(key)) this.keyHash = sha256_hex(key); return this; diff --git a/dist-README.md b/dist-README.md deleted file mode 100644 index a542f7a4..00000000 --- a/dist-README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Bubble: a privacy-first VPN - -Bubble helps you start and manage your own private VPN. - -It also adds tools to this VPN to improve your Internet experience by modifying your traffic: to -remove ads, block malware, and much more. - -## Operating System Support -Once your Bubble is running, any device can connect to it: Windows, Linux, Mac, iOS, Android; if it supports VPN connections, -it will probably work just fine. - -However, to launch your own Bubble using this software, you will need a Linux machine to run the launcher. -It *probably* works on MacOS, but it has not been tested and there are likely to be issues. Pull requests are welcome! - -If you'd like to enjoy all the benefits of Bubble without going through this hassle, please try out the Bubble launching -service available on [bubblev.com](https://bubblev.com). Any Bubble you launch from [bubblev.com](https://bubblev.com) -will also be "yours only" -- all Bubbles disconnect from their launcher during configuration. - -## Getting Started - -### Install OpenJDK 11 -Install [Java 11](https://openjdk.java.net/install/) from OpenJDK. -It will probably be easier to install using an OS package, for example `sudo apt install openjdk-11-jre-headless` - -### Install PostgreSQL and Redis -Install [PostgreSQL 10](https://www.postgresql.org/download/) if it is not installed on your system. -It will probably be easier to install using an OS package, for example `sudo apt install postgresql` - -Install [Redis](https://redis.io/download) if it is not already installed on your system. -It will probably be easier to install using an OS package, for example `sudo apt install redis` - -### Configure PostgreSQL -The Bubble launcher connects to a PostgreSQL database named 'bubble' as the PostgreSQL user 'bubble'. - -If your current OS user account has permissions to create PostgreSQL databases and users, you can skip this step -since the database and user will be created upon startup. - -Otherwise, please either: - * Update the PostgreSQL `pg_hba.conf` file to allow your current OS user to create databases and DB users, OR - * Create a PostgreSQL database named `bubble` and a database user named `bubble`. Set a password for the `bubble` user, - and set the environment variable `BUBBLE_PG_PASSWORD` to this password when starting the Bubble launcher. - -### Download a Bubble Distribution -Download and unzip the latest [Bubble Distribution ZIP](https://bubblev.com/download). - -### Start the Bubble launcher -Run the `./bin/run.sh` script to start the Bubble launcher. Once the server is running, it will try to open a browser window -to continue configuration. It will also print out the URL, so if the browser doesn't start correctly, you can paste this -into your browser's location bar. - -### Activate your local Bubble -Your Bubble is running locally in a "blank" mode. It needs an initial "root" account and some basic services configured. - -#### Activate via Web UI -The browser-based admin UI should be displaying an "Activate" page. Complete the information on this page and submit the -data. The Bubble Launcher will create an initial "root" account and other basic system configurations. - -#### Activate via command line -Copy the file in `config/activation.json`, then edit the file. There are comments in the file to guide you. -After saving the updated file, run this command: - - `./bin/bactivate /path/to/activation.json` - -### Launch a new Bubble! -Using the web UI, click "Bubbles", select "New Bubble". Fill out and submit the New Bubble form, and your Bubble will be created! diff --git a/dev-README.md b/docs/dev.md similarity index 57% rename from dev-README.md rename to docs/dev.md index ee828585..df5f8d4e 100644 --- a/dev-README.md +++ b/docs/dev.md @@ -2,8 +2,8 @@ bubble ====== # Development Setup - -The instructions presume you are running a newly setup Ubuntu 18.04 system. Either the Ubuntu Server or Desktop distribution will work. +These instructions presume you are running a newly setup Ubuntu 20.04 system. +Either the Ubuntu Server or Desktop distribution will work. ## First-Time System Setup After you clone this repository, run: @@ -14,9 +14,11 @@ If you are running on a non-Ubuntu system, copy that file to something like: ./bin/first_time_myoperatingsystem.sh -And then edit it such that all the same packages get installed. Then submit a pull request and we can add support for your operating system to the main repository. +And then edit it such that all the same packages get installed. +Then submit a pull request and we can add support for your operating system to the main repository. -You only need to run this command once, ever, on a development system. It ensures that the appropriate packages are installed and proper databases and database users exist. +You only need to run this command once, ever, on a development system. +It ensures that the appropriate packages are installed and proper databases and database users exist. ## First-Time Dev Setup After running the system setup above, run: @@ -28,13 +30,16 @@ This will grab all the submodules and perform an initial build of all components ## Bubble environment file You will need a file named `${HOME}/.bubble.env` which contains various environment variables required to run the server. -Talk to another developer to get a copy of this file. Do not ever send this file over email or any other unencrypted channel. -Always use `scp` to copy this file from one machine to another. +Talk to another developer to get a copy of this file. +Do not ever send this file over email or any other unencrypted channel, it contains secret keys to various cloud +services that your Bubble will use. Always use `scp` to copy this file from one machine to another. -After you have the env file in place, create a symlink called `${HOME}/.bubble-test.env` +If you will be running any tests, create a symlink called `${HOME}/.bubble-test.env` cd ${HOME} && ln -s .bubble.env .bubble-test.env +The `.bubble-test.env` file is used by the test suite. + ## Subsequent Updates If you want to grab the latest code, and ensure that all git submodules are properly in sync with the main repository, run: @@ -43,4 +48,5 @@ If you want to grab the latest code, and ensure that all git submodules are prop This will update and rebuild all submodules, and the main bubble jar file. ## Running in development -Assuming you ran the commands above, you can run a test server using the method described in the bubble-web [README](https://git.bubblev.org/bubbleV/bubble-web/src/branch/master/README.md). +Assuming you ran the commands above, you can run a test server using the method described in +the bubble-web [README](https://git.bubblev.org/bubblev/bubble-web/src/branch/master/README.md).