【发布时间】:2017-06-08 19:43:59
【问题描述】:
我对 Go 语言一无所知,我只想在 Ubuntu 14 上使用这个应用程序:
在做任何事情之前,我必须set the GOPATH environment variable in my ~/.bashrc。然后自述文件说这个程序安装了:
go get -u github.com/mvdan/fdroidcl/cmd/fdroidcl
这一切顺利,并且找到了一个可执行文件。其实这些都是home里面找到的文件,其中GOPATH就是~/go:
$ find ~ -name 'fdroidcl*' 2>/dev/null
/home/myusername/.cache/fdroidcl
/home/myusername/.config/fdroidcl
/home/myusername/go/pkg/gccgo_linux_386/github.com/mvdan/fdroidcl
/home/myusername/go/src/github.com/mvdan/fdroidcl
/home/myusername/go/src/github.com/mvdan/fdroidcl/cmd/fdroidcl
/home/myusername/go/bin/fdroidcl
很好,但是现在当我启动初始命令时:
$ fdroidcl updateDownloading https://f-droid.org/repo/index.jar...
update: could not update index: Get https://f-droid.org/repo/index.jar: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "COMODO RSA Certification Authority")
这很可能是由于自签名证书而导致的失败。一个快速的解决方法是使用http:// 而不是https://(如果是f-droid.org,目前是可能的),所以我尝试更改~/go/src/github.com/mvdan/fdroidcl/cmd/fdroidcl/main.go:
var config = userConfig{
Repos: []repo{
{
ID: "f-droid",
//URL: "https://f-droid.org/repo",
URL: "http://f-droid.org/repo",
Enabled: true,
},
{
ID: "f-droid-archive",
//URL: "https://f-droid.org/archive",
URL: "http://f-droid.org/archive",
Enabled: false,
},
},
}
...但命令实际上是二进制的:
$ file $(which fdroidcl)
~/go/bin/fdroidcl: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=cd1dc87b54f9023983511ef46fda15a4d88dcb2d, not stripped
...这意味着我必须以某种方式从源代码重新构建此应用程序才能获得这些更改 - 我该怎么做?
此外,可能还有其他带有自签名 https 证书的应用程序会损坏,所以我宁愿跳过 SSL / X509 验证。正如golang: How to do a https request with bad certificate? 指出的那样,似乎应该在代码中这样做:
tr := http.DefaultTransport.(*http.Transport)
tr.TLSClientConfig.InsecureSkipVerify = true
...这再次需要破解/重新编译源代码 - 但没有某种环境变量可以帮助解决这个问题,例如GIT_SSL_NO_VERIFY for git?
【问题讨论】:
-
这不是关于 Go 的问题,也不太适合 SO。当然改源码后要重新编译。
-
谢谢@Volker - 非常抱歉浪费了您的时间。你会建议什么更适合这个问题?我会立即对其进行标记,以便将其移至另一个论坛。顺便说一句 - 我当然必须重新编译,我知道的很多 - 但是使用什么命令,我要问的是什么?
标签: ssl go compilation