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
904af8fc
Unverified
Commit
904af8fc
authored
May 07, 2020
by
Darren Shepherd
Committed by
GitHub
May 07, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1765 from csschwe/support_tls_min_version
Feature Request #1741: Adding support for tls minimum version
parents
cb4b3476
ca9c9c2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
server.go
pkg/cli/server/server.go
+28
-0
https.go
pkg/cluster/https.go
+3
-1
types.go
pkg/daemons/config/types.go
+2
-0
No files found.
pkg/cli/server/server.go
View file @
904af8fc
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/urfave/cli"
"k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/util/net"
kubeapiserverflag
"k8s.io/component-base/cli/flag"
"k8s.io/kubernetes/pkg/master"
"k8s.io/kubernetes/pkg/master"
_
"github.com/go-sql-driver/mysql"
// ensure we have mysql
_
"github.com/go-sql-driver/mysql"
// ensure we have mysql
...
@@ -183,6 +184,20 @@ func run(app *cli.Context, cfg *cmds.Server) error {
...
@@ -183,6 +184,20 @@ func run(app *cli.Context, cfg *cmds.Server) error {
serverConfig
.
ControlConfig
.
Disables
[
"ccm"
]
=
true
serverConfig
.
ControlConfig
.
Disables
[
"ccm"
]
=
true
}
}
TLSMinVersion
:=
getArgValueFromList
(
"tls-min-version"
,
cfg
.
ExtraAPIArgs
)
serverConfig
.
ControlConfig
.
TLSMinVersion
,
err
=
kubeapiserverflag
.
TLSVersion
(
TLSMinVersion
)
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"Invalid TLS Version %s: %v"
,
TLSMinVersion
,
err
)
}
TLSCipherSuites
:=
[]
string
{
getArgValueFromList
(
"tls-cipher-suites"
,
cfg
.
ExtraAPIArgs
)}
if
len
(
TLSCipherSuites
)
!=
0
&&
TLSCipherSuites
[
0
]
!=
""
{
serverConfig
.
ControlConfig
.
TLSCipherSuites
,
err
=
kubeapiserverflag
.
TLSCipherSuites
(
TLSCipherSuites
)
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"Invalid TLS Cipher Suites %s: %v"
,
TLSCipherSuites
,
err
)
}
}
logrus
.
Info
(
"Starting k3s "
,
app
.
App
.
Version
)
logrus
.
Info
(
"Starting k3s "
,
app
.
App
.
Version
)
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
os
.
Unsetenv
(
"NOTIFY_SOCKET"
)
os
.
Unsetenv
(
"NOTIFY_SOCKET"
)
...
@@ -240,3 +255,16 @@ func knownIPs(ips []string) []string {
...
@@ -240,3 +255,16 @@ func knownIPs(ips []string) []string {
}
}
return
ips
return
ips
}
}
func
getArgValueFromList
(
searchArg
string
,
argList
[]
string
)
string
{
var
value
string
for
_
,
arg
:=
range
argList
{
splitArg
:=
strings
.
SplitN
(
arg
,
"="
,
2
)
if
splitArg
[
0
]
==
searchArg
{
value
=
splitArg
[
1
]
// break if we found our value
break
}
}
return
value
}
pkg/cluster/https.go
View file @
904af8fc
...
@@ -33,7 +33,9 @@ func (c *Cluster) newListener(ctx context.Context) (net.Listener, http.Handler,
...
@@ -33,7 +33,9 @@ func (c *Cluster) newListener(ctx context.Context) (net.Listener, http.Handler,
CN
:
"k3s"
,
CN
:
"k3s"
,
Organization
:
[]
string
{
"k3s"
},
Organization
:
[]
string
{
"k3s"
},
TLSConfig
:
tls
.
Config
{
TLSConfig
:
tls
.
Config
{
ClientAuth
:
tls
.
RequestClientCert
,
ClientAuth
:
tls
.
RequestClientCert
,
MinVersion
:
c
.
config
.
TLSMinVersion
,
CipherSuites
:
c
.
config
.
TLSCipherSuites
,
},
},
SANs
:
append
(
c
.
config
.
SANs
,
"localhost"
,
"kubernetes"
,
"kubernetes.default"
,
"kubernetes.default.svc."
+
c
.
config
.
ClusterDomain
),
SANs
:
append
(
c
.
config
.
SANs
,
"localhost"
,
"kubernetes"
,
"kubernetes.default"
,
"kubernetes.default.svc."
+
c
.
config
.
ClusterDomain
),
})
})
...
...
pkg/daemons/config/types.go
View file @
904af8fc
...
@@ -122,6 +122,8 @@ type Control struct {
...
@@ -122,6 +122,8 @@ type Control struct {
ClusterInit
bool
ClusterInit
bool
ClusterReset
bool
ClusterReset
bool
EncryptSecrets
bool
EncryptSecrets
bool
TLSMinVersion
uint16
TLSCipherSuites
[]
uint16
BindAddress
string
BindAddress
string
SANs
[]
string
SANs
[]
string
...
...
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