addToTrustStores(certificatePath, options = {}) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            debug('Adding devcert root CA to Linux system-wide trust stores');
            // run(`sudo cp ${ certificatePath } /etc/ssl/certs/devcert.crt`);
            utils_1.run('sudo', ['cp', certificatePath, '/usr/local/share/ca-certificates/devcert.crt']);
            // run(`sudo bash -c "cat ${ certificatePath } >> /etc/ssl/certs/ca-certificates.crt"`);
            utils_1.run('sudo', ['update-ca-certificates']);
            if (this.isFirefoxInstalled()) {
                // Firefox
                debug('Firefox install detected: adding devcert root CA to Firefox-specific trust stores ...');
                if (!command_exists_1.sync('certutil')) {
                    if (options.skipCertutilInstall) {
                        debug('NSS tooling is not already installed, and `skipCertutil` is true, so falling back to manual certificate install for Firefox');
                        shared_1.openCertificateInFirefox(this.FIREFOX_BIN_PATH, certificatePath);
                    }
                    else {
                        debug('NSS tooling is not already installed. Trying to install NSS tooling now with `apt install`');
                        utils_1.run('sudo', ['apt', 'install', 'libnss3-tools']);
                        debug('Installing certificate into Firefox trust stores using NSS tooling');
                        yield shared_1.closeFirefox();
                        yield shared_1.addCertificateToNSSCertDB(this.FIREFOX_NSS_DIR, certificatePath, 'certutil');
                    }
                }
            }
            else {
                debug('Firefox does not appear to be installed, skipping Firefox-specific steps...');
            }
            if (this.isChromeInstalled()) {
                debug('Chrome install detected: adding devcert root CA to Chrome trust store ...');
                if (!command_exists_1.sync('certutil')) {
                    user_interface_1.default.warnChromeOnLinuxWithoutCertutil();
                }
                else {
                    yield shared_1.closeFirefox();
                    yield shared_1.addCertificateToNSSCertDB(this.CHROME_NSS_DIR, certificatePath, 'certutil');
                }
            }
            else {
                debug('Chrome does not appear to be installed, skipping Chrome-specific steps...');
            }
        });
    }
/**
     * Linux is surprisingly difficult. There seems to be multiple system-wide
     * repositories for certs, so we copy ours to each. However, Firefox does it's
     * usual separate trust store. Plus Chrome relies on the NSS tooling (like
     * Firefox), but uses the user's NSS database, unlike Firefox (which uses a
     * separate Mozilla one). And since Chrome doesn't prompt the user with a GUI
     * flow when opening certs, if we can't use certutil to install our certificate
     * into the user's NSS database, we're out of luck.
     */
Linux is surprisingly difficult. There seems to be multiple system-wide
repositories for certs, so we copy ours to each. However, Firefox does it's
usual separate trust store. Plus Chrome relies on the NSS tooling (like
Firefox), but uses the user's NSS database, unlike Firefox (which uses a
separate Mozilla one). And since Chrome doesn't prompt the user with a GUI
flow when opening certs, if we can't use certutil to install our certificate
into the user's NSS database, we're out of luck.
Linux is surprisingly difficult . There seems to be multiple system - wide repositories for certs so we copy ours to each . However Firefox does it ' s usual separate trust store . Plus Chrome relies on the NSS tooling ( like Firefox ) but uses the user ' s NSS database unlike Firefox ( which uses a separate Mozilla one ) . And since Chrome doesn ' t prompt the user with a GUI flow when opening certs if we can ' t use certutil to install our certificate into the user ' s NSS database we ' re out of luck .
addToTrustStores(certificatePath, options = {}) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            debug('Adding devcert root CA to Linux system-wide trust stores');
            utils_1.run('sudo', ['cp', certificatePath, '/usr/local/share/ca-certificates/devcert.crt']);
            utils_1.run('sudo', ['update-ca-certificates']);
            if (this.isFirefoxInstalled()) {
                debug('Firefox install detected: adding devcert root CA to Firefox-specific trust stores ...');
                if (!command_exists_1.sync('certutil')) {
                    if (options.skipCertutilInstall) {
                        debug('NSS tooling is not already installed, and `skipCertutil` is true, so falling back to manual certificate install for Firefox');
                        shared_1.openCertificateInFirefox(this.FIREFOX_BIN_PATH, certificatePath);
                    }
                    else {
                        debug('NSS tooling is not already installed. Trying to install NSS tooling now with `apt install`');
                        utils_1.run('sudo', ['apt', 'install', 'libnss3-tools']);
                        debug('Installing certificate into Firefox trust stores using NSS tooling');
                        yield shared_1.closeFirefox();
                        yield shared_1.addCertificateToNSSCertDB(this.FIREFOX_NSS_DIR, certificatePath, 'certutil');
                    }
                }
            }
            else {
                debug('Firefox does not appear to be installed, skipping Firefox-specific steps...');
            }
            if (this.isChromeInstalled()) {
                debug('Chrome install detected: adding devcert root CA to Chrome trust store ...');
                if (!command_exists_1.sync('certutil')) {
                    user_interface_1.default.warnChromeOnLinuxWithoutCertutil();
                }
                else {
                    yield shared_1.closeFirefox();
                    yield shared_1.addCertificateToNSSCertDB(this.CHROME_NSS_DIR, certificatePath, 'certutil');
                }
            }
            else {
                debug('Chrome does not appear to be installed, skipping Chrome-specific steps...');
            }
        });
    }
addToTrustStores ( certificatePath , options = { } ) { return tslib_1 . __awaiter ( this , void 0 , void 0 , function * ( ) { debug ( 'Adding devcert root CA to Linux system-wide trust stores' ) ; utils_1 . run ( 'sudo' , [ 'cp' , certificatePath , '/usr/local/share/ca-certificates/devcert.crt' ] ) ; utils_1 . run ( 'sudo' , [ 'update-ca-certificates' ] ) ; if ( this . isFirefoxInstalled ( ) ) { debug ( 'Firefox install detected: adding devcert root CA to Firefox-specific trust stores ...' ) ; if ( ! command_exists_1 . sync ( 'certutil' ) ) { if ( options . skipCertutilInstall ) { debug ( 'NSS tooling is not already installed, and `skipCertutil` is true, so falling back to manual certificate install for Firefox' ) ; shared_1 . openCertificateInFirefox ( this . FIREFOX_BIN_PATH , certificatePath ) ; } else { debug ( 'NSS tooling is not already installed. Trying to install NSS tooling now with `apt install`' ) ; utils_1 . run ( 'sudo' , [ 'apt' , 'install' , 'libnss3-tools' ] ) ; debug ( 'Installing certificate into Firefox trust stores using NSS tooling' ) ; yield shared_1 . closeFirefox ( ) ; yield shared_1 . addCertificateToNSSCertDB ( this . FIREFOX_NSS_DIR , certificatePath , 'certutil' ) ; } } } else { debug ( 'Firefox does not appear to be installed, skipping Firefox-specific steps...' ) ; } if ( this . isChromeInstalled ( ) ) { debug ( 'Chrome install detected: adding devcert root CA to Chrome trust store ...' ) ; if ( ! command_exists_1 . sync ( 'certutil' ) ) { user_interface_1 . default . warnChromeOnLinuxWithoutCertutil ( ) ; } else { yield shared_1 . closeFirefox ( ) ; yield shared_1 . addCertificateToNSSCertDB ( this . CHROME_NSS_DIR , certificatePath , 'certutil' ) ; } } else { debug ( 'Chrome does not appear to be installed, skipping Chrome-specific steps...' ) ; } } ) ; }
Linux is surprisingly difficult.
Linux is surprisingly difficult .
// run(`sudo cp ${ certificatePath } /etc/ssl/certs/devcert.crt`); // run(`sudo bash -c "cat ${ certificatePath } >> /etc/ssl/certs/ca-certificates.crt"`); // Firefox