首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Heroku丢失了GeoTrust全局CA根证书

Heroku丢失了GeoTrust全局CA根证书
EN

Stack Overflow用户
提问于 2021-02-10 04:11:36
回答 3查看 224关注 0票数 1

Heroku不知何故丢失了GeoTrust全球CA根证书,这是在苹果服务器上使用推送通知所必需的。我找到了证书here,但我不确定如何在我的Heroku应用程序中安装它。我尝试通过应用程序的设置将其添加为SSL证书,但它提示我需要私钥-我从哪里获得根证书?或者我应该在别的地方添加这个?

我应该指定我的应用程序是golang应用程序。

EN

回答 3

Stack Overflow用户

发布于 2021-02-11 21:50:40

我重新定义了sideshow/apns2客户端工厂函数,将GeoTrust CA包含在rootCA中,并且我在Heroku上的应用程序可以访问apple`s服务器。

代码语言:javascript
复制
const (
    GeoTrustCACert = "<path to GeoTrust_Global_CA.pem>"
)

func newCertPool(certPath string) (*x509.CertPool, error) {
    rootCAs, _ := x509.SystemCertPool()
    if rootCAs == nil {
        rootCAs = x509.NewCertPool()
    }

    certs, err := ioutil.ReadFile(certPath)
    if err != nil {
        return nil, errors.New("no certs appended, using system certs only")
    }

    if ok := rootCAs.AppendCertsFromPEM(certs); !ok {
        log.Println("no certs appended, using systems only certs")
    }
    return rootCAs, nil
}

func NewApns2ClientWithGeoTrustCA(certificate tls.Certificate) *apns2.Client {
    rootCas, err := newCertPool(GeoTrustCACert)
    if err != nil {
        return nil
    }
    tlsConfig := &tls.Config{
        RootCAs:      rootCas,
        Certificates: []tls.Certificate{certificate},
    }

    if len(certificate.Certificate) > 0 {
        tlsConfig.BuildNameToCertificate()
    }
    transport := &http2.Transport{
        TLSClientConfig: tlsConfig,
        DialTLS:         apns2.DialTLS,
    }

    return &apns2.Client{
        HTTPClient: &http.Client{
            Transport: transport,
            Timeout:   apns2.HTTPClientTimeout,
        },
        Certificate: certificate,
        Host:        apns2.DefaultHost,
    }

}
票数 1
EN

Stack Overflow用户

发布于 2021-02-10 22:58:14

我们在spring boot应用程序中也遇到了类似的问题,它使用工件“push”的依赖项,groupId "com.eatthepath“,版本为"0.14.2”的APN推送通知,并部署在heroku中。为了解决这个问题,我们遵循了这个链接中的步骤:https://help.heroku.com/447CZS8V/why-is-my-java-app-unable-to-find-a-valid-certification-pathhttps://devcenter.heroku.com/articles/customizing-the-jdk,然后还使用了"CaCertUtil“类和"GeoTrust_Global_CA.pem”文件,并在构建ApnsClientBuilder时添加了".setTrustedServerCertificateChain(CaCertUtil.allCerts());“行。

"CaCertUtil“和"GeoTrust_Global_CA.pem”取自此链接https://github.com/wultra/powerauth-push-server/commit/71abeb5663201fedf64830fa0ebdf4db6c537e4b

票数 0
EN

Stack Overflow用户

发布于 2021-02-10 23:01:53

本周我们遇到了类似的问题,并通过直接在Heroku Dashboard中将证书添加到应用程序变量来解决它。根据文档,您还可以再次手动添加CA。https://devcenter.heroku.com/articles/ssl

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66126387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档