Linux Mint:如何防止 Slack 将其密钥重新插入 apt-key

Linux Mint:如何防止 Slack 将其密钥重新插入 apt-key

由于apt-key现已弃用,我已将所有包密钥导出并复制到 gpg 文件夹,并/sources.list.d/*通过添加[signed-by=/usr/share/keyrings/<relevent_key_file>.gpg]字段相应地更新了相应的密钥。

然而,每次重新启动后,都会通过将 Slack 的密钥重新添加到 apt-key 并signed-by从其/sources.list.d/slack.list.我知道这一点是因为当我执行时$ sudo apt-get update,我看到以下输出:

宽: https://packagecloud.io/slacktechnologies/slack/debian/dists/jessie/InRelease:密钥存储在旧版 trusted.gpg 密钥环 (/etc/apt/trusted.gpg) 中,有关详细信息,请参阅 apt-key(8) 中的弃用部分。

这迫使我重新做所有的工作。我如何阻止 Slack 或任何负责的进程这样做?

答案1

我自己也遇到过这种情况,确实很烦人。我没有找到完美的解决方案,但我确实找到了解决方法:使slack.list存储库文件(在添加signed-by条目后)不可变:

sudo chattr +i /etc/apt/sources.list.d/slack.list

这里最大的不便是add-apt-repository由于这种不变性而失败并出现错误:

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu/ lunar main'
Description:
Toolchain test builds; see https://wiki.ubuntu.com/ToolChain

More info: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-lunar.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-lunar.list
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 362, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
                  ^^^^^^^^^^^^^^^^^
  File "/usr/bin/add-apt-repository", line 355, in main
    shortcut.add()
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 221, in add
    self.add_source()
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 307, in add_source
    sourceslist.save()
  File "/usr/lib/python3/dist-packages/softwareproperties/extendedsourceslist.py", line 391, in save
    with open(filename, "w") as f:
         ^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 1] Operation not permitted: '/etc/apt/sources.list.d/slack.list'

因此,如果您遇到这样的错误,只需slack.list再次使可变,运行add-apt-repository,然后返回到不可变:

sudo chattr -i /etc/apt/sources.list.d/slack.list
sudo add-apt-repositor <smth>
sudo chattr +i /etc/apt/sources.list.d/slack.list

相关内容