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

Launch Nexus using a self-signed x.509 certificate #1287

Merged
merged 7 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions docs/how-to-run.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ the networking bits are temporary, so a reboot should always clear them.

Both scripts must be run as root, e.g, `pfexec ./tools/create_virtual_hardware.sh`.

=== Make me a certificate!

Nexus's external interface will typically be served using public-facing x.509
certificate. While we are still configuring the mechanism to integrate this real
certificate into the package system, `./tools/create_self_signed_cert.sh` can be
used to generate an equivalent self-signed certificate.

== Deploying Omicron

The control plane repository contains a packaging tool which bundles binaries
Expand Down
3 changes: 3 additions & 0 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ to = "/var/svc/manifest/site/nexus"
[[package.omicron-nexus.paths]]
from = "out/console-assets"
to = "/var/nexus/static"
[[package.omicron-nexus.paths]]
from = "out/certs"
to = "/var/nexus/certs"

[package.oximeter-collector]
rust.binary_names = ["oximeter"]
Expand Down
7 changes: 6 additions & 1 deletion sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ impl ServiceManager {
dropshot_external: ConfigDropshot {
bind_address: SocketAddr::V6(external_address),
request_body_max_bytes: 1048576,
..Default::default()
tls: Some(
dropshot::ConfigTls {
cert_file: PathBuf::from("/var/nexus/certs/cert.pem"),
key_file: PathBuf::from("/var/nexus/certs/key.pem"),
}
),
},
dropshot_internal: ConfigDropshot {
bind_address: SocketAddr::V6(internal_address),
Expand Down
33 changes: 33 additions & 0 deletions tools/create_self_signed_cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -eu

# Creates a self-signed certificate.
#
# For those with access, certificates are available in:
#
# https://github.com/oxidecomputer/configs/tree/master/nginx/ssl/wildcard.oxide-preview.com
Copy link
Contributor

Choose a reason for hiding this comment

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

This location is will change eventually as a some things get decoupled. Not to block this PR, but for future reference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the heads up. The flow for importing a non-self-signed cert is clearly half-baked; I needed to pull them manually.

Until we have a good authentication story for it, the manual approach seems better than something insecure, but I'd like to remedy that when we can.


set -eu

SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ARG0="$(basename ${BASH_SOURCE[0]})"

# Set the CWD to Omicron's source.
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "${SOURCE_DIR}/.."

OUTPUT_DIR="out/certs"
CERT_PATH="$OUTPUT_DIR/cert.pem"
KEY_PATH="$OUTPUT_DIR/key.pem"

mkdir -p "$OUTPUT_DIR"

openssl req -newkey rsa:4096 \
-x509 \
-sha256 \
-days 3650 \
-nodes \
-out "$CERT_PATH" \
-keyout "$KEY_PATH" \
-subj '/CN=localhost'