Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve install output #38

Merged
merged 9 commits into from
Mar 26, 2018
Merged

Improve install output #38

merged 9 commits into from
Mar 26, 2018

Conversation

fortuna
Copy link
Collaborator

@fortuna fortuna commented Mar 23, 2018

With this change we display the step before it's done, making it clearer what's going on.
We are now also able to detect if the firewall is blocking the connection.

This should address many of the issues users are having.

@sandrigo FYI

Sample output

> Verifying that Docker is installed .......... OK
> Creating persistent state dir ............... OK
> Generating secret key ....................... OK
> Generating TLS certificate .................. OK
> Generating SHA-256 certificate fingerprint .. OK
> Starting Shadowbox .......................... OK
> Starting Watchtower ......................... OK
> Waiting for Shadowsocks to be healthy ....... OK
> Creating first user ......................... OK
> Adding API URL to config .................... OK
> Checking firewall ........................... BLOCKED

CONGRATULATIONS! Your Outline Server is up and running.

You won’t be able to access it externally, despite your server being correctly
set up, because this host machine has a firewall that is preventing incoming
connections to ports 12380 and 43732.

If you plan to have a single Access Key to access your server, opening those 
ports on TCP and UDP should suffice. If you plan on adding additional Access
Keys, you’ll have to open ports 1024 through 65535 on your firewall since the
Outline Server may allocate any of those ports to new Access Keys.


To manage your Outline Server, please copy the following text (including curly brackets) into Step 2 of the Outline Manager interface:

{
  "apiUrl": "https://100.000.000.000:12380/XXXXXXXX",
  "certSha256": "008F471BECDB3755936A476015DA8E756D1E1E71F764F83C4E7277EF482E0B60"
}

@fortuna fortuna self-assigned this Mar 23, 2018
@fortuna fortuna requested a review from trevj March 23, 2018 21:41
@fortuna fortuna added the server/advanced install Issues with manual/advanced server installation label Mar 23, 2018
@trevj
Copy link
Contributor

trevj commented Mar 26, 2018

Note to self on how to test this:

curl -SL https://raw.githubusercontent.com/Jigsaw-Code/outline-server/fortuna-docker/src/server_manager/install_scripts/install_server.sh | bash

@@ -235,11 +268,17 @@ install_shadowbox() {
# require new dependencies.
cat <<END_OF_SERVER_OUTPUT

Please copy the following configuration to your Outline Manager:
CONGRATULATIONS! Your Outline Server is up and running.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outline Server -> Outline server

(and throughout)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

set up, because this host machine has a firewall that is preventing incoming
connections to ports ${SB_API_PORT} and ${ACCESS_KEY_PORT}.

If you plan to have a single Access Key to access your server, opening those
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Access Key -> access key

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

log_for_sentry "Setting SB_PUBLIC_IP"
# TODO(fortuna): Make sure this is IPv4
readonly SB_PUBLIC_IP=${SB_PUBLIC_IP:-$(curl -4s https://ipinfo.io/ip)}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra blank line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


log_step "Creating first user"
function check_firewall() {
if ! curl --max-time 5 --cacert "${SB_CERTIFICATE_FILE}" -s "${PUBLIC_API_URL}/access-keys" >/dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty funny that we import the cert only for the connectivity check, not for creating the first user.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we shouldn't. The point of using localhost (which requires that we do --insecure) is that we avoid hitting firewall issues and get to install the server completely. The check for firewall can be done last, such that if the admin fixes it post-installation, the Server will work seamlessly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought accessing via localhost was orthogonal to using the cert, or does the cert include the public IP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cert has the public ip only, so we need to use insecure mode.

We could potentially add localhost to the cert, but we need to figure it out.
It's unclear whether we should worry about a localhost connection being intercepted. You could have a malicious app take over all ports, but I think that may be outside our threat model.
In any case, adding too many options to the cert can make it fingerprintable.

I think it's important to test with the certs, to make sure it's set up properly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems totally reasonable, and well worth a comment in the source :-)



if [[ ! "$SB_PUBLIC_IP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid IP lookup result: $SB_PUBLIC_IP"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log_for_error, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed


log_step "Creating first user"
function check_firewall() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect most firewalls to allow connections from localhost addresses, even if they're blocked from the outside. This will have a lot of false positives - but I guess as a placeholder it's okay.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this may have some false positives. I have no idea how much, but this is definitely an improvement to what we have now.

I've added extra text about the router of cloud provider blocking in case that happens.

Copy link
Contributor

@trevj trevj Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dborkan had the excellent point that he's seen the converse: a firewall that allows connections from localhost but not externally. In that case, this advice is worse than what we have. I think you're right to just always tell the user which ports to open.


readonly PUBLIC_API_URL="https://${SB_PUBLIC_IP}:${SB_API_PORT}/${SB_API_PREFIX}"
readonly LOCAL_API_URL="https://localhost:${SB_API_PORT}/${SB_API_PREFIX}"
run_step "Waiting for Shadowsocks to be healthy" wait_shadowbox
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadowbox to be healthy, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Outline Server


${FIREWALL_STATUS}
To manage your Outline Server, please copy the following text (including curly
brackets) into Step 2 of the Outline Manager interface:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably they've just come from the Outline Manager; I would re-word to something like: "into the Outline Manager".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same screen on the Manager shows both Step 1 and Step 2. I think mentioning Step 2 may feel excessive, but makes it more explicit. The text was suggested by Santi.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to hold this up on worsmithing but FYI "the Outline Manager interface" is redundant - it's just "the Outline Manager".

FIREWALL_STATUS="\
You won’t be able to access it externally, despite your server being correctly
set up, because this host machine has a firewall that is preventing incoming
connections to ports ${SB_API_PORT} and ${ACCESS_KEY_PORT}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think right now you're only checking the Shadowbox port, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'm assuming that both are blocked together.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, okay.

@trevj
Copy link
Contributor

trevj commented Mar 26, 2018

@fortuna Please consider a squash commit, with a list summarising all of the changes (for example, you removed the call to ufw which is obviously a significant change but one I still missed first time around).

@trevj
Copy link
Contributor

trevj commented Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server/advanced install Issues with manual/advanced server installation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants