Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x509: certificate is valid for {private_harbor_host} #149

Open
Wall1e opened this issue Sep 18, 2022 · 4 comments
Open

x509: certificate is valid for {private_harbor_host} #149

Wall1e opened this issue Sep 18, 2022 · 4 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@Wall1e
Copy link

Wall1e commented Sep 18, 2022

how to make InsecureSkipVerify==true

@Wall1e Wall1e added help wanted Extra attention is needed question Further information is requested labels Sep 18, 2022
@zhangguanzhang
Copy link
Contributor

same issue

1 similar comment
@wdt1988520
Copy link

same issue

@wdt1988520
Copy link

func NewRESTClientForHost(u, username, password string, opts *config.Options) (*RESTClient, error) {
if !strings.HasSuffix(u, v2URLSuffix) {
u += v2URLSuffix
}
harborURL, err := url.Parse(u)
if err != nil {
return nil, err
}
//构建客户端时, InsecureSkipVerify==true ,临时使用

authInfo := runtimeclient.BasicAuth(username, password)
	if harborURL.Scheme == "https" {
		var optsTLS runtimeclient.TLSClientOptions
		optsTLS.InsecureSkipVerify = true
		client, err := runtimeclient.TLSClient(optsTLS)
		if err != nil {
			return nil, err
		}
		v2SwaggerClient := v2client.New(runtimeclient.NewWithClient(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}, client), strfmt.Default)
		return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
	} else {
		v2SwaggerClient := v2client.New(runtimeclient.New(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}), strfmt.Default)
		return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
	}

}

@shaxiaozz
Copy link

@wdt1988520 How to use it? Specifically, modify the source file of that version
Looking forward for your response, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants