diff --git a/automation/roles/bubble_finalizer/files/copy_certs_to_bubble.sh b/automation/roles/bubble_finalizer/files/copy_certs_to_bubble.sh index 9c1e8ff7..9a085ead 100755 --- a/automation/roles/bubble_finalizer/files/copy_certs_to_bubble.sh +++ b/automation/roles/bubble_finalizer/files/copy_certs_to_bubble.sh @@ -12,7 +12,10 @@ chmod 750 ${MITM_CERTS} || die "Error setting permissions on ${MITM_CERTS}" chmod -R 440 ${MITM_CERTS}/* || die "Error setting permissions on ${MITM_CERTS} files" CERTS_DIR=/home/bubble/cacerts -MITM_BASE_NAME="bubble-ca" + +CERT_BASE="${1:?no cert base provided}" +MITM_BASE_NAME="${CERT_BASE}-ca" + mkdir -p ${CERTS_DIR} || die "Error creating cacerts dir" cp ${MITM_CERTS}/${MITM_BASE_NAME}-cert.pem ${CERTS_DIR} || die "Error copying pem cert" cp ${MITM_CERTS}/${MITM_BASE_NAME}-cert.pem.crt ${CERTS_DIR}/${MITM_BASE_NAME}-cert.crt || die "Error copying crt cert" diff --git a/automation/roles/bubble_finalizer/tasks/main.yml b/automation/roles/bubble_finalizer/tasks/main.yml index 9c97d56b..c220c0cf 100644 --- a/automation/roles/bubble_finalizer/tasks/main.yml +++ b/automation/roles/bubble_finalizer/tasks/main.yml @@ -23,7 +23,7 @@ when: install_type == 'node' - name: Install mitmproxy public certs in bubble dir - shell: /usr/local/bin/copy_certs_to_bubble.sh + shell: /usr/local/bin/copy_certs_to_bubble.sh {{ server_alias }} when: install_type == 'node' - name: Install bubble supervisor conf file diff --git a/bubble-server/src/main/java/bubble/ApiConstants.java b/bubble-server/src/main/java/bubble/ApiConstants.java index 02742261..474d785e 100644 --- a/bubble-server/src/main/java/bubble/ApiConstants.java +++ b/bubble-server/src/main/java/bubble/ApiConstants.java @@ -64,7 +64,6 @@ public class ApiConstants { public static final String HOME_DIR = System.getProperty("user.home"); public static final File CACERTS_DIR = new File(HOME_DIR, "cacerts"); - public static final String MITMPROXY_CA_CERT_BASE = "bubble-ca-cert."; public static final File MITMPROXY_CERT_DIR = new File(HOME_DIR, "mitm_certs"); public static final String META_PROP_BUBBLE_VERSION = "bubble.version"; diff --git a/bubble-server/src/main/java/bubble/resources/account/AuthResource.java b/bubble-server/src/main/java/bubble/resources/account/AuthResource.java index ec109ef8..6d2436fa 100644 --- a/bubble-server/src/main/java/bubble/resources/account/AuthResource.java +++ b/bubble-server/src/main/java/bubble/resources/account/AuthResource.java @@ -452,7 +452,9 @@ public class AuthResource { @QueryParam("type") CertType type) { final Account caller = optionalUserPrincipal(ctx); if (type == null) type = CertType.pem; - final File certFile = new File(CACERTS_DIR, MITMPROXY_CA_CERT_BASE+type.name()); + final BubbleNetwork thisNet = configuration.getThisNetwork(); + if (thisNet == null) return die("getCaCert: thisNetwork was null"); + final File certFile = new File(CACERTS_DIR, thisNet.getNetworkDomain()+"."+type.name()); if (!certFile.exists()) return notFound(type.name()); return send(new FileSendableResource(certFile).setForceDownload(true)); } diff --git a/bubble-server/src/main/java/bubble/server/listener/NodeInitializerListener.java b/bubble-server/src/main/java/bubble/server/listener/NodeInitializerListener.java index fcca3fc7..7c76dbeb 100644 --- a/bubble-server/src/main/java/bubble/server/listener/NodeInitializerListener.java +++ b/bubble-server/src/main/java/bubble/server/listener/NodeInitializerListener.java @@ -12,7 +12,6 @@ import bubble.server.BubbleConfiguration; import bubble.service.boot.SelfNodeService; import bubble.service.cloud.NetworkMonitorService; import lombok.extern.slf4j.Slf4j; -import org.cobbzilla.wizard.dao.AbstractDAO; import org.cobbzilla.wizard.server.RestServer; import org.cobbzilla.wizard.server.RestServerLifecycleListenerBase; @@ -54,11 +53,13 @@ public class NodeInitializerListener extends RestServerLifecycleListenerBase dao instanceof AbstractDAO) - .forEach(dao -> ((AbstractDAO) dao).getSearchView()); - } +// disabled for now, slows down startup time and consumes much memory. +// Most search views will probably not need to be instantiated anyway +// if (!c.testMode()) { +// c.getAllDAOs().stream() +// .filter(dao -> dao instanceof AbstractDAO) +// .forEach(dao -> ((AbstractDAO) dao).getSearchView()); +// } // ensure system configs can be loaded properly final Map configs = c.getPublicSystemConfigs();