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
bae26c20
Commit
bae26c20
authored
Dec 09, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix delegated authn client cert presentation
parent
79a956c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
16 deletions
+32
-16
local-up-discovery.sh
hack/local-up-discovery.sh
+1
-1
config.go
pkg/genericapiserver/config.go
+31
-15
No files found.
hack/local-up-discovery.sh
View file @
bae26c20
...
...
@@ -99,7 +99,7 @@ function start_discovery {
sleep
1
# create the "normal" api services for the core API server
${
kubectl
}
--kubeconfig
=
"
${
CERT_DIR
}
/admin-discovery.kubeconfig"
create
-f
"
${
KUBE_ROOT
}
/cmd/kubernetes-discovery/artifacts/core-apiservices"
--token
=
"foo/system:masters"
${
kubectl
}
--kubeconfig
=
"
${
CERT_DIR
}
/admin-discovery.kubeconfig"
create
-f
"
${
KUBE_ROOT
}
/cmd/kubernetes-discovery/artifacts/core-apiservices"
}
kube::util::test_openssl_installed
...
...
pkg/genericapiserver/config.go
View file @
bae26c20
...
...
@@ -312,9 +312,28 @@ func (c *Config) ApplyAuthenticationOptions(o *options.BuiltInAuthenticationOpti
return
c
,
nil
}
var
err
error
if
o
.
ClientCert
!=
nil
{
c
,
err
=
c
.
applyClientCert
(
o
.
ClientCert
.
ClientCA
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unable to load client CA file: %v"
,
err
)
}
}
if
o
.
RequestHeader
!=
nil
{
c
,
err
=
c
.
applyClientCert
(
o
.
RequestHeader
.
ClientCAFile
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unable to load client CA file: %v"
,
err
)
}
}
c
.
SupportsBasicAuth
=
len
(
o
.
PasswordFile
.
BasicAuthFile
)
>
0
return
c
,
nil
}
func
(
c
*
Config
)
applyClientCert
(
clientCAFile
string
)
(
*
Config
,
error
)
{
if
c
.
SecureServingInfo
!=
nil
{
if
o
.
ClientCert
!=
nil
&&
len
(
o
.
ClientCert
.
ClientCA
)
>
0
{
clientCAs
,
err
:=
certutil
.
CertsFromFile
(
o
.
ClientCert
.
ClientCA
)
if
len
(
clientCAFile
)
>
0
{
clientCAs
,
err
:=
certutil
.
CertsFromFile
(
clientCAFile
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unable to load client CA file: %v"
,
err
)
}
...
...
@@ -325,21 +344,8 @@ func (c *Config) ApplyAuthenticationOptions(o *options.BuiltInAuthenticationOpti
c
.
SecureServingInfo
.
ClientCA
.
AddCert
(
cert
)
}
}
if
o
.
RequestHeader
!=
nil
&&
len
(
o
.
RequestHeader
.
ClientCAFile
)
>
0
{
clientCAs
,
err
:=
certutil
.
CertsFromFile
(
o
.
RequestHeader
.
ClientCAFile
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unable to load requestheader client CA file: %v"
,
err
)
}
if
c
.
SecureServingInfo
.
ClientCA
==
nil
{
c
.
SecureServingInfo
.
ClientCA
=
x509
.
NewCertPool
()
}
for
_
,
cert
:=
range
clientCAs
{
c
.
SecureServingInfo
.
ClientCA
.
AddCert
(
cert
)
}
}
}
c
.
SupportsBasicAuth
=
len
(
o
.
PasswordFile
.
BasicAuthFile
)
>
0
return
c
,
nil
}
...
...
@@ -348,6 +354,16 @@ func (c *Config) ApplyDelegatingAuthenticationOptions(o *options.DelegatingAuthe
return
c
,
nil
}
var
err
error
c
,
err
=
c
.
applyClientCert
(
o
.
ClientCert
.
ClientCA
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unable to load client CA file: %v"
,
err
)
}
c
,
err
=
c
.
applyClientCert
(
o
.
RequestHeader
.
ClientCAFile
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unable to load client CA file: %v"
,
err
)
}
cfg
,
err
:=
o
.
ToAuthenticationConfig
()
if
err
!=
nil
{
return
nil
,
err
...
...
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