parent
f17e0d761e
commit
ab4776c332
6 changed files with 257 additions and 125 deletions
@ -0,0 +1,53 @@ |
||||
// Copyright (c) 2021 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package tls |
||||
|
||||
import "os/exec" |
||||
|
||||
func addTrustedCert(certPath string) error { |
||||
return exec.Command( // nolint[gosec]
|
||||
"/usr/bin/security", |
||||
"execute-with-privileges", |
||||
"/usr/bin/security", |
||||
"add-trusted-cert", |
||||
"-d", |
||||
"-r", "trustRoot", |
||||
"-p", "ssl", |
||||
"-k", "/Library/Keychains/System.keychain", |
||||
certPath, |
||||
).Run() |
||||
} |
||||
|
||||
func removeTrustedCert(certPath string) error { |
||||
return exec.Command( // nolint[gosec]
|
||||
"/usr/bin/security", |
||||
"execute-with-privileges", |
||||
"/usr/bin/security", |
||||
"remove-trusted-cert", |
||||
"-d", |
||||
certPath, |
||||
).Run() |
||||
} |
||||
|
||||
func (t *TLS) InstallCerts() error { |
||||
return addTrustedCert(t.getTLSCertPath()) |
||||
} |
||||
|
||||
func (t *TLS) UninstallCerts() error { |
||||
return removeTrustedCert(t.getTLSCertPath()) |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
// Copyright (c) 2021 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package tls |
||||
|
||||
func (t *TLS) InstallCerts() error { |
||||
return nil // Linux doesn't have a root cert store.
|
||||
} |
||||
|
||||
func (t *TLS) UninstallCerts() error { |
||||
return nil // Linux doesn't have a root cert store.
|
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
// Copyright (c) 2021 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package tls |
||||
|
||||
func (t *TLS) InstallCerts() error { |
||||
return nil // NOTE(GODT-986): Install certs to root cert store?
|
||||
} |
||||
|
||||
func (t *TLS) UninstallCerts() error { |
||||
return nil // NOTE(GODT-986): Uninstall certs from root cert store?
|
||||
} |
||||
Loading…
Reference in new issue