Golang-跳过SSL / x509验证并构建软件包?

I know nothing about the Go language, I'd just like to use this app on Ubuntu 14:

Before doing anything, I had to set the GOPATH environment variable in my ~/.bashrc. Then the README says this program is installed with:

go get -u github.com/mvdan/fdroidcl/cmd/fdroidcl

This passes fine, and an executable is found. In fact, these are the files found in home, where GOPATH is ~/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

Nice, but now when I start the initial command:

$ 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")

This is most likely a failure due to self-signed certificate. A quick fix would be to use http:// instead of https:// (in case of f-droid.org it is currently possible), so I tried changing ~/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,
                },
        },
}

... but the command is actually binary:

$ 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

... which means I'd have to somehow re-build this application from source in order to get those changes in - how would I do that?

Furthermore, there may be other apps with self-signed https certificates that would break, so I'd much rather skip SSL / X509 verification. It seems that, as golang: How to do a https request with bad certificate? points out, that one should do in code:

tr := http.DefaultTransport.(*http.Transport)
tr.TLSClientConfig.InsecureSkipVerify = true

... which again requires hacking/recompiling the source code - but isn't there some sort of a environment variable to help that, like GIT_SSL_NO_VERIFY for git?

douci2022
douci2022 谢谢@沃尔克-非常抱歉浪费您的时间。您认为更适合此问题的是什么?我将立即对其进行标记,以便将其移至另一个论坛。顺便说一句-当然,我必须重新编译,我知道的很多-但是使用什么命令,我要问的是什么?
3 年多之前 回复
doulu4233
doulu4233 这不是关于Go的问题,也不是真正适合SO的问题。当然,您必须在更改源后重新编译。
3 年多之前 回复

1个回答



按照您的方式更新源代码之后(在 $ GOPATH / src </ code>中),您可以尝试使用重新编译 以下命令:</ p>

 去安装github.com/mvdan/fdroidcl/cmd/fdroidcl

</ div>

展开原文

原文

After updating the source as you did (in $GOPATH/src) you can try re-compiling using the following command:

go install github.com/mvdan/fdroidcl/cmd/fdroidcl

duandao2306
duandao2306 go install会进行构建,并将生成的二进制文件放入$ GOPATH / bin中(与go get放置在同一位置)
3 年多之前 回复
dpa89292
dpa89292 谢谢,@JoshLubawy - 我还以为编译命令就是去建立什么的,没想到挺去安装。 你能在这个地方可能安装扩展安装到 - 它是〜/去/斌/; 还是git项目目录中可能存在某种设置文件?
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐