Usando Certificados de Sistema Compartilhados

NITISH SHARMA, Mirek Jahoda, Petr Bokoc Version F31 and newer Last review: 2020

O armazenamento de Certificados do Sistema Compartilhado permite que o NSS, o GnuTLS, o OpenSSL e o Java compartilhem uma fonte padrão para recuperar âncoras de certificados do sistema e informações de lista negra. Por padrão, o repositório de confiança contém a lista de CA da Mozilla, incluindo confiança positiva e negativa. O sistema permite a atualização da lista principal de CA da Mozilla ou a escolha de outra lista de certificados.

Using the System-wide Trust Store

In Fedora, the consolidated system-wide trust store is located in the /etc/pki/ca-trust/ and /usr/share/pki/ca-trust-source/ directories. The trust settings in /usr/share/pki/ca-trust-source/ are processed with lower priority than settings in /etc/pki/ca-trust/.

Certificate files are treated depending on the subdirectory they are installed to the following directories:

  • for trust anchors

    • /usr/share/pki/ca-trust-source/anchors/ or

    • /etc/pki/ca-trust/source/anchors/

  • for distrusted certificates

    • /usr/share/pki/ca-trust-source/blocklist/ or

    • /etc/pki/ca-trust/source/blocklist/

  • for certificates in the extended BEGIN TRUSTED file format

    • /usr/share/pki/ca-trust-source/ or

    • /etc/pki/ca-trust/source/

In a hierarchical cryptographic system, a trust anchor is an authoritative entity which is assumed to be trustworthy. For example, in X.509 architecture, a root certificate is a trust anchor from which a chain of trust is derived. The trust anchor must be put in the possession of the trusting party beforehand to make path validation possible.

Adding New Certificates

Often, system administrators want to install a certificate into the trust store. This can be done with the trust anchor sub-command of the trust command, as described in Managing Trusted System Certificates.

Alternatively, you can simply copy the certificate file in the PEM or DER file format to the /etc/pki/ca-trust/source/anchors/ directory, followed by running the update-ca-trust command, for example:

$ sudo cp ~/certificate-trust-examples/Cert-trust-test-ca.pem /etc/pki/ca-trust/source/anchors/
$ sudo update-ca-trust

The update-ca-trust command ensures that the certificate bundles in application-specific formats, such as Java keystore, are regenerated.

The certificates installed in the above steps cannot be removed with the trust anchor --remove.

While the Firefox browser is able to use an added certificate without executing update-ca-trust, it is recommended to run update-ca-trust after a CA change. Also note that browsers, such as Firefox, Epiphany, or Chromium, cache files, and you might need to clear the browser’s cache or restart your browser to load the current system certificates configuration.

Managing Trusted System Certificates

To list, extract, add, remove, or change trust anchors, use the trust command. To see the built-in help for this command, enter it without any arguments or with the --help directive:

$ trust
usage: trust command <args>...

Comandos comuns do trust são:
  list             Lista confianças ou certificados
  extract          Extrai certificados ou confiança
  extract-compat   Extrai pacotes de compatibilidade de confiança
  anchor           Adiciona, remove, altera âncoras de confiança
  dump             Despeja objetos de confiança em formato interno

See 'trust <command> --help' for more information

Para listar todas os certificados e todas âncoras de confiança do sistema, use o comando trust list:

$ trust list
pkcs11:id=%d2%87%b4%e3%df%37%27%93%55%f6%56%ea%81%e5%36%cc%8c%1e%3f%bd;type=cert
    type: certificate
    label: ACCVRAIZ1
    trust: anchor
    category: authority

pkcs11:id=%a6%b3%e1%2b%2b%49%b6%d7%73%a1%aa%94%f5%01%e7%73%65%4c%ac%50;type=cert
    tipo: certificado
    rótulo: ACEDICOM Root
    confiança: âncora
    categoria: autoridade
...
[a saída foi truncada]

Para armazenar uma âncora de confiança no repositório de confiança do sistema, utilize o subcomando trust anchor e especifique o caminho para um certificado; por exemplo:

$ sudo trust anchor path.to/certificate.crt

Para remover um certificado, use o caminho/para o certificado ou um ID de um certificado:

$ sudo trust anchor --remove path.to/certificate.crt
$ sudo trust anchor --remove "pkcs11:id=%AA%BB%CC%DD%EE;type=cert"
Mais informações

Todos os subcomandos dos comandos de trust oferecem uma ajuda embutida detalhada, por exemplo:

$ trust list --help
uso: trust list --filter=<o que>

  --filter=<o que>    filtro do que deve-se exportar
                        ca-anchors        âncoras de certificado
                        blacklist         certificados na lista negra
                        trust-policy      âncoras e lista negra (padrão)
                        certificates      todos os certificados
                        pkcs11:object=xx  um URI de PKCS#11
  --purpose=<uso>     limite para certificados usáveis para o propósito
                        server-auth       para servidor de autenticação
                        client-auth       para clientes de autenticação
                        email             para proteção de e-mails
                        code-signing      para autenticar código de assinatura
                        1.2.3.4.5...      um id de objeto arbitrário
  -v, --verbose       mostra a saída de depuração verbosa
  -q, --quiet         suprime a saída do comando

Recursos Adicionais

Para obter mais informações, consulte as seguintes páginas do manual (man pages):

  • update-ca-trust(8)

  • trust(1)