在 Linux 中解决 “Unacceptable TLS certificate” 的问题
TLS 证书
当涉及到 SSL/TLS 证书时，你可能会遇到各种问题，有些与浏览器有关，有些则是网站后台的问题。


其中一个错误是 Linux 中的 “Unacceptable TLS certificate”。


不幸的是，对此没有“一劳永逸”的答案。然而，有一些潜在的解决方案，你可以尝试，在此，我打算为你强调这些。


### 你什么时候会遇到这个 TLS 证书问题？


![](/data/attachment/album/202202/20/140607mgu8s8csckylcwly.png)


在我的例子中，我是在通过终端添加 Flathub 仓库时注意到这个问题的，这个步骤可以让你在 [设置 Flatpak](https://itsfoss.com/flatpak-guide/) 时访问大量的 Flatpak 集合。


然而，在安装 Flatpak 应用或通过终端使用来自第三方仓库的 Flatpak 参考文件时，你也可能会遇到这个错误。


一些用户在 Linux 上使用他们组织推荐的 VPN 服务工作时注意到这个问题。


那么，如何解决这个问题呢？为什么这是一个问题？


嗯，从技术上讲，这是两件事中的一个：


* 你的系统不接受该证书（并说它是无效的）。
* 该证书与用户连接的域不匹配。


如果是第二种情况，你得联系网站的管理员，从他们那里解决这个问题。


但是，如果是第一种情况，你有几种方法来处理它。


### 1、在使用 Flatpak 或添加 GNOME 在线账户时修复 “Unacceptable TLS certificate”


如果你试图添加 Flathub 远程或一个新的 Flatpak 应用，并在终端中注意到这个错误，你可以简单地输入：



```
sudo apt install --reinstall ca-certificates

```

这应该会重新安装受信任的 CA 证书，以防止列表中出现某种问题。


![](/data/attachment/album/202202/20/140608z505h0vochcixqqz.png)


在我的例子中，当试图添加 Flathub 仓库时，我遇到了错误，通过在终端输入上述命令解决了这个问题。


所以，我认为任何与 Flatpak 有关的 TLS 证书问题都可以用这个方法解决。


### 2、在使用工作 VPN 时修复 “Unacceptable TLS certificate”


如果你使用你的组织的 VPN 来访问与工作有关的材料，你可能要把证书添加到你的 Linux 发行版中的可信 CA 列表中。


请注意，你需要 VPN 服务或你组织的管理员分享根证书的 .CRT 版本，才能开始使用。


接下来，你需要进入 `/usr/local/share/ca-certificates` 目录。


你可以下面创建一个目录，并使用任何名称来标识你组织的证书。然后，将 .CRT 文件添加到该目录。


例如，它是 `/usr/local/share/ca-certificates/organization/xyz.crt`。


请注意，你需要有 root 权限来添加证书或在 `ca-certificates` 目录下创建目录。


当你添加了必要的证书，你所要做的就是输入以下命令更新证书支持列表：



```
sudo update-ca-certificates

```

而且，每当你试图连接到你公司的 VPN 时，你的系统应将该证书视为有效。


### 总结


不可接受的 TLS 证书并不是一个常见的错误，但你可以在各种使用情况下发现它，比如连接到 GNOME 在线账户。


如果上述两种方法都不能解决这个错误，那么你所连接的域/服务有可能存在配置错误。在这种情况下，你将不得不联系他们来解决这个问题。


你是否遇到过这个错误？你是如何解决的？你是否知道这个问题的其他解决方案（有可能是容易操作的）？请在下面的评论中告诉我你的想法。




---


via: <https://itsfoss.com/unacceptable-tls-certificate-error-linux/>


作者：[Ankush Das](https://itsfoss.com/author/ankush/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
When it comes to SSL/TLS certificates, you may come across a variety of issues, some related to the browser or a problem in a website’s back-end.

One such error is “Unacceptable TLS certificate” in Linux.

Unfortunately, there’s no “one-solves-it-all’ answer to this. However, there are some potential solutions that you can try, and here, I plan to highlight those for you.

## When do you encounter this TLS Certificate issue?

![unacceptable tls certificate](https://itsfoss.com/content/images/wordpress/2022/02/unacceptable-tls-certificate.png)

In my case, I noticed the issue when adding the Flathub repository via the terminal, a step that lets you access the massive collection of Flatpaks when [setting up Flatpak](https://itsfoss.com/flatpak-guide/).

However, you can also expect to encounter this error when installing a Flatpak app or using a Flatpak ref file from a third-party repository via the terminal.

Some users noticed this issue when using their organization’s recommended VPN service for work on Linux.

So, how do you fix it? Why is this a problem?

Well, technically, it’s either of two things:

- Your system does not accept the certificate (and tells that it’s invalid).
- The certificate does not match the domain the user connects to.

If it’s the second, you will have to reach out to the website’s administrator and fix it from their end.

But if it’s the first, you have a couple of ways to deal with it.

## 1. Fix “Unacceptable TLS certificate” when using Flatpak or adding GNOME Online Accounts

If you are trying to add Flathub remote or a new Flatpak application and notice the error in the terminal, you can simply type in:

`sudo apt install --reinstall ca-certificates`


This should re-install the trusted CA certificates, in case there has been an issue with the list in some way.

![tls certificate troubleshoot](https://itsfoss.com/content/images/wordpress/2022/02/tls-certificate-troubleshoot.png)

In my case, when trying to add the Flathub repository, I encountered the error, which was resolved by typing the above command in the terminal.

So, I think that any Flatpak-related issues with TLS certificates can be fixed using this method.

**If you do not use any Ubuntu-based distros**, let me share another experience of mine:

I encountered this error on Manjaro Linux:

![manjaro tls certificate error](https://itsfoss.com/content/images/wordpress/2022/04/manjaro-tls-certificate-error.png)

While you can re-install ca-certificates on Manjaro Linux using the following command:

`sudo pacman -S ca-certificates`


Unfortunately, that may not work in most cases. But, when I enabled “**Automatic Date & Time**” under the Date and Time settings, the error was resolved, and I was able to install the Flatpak required.

![manjaro date time](https://itsfoss.com/content/images/wordpress/2022/04/manjaro-date-time-1.png)

## 2. Fix “Unacceptable TLS certificate” when using Work VPN

If you are using your organization’s VPN to access materials related to work, you might have to add the certificate to the list of trusted CAs in your Linux distro.

Do note that you need the VPN service or your organization’s administrator to share the .CRT version of the root certificate to get started.

Next, you will need to navigate your way to **/usr/local/share/ca-certificates** directory.

You can create a directory under it and use any name to identify your organization’s certificate. And, then add the .CRT file to that directory.

For instance, its usr/local/share/ca-certificates/organization/xyz.crt

Do note that you need root privileges to add certificates or make a directory under the **ca-certificates** directory.

Once you have added the necessary certificate, all you have to do is update the certificate support list by typing in:

`sudo update-ca-certificates`


And, the certificate should be treated valid by your system whenever you try to connect to your company’s VPN.

## Wrapping Up

An unacceptable TLS certificate is not a common error, but you can find it in various use cases, such as connecting to GNOME Online accounts.

If the error cannot be resolved by two of these methods, it is possible that the domain/service you are connecting to has a configuration error. In that case, you will have to contact them to fix the issue.

Have you faced this error anytime? How did you fix it? Are you aware of other solutions to this problem (potentially, something that’s easy to follow)? Let me know your thoughts in the comments below.