我正在使用Blackbox来保护我的存储库中的敏感文件,但突然之间,对我来说莫名其妙,它只是停止了工作。
我正在运行GitLab CI部署脚本,blackbox_postdeploy
失败并显示消息gpg: [don't know] ctb=00
。
我已经发现ctb=00
通常与损坏的钥匙串有关,但是因为我在一个干净的Docker容器上运行它(通过GitLab CI)我不知道如何解决它。
以下是GitLab CI脚本的输出:
$ gpg -v --import <(echo "$GPG_PRIVATE_KEY")
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: pub 4096R/ABC1234 2017-04-28 Bot <bot@redacted.com>
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: using PGP trust model
gpg: key ABC1234: public key "Bot <bot@redacted.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
$ which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
/usr/bin/ssh-agent
$ eval $(ssh-agent -s)
Agent pid 72
$ ssh-add <(echo "$SSH_PRIVATE_KEY")
Identity added: /dev/fd/63 (rsa w/o comment)
$ mkdir -p ~/.ssh
$ [[ -f /.dockerenv ]] && echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
$ git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"
$ ln -s /builds /go/src/gitlab.com
$ cd /go/src/gitlab.com/me/mysystem
$ blackbox_postdeploy
========== Importing keychain: START
gpg: [don't know]: invalid packet (ctb=00)
gpg: key export failed: invalid packet
ERROR: Job failed: exit code 1
我尝试过的事情:
/root/.gnupg
- 文件夹。有人可以帮助我吗?这偶尔会破坏我的存储库,对我的开发过程来说是一个巨大的痛苦。
谢谢。
答案 0 :(得分:1)
确保在安装两者时只使用gpg2。
$ gpg2 -v --import <(echo "$GPG_PRIVATE_KEY")
问题已在blackbox HEAD中修复。拉出最新的黑盒版本,并使用环境变量调用blackbox命令。
$ GPG=gpg2 blackbox_deploy