Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
5f96fb81
Commit
5f96fb81
authored
Jun 22, 2017
by
Nandor Kracser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CAFile is now optional, in that case the default RootCAs are used
parent
42ede7f6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
httpgetter.go
pkg/getter/httpgetter.go
+1
-1
tls.go
pkg/tlsutil/tls.go
+7
-4
No files found.
pkg/getter/httpgetter.go
View file @
5f96fb81
...
@@ -50,7 +50,7 @@ func (g *httpGetter) Get(href string) (*bytes.Buffer, error) {
...
@@ -50,7 +50,7 @@ func (g *httpGetter) Get(href string) (*bytes.Buffer, error) {
// newHTTPGetter constructs a valid http/https client as Getter
// newHTTPGetter constructs a valid http/https client as Getter
func
newHTTPGetter
(
URL
,
CertFile
,
KeyFile
,
CAFile
string
)
(
Getter
,
error
)
{
func
newHTTPGetter
(
URL
,
CertFile
,
KeyFile
,
CAFile
string
)
(
Getter
,
error
)
{
var
client
httpGetter
var
client
httpGetter
if
CertFile
!=
""
&&
KeyFile
!=
""
&&
CAFile
!=
""
{
if
CertFile
!=
""
&&
KeyFile
!=
""
{
tlsConf
,
err
:=
tlsutil
.
NewClientTLS
(
CertFile
,
KeyFile
,
CAFile
)
tlsConf
,
err
:=
tlsutil
.
NewClientTLS
(
CertFile
,
KeyFile
,
CAFile
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"can't create TLS config for client: %s"
,
err
.
Error
())
return
nil
,
fmt
.
Errorf
(
"can't create TLS config for client: %s"
,
err
.
Error
())
...
...
pkg/tlsutil/tls.go
View file @
5f96fb81
...
@@ -29,14 +29,17 @@ func NewClientTLS(certFile, keyFile, caFile string) (*tls.Config, error) {
...
@@ -29,14 +29,17 @@ func NewClientTLS(certFile, keyFile, caFile string) (*tls.Config, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
config
:=
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
*
cert
},
}
if
caFile
!=
""
{
cp
,
err
:=
CertPoolFromFile
(
caFile
)
cp
,
err
:=
CertPoolFromFile
(
caFile
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
&
tls
.
Config
{
config
.
RootCAs
=
cp
Certificates
:
[]
tls
.
Certificate
{
*
cert
},
}
RootCAs
:
cp
,
return
&
config
,
nil
},
nil
}
}
// CertPoolFromFile returns an x509.CertPool containing the certificates
// CertPoolFromFile returns an x509.CertPool containing the certificates
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment