Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a093ea34
Commit
a093ea34
authored
Sep 16, 2015
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable system cas
parent
e83bf49f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
transport.go
pkg/client/unversioned/transport.go
+19
-8
No files found.
pkg/client/unversioned/transport.go
View file @
a093ea34
...
@@ -171,30 +171,41 @@ func NewClientCertTLSConfig(certData, keyData, caData []byte) (*tls.Config, erro
...
@@ -171,30 +171,41 @@ func NewClientCertTLSConfig(certData, keyData, caData []byte) (*tls.Config, erro
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
certPool
:=
x509
.
NewCertPool
()
certPool
.
AppendCertsFromPEM
(
caData
)
return
&
tls
.
Config
{
return
&
tls
.
Config
{
// Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability)
// Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability)
MinVersion
:
tls
.
VersionTLS10
,
MinVersion
:
tls
.
VersionTLS10
,
Certificates
:
[]
tls
.
Certificate
{
Certificates
:
[]
tls
.
Certificate
{
cert
,
cert
,
},
},
RootCAs
:
certPool
,
RootCAs
:
rootCertPool
(
caData
),
ClientCAs
:
certPool
,
ClientAuth
:
tls
.
RequireAndVerifyClientCert
,
},
nil
},
nil
}
}
func
NewTLSConfig
(
caData
[]
byte
)
(
*
tls
.
Config
,
error
)
{
func
NewTLSConfig
(
caData
[]
byte
)
(
*
tls
.
Config
,
error
)
{
certPool
:=
x509
.
NewCertPool
()
certPool
.
AppendCertsFromPEM
(
caData
)
return
&
tls
.
Config
{
return
&
tls
.
Config
{
// Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability)
// Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability)
MinVersion
:
tls
.
VersionTLS10
,
MinVersion
:
tls
.
VersionTLS10
,
RootCAs
:
certPool
,
RootCAs
:
rootCertPool
(
caData
)
,
},
nil
},
nil
}
}
// rootCertPool returns nil if caData is empty. When passed along, this will mean "use system CAs".
// When caData is not empty, it will be the ONLY information used in the CertPool.
func
rootCertPool
(
caData
[]
byte
)
*
x509
.
CertPool
{
// What we really want is a copy of x509.systemRootsPool, but that isn't exposed. It's difficult to build (see the go
// code for a look at the platform specific insanity), so we'll use the fact that RootCAs == nil gives us the system values
// It doesn't allow trusting either/or, but hopefully that won't be an issue
if
len
(
caData
)
==
0
{
return
nil
}
// if we have caData, use it
certPool
:=
x509
.
NewCertPool
()
certPool
.
AppendCertsFromPEM
(
caData
)
return
certPool
}
func
NewUnsafeTLSConfig
()
*
tls
.
Config
{
func
NewUnsafeTLSConfig
()
*
tls
.
Config
{
return
&
tls
.
Config
{
return
&
tls
.
Config
{
InsecureSkipVerify
:
true
,
InsecureSkipVerify
:
true
,
...
...
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