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

devcert is using debian specific commands for linux #51

Open
guy-kdm opened this issue Feb 4, 2020 · 1 comment
Open

devcert is using debian specific commands for linux #51

guy-kdm opened this issue Feb 4, 2020 · 1 comment

Comments

@guy-kdm
Copy link

guy-kdm commented Feb 4, 2020

The package update-ca-certificates used here is specific to debian, while most linux distributions use the trust package, which is also included in debian. The relevant flag being trust --extract-compat. We should switch, but a simple replacement of the commands didn't work, so not sure when I'll have time to learn about what's going on, meantime posting here.

@qw-in
Copy link

qw-in commented Dec 28, 2020

This may be a helpful reference for arch and other distros using trust
https://archlinux.org/news/ca-certificates-update/

Edit: Got it working on manjaro using patch-package. Here is the generated patch - this will very likely break it on other distros but is a starting point at least

diff --git a/node_modules/devcert/dist/platforms/linux.js b/node_modules/devcert/dist/platforms/linux.js
index f378686..c1ada00 100644
--- a/node_modules/devcert/dist/platforms/linux.js
+++ b/node_modules/devcert/dist/platforms/linux.js
@@ -14,7 +14,7 @@ class LinuxPlatform {
         this.FIREFOX_NSS_DIR = path_1.default.join(process.env.HOME, '.mozilla/firefox/*');
         this.CHROME_NSS_DIR = path_1.default.join(process.env.HOME, '.pki/nssdb');
         this.FIREFOX_BIN_PATH = '/usr/bin/firefox';
-        this.CHROME_BIN_PATH = '/usr/bin/google-chrome';
+        this.CHROME_BIN_PATH = '/usr/bin/google-chrome-stable';
         this.HOST_FILE_PATH = '/etc/hosts';
     }
     /**
@@ -30,9 +30,9 @@ class LinuxPlatform {
         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']);
+            utils_1.run('sudo', ['cp', certificatePath, '/etc/ca-certificates/trust-source/anchors/devcert.crt']);
             // run(`sudo bash -c "cat ${ certificatePath } >> /etc/ssl/certs/ca-certificates.crt"`);
-            utils_1.run('sudo', ['update-ca-certificates']);
+            utils_1.run('sudo', ['trust', 'extract-compat']);
             if (this.isFirefoxInstalled()) {
                 // Firefox
                 debug('Firefox install detected: adding devcert root CA to Firefox-specific trust stores ...');
@@ -70,11 +70,11 @@ class LinuxPlatform {
     }
     removeFromTrustStores(certificatePath) {
         try {
-            utils_1.run('sudo', ['rm', '/usr/local/share/ca-certificates/devcert.crt']);
-            utils_1.run('sudo', ['update-ca-certificates']);
+            utils_1.run('sudo', ['rm', '/etc/ca-certificates/trust-source/anchors/devcert.crt']);
+            utils_1.run('sudo', ['trust', 'extract-compat']);
         }
         catch (e) {
-            debug(`failed to remove ${certificatePath} from /usr/local/share/ca-certificates, continuing. ${e.toString()}`);
+            debug(`failed to remove ${certificatePath} from /etc/ca-certificates/trust-source/anchors, continuing. ${e.toString()}`);
         }
         if (command_exists_1.sync('certutil')) {
             if (this.isFirefoxInstalled()) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants