Skip to content

Allow the controller configure tls-cipher-suites and tls-min-version via command line params - #2083

Merged
fedepaol merged 1 commit into
metallb:mainfrom
klzsysy:tls-security-config
Nov 30, 2023
Merged

fedepaol merged 1 commit into
metallb:mainfrom
klzsysy:tls-security-config

Conversation

@klzsysy

@klzsysy klzsysy commented Sep 14, 2023 •

Copy link
Copy Markdown

This PR changes controller webhook server tls security config

changes:

Before

> kubectl port-forward svc/metallb-webhook-service 1443:443 &
[1] 20151
Forwarding from 127.0.0.1:1443 -> 9443
Forwarding from [::1]:1443 -> 9443
Handling connection for 1443

> nmap --script ssl-enum-ciphers 1443 127.0.0.1
Starting Nmap 7.94 ( https://nmap.org ) at 2023-09-14 14:07 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00068s latency).
Not shown: 996 closed tcp ports (conn-refused)
PORT      STATE SERVICE
1080/tcp  open  socks
1443/tcp  open  ies-lm
| ssl-enum-ciphers:
|   TLSv1.0:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|     compressors:
|       NULL
|     cipher preference: server
|     warnings:
|       64-bit block cipher 3DES vulnerable to SWEET32 attack
|   TLSv1.1:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|     compressors:
|       NULL
|     cipher preference: server
|     warnings:
|       64-bit block cipher 3DES vulnerable to SWEET32 attack
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|     compressors:
|       NULL
|     cipher preference: server
|     warnings:
|       64-bit block cipher 3DES vulnerable to SWEET32 attack
|   TLSv1.3:
|     ciphers:
|       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|     cipher preference: server
|_  least strength: C
9090/tcp  open  zeus-admin
49161/tcp open  unknown

after

    spec:
      containers:
      - args:
        - --port=7472
        - --log-level=info
        - --cert-service-name=metallb-webhook-service
        - --tls-min-version=VersionTLS12
        env:
        - name: METALLB_ML_SECRET_NAME
          value: metallb-memberlist
        - name: METALLB_DEPLOYMENT
          value: metallb-controller
        - name: METALLB_BGP_TYPE
          value: frr
        image: registry.smtx.io/kubesmart-dev/metallb/controller:v0.13.11  # rebuild image

> kubectl port-forward svc/metallb-webhook-service 1443:443 &

> nmap --script ssl-enum-ciphers -p 1443 127.0.0.1
Starting Nmap 7.94 ( https://nmap.org ) at 2023-10-18 16:46 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0053s latency).

PORT     STATE SERVICE
1443/tcp open  ies-lm
| ssl-enum-ciphers:
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A
|       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
|     compressors:
|       NULL
|     cipher preference: client
|   TLSv1.3:
|     ciphers:
|       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|     cipher preference: server
|_  least strength: A

Nmap done: 1 IP address (1 host up) scanned in 3.51 seconds

@fedepaol

Copy link
Copy Markdown
Member

Thanks!
Mind fixing the conflicts?

@fedepaol

Copy link
Copy Markdown
Member

Also, the diff in nmap you showed is with the default values right?

@fedepaol

Copy link
Copy Markdown
Member

@yuvalk mind having a look here?

Comment thread charts/metallb/values.yaml Outdated
@klzsysy

klzsysy commented Oct 5, 2023

Copy link
Copy Markdown
Author

Also, the diff in nmap you showed is with the default values right?

yes, Now updated to the results after using VersionTLS12

@klzsysy
klzsysy force-pushed the tls-security-config branch from 37f33b7 to 7edc962 Compare October 5, 2023 13:44
@fedepaol

fedepaol commented Oct 9, 2023

Copy link
Copy Markdown
Member

Thanks @klzsysy . Couple of other asks:

  • can you squash the commits so they are meaningful and we get a clean commit history?
  • can you apply the same change setting the defaults to the kustomize based deployment here ?

@klzsysy
klzsysy force-pushed the tls-security-config branch from 39c46e2 to 06c48de Compare October 9, 2023 13:35
@klzsysy

klzsysy commented Oct 9, 2023

Copy link
Copy Markdown
Author

Thanks @klzsysy . Couple of other asks:

  • can you squash the commits so they are meaningful and we get a clean commit history?
  • can you apply the same change setting the defaults to the kustomize based deployment here ?

done

@fedepaol

fedepaol commented Oct 9, 2023

Copy link
Copy Markdown
Member

Thanks @klzsysy . Couple of other asks:

  • can you squash the commits so they are meaningful and we get a clean commit history?
  • can you apply the same change setting the defaults to the kustomize based deployment here ?

done

thanks!

@fedepaol
fedepaol enabled auto-merge October 9, 2023 13:44
@fedepaol

fedepaol commented Oct 9, 2023

Copy link
Copy Markdown
Member

need to run inv helmdocs to regenerate the docs for the helm parameters

auto-merge was automatically disabled October 9, 2023 13:52

Head branch was pushed to by a user without write access

@klzsysy
klzsysy force-pushed the tls-security-config branch from 06c48de to 8b39cdf Compare October 9, 2023 13:52
@fedepaol
fedepaol enabled auto-merge October 9, 2023 13:55
@klzsysy

klzsysy commented Oct 9, 2023 •

Copy link
Copy Markdown
Author

need to run inv helmdocs to regenerate the docs for the helm parameters

The version of helm-docs I am using is too new and has been returned to the same version as ci.

inv generatemanifests updated

auto-merge was automatically disabled October 9, 2023 14:11

Head branch was pushed to by a user without write access

@klzsysy
klzsysy force-pushed the tls-security-config branch from 8b39cdf to 5e81bfb Compare October 9, 2023 14:11
@fedepaol
fedepaol enabled auto-merge October 9, 2023 15:46
@yuvalk

yuvalk commented Oct 10, 2023

Copy link
Copy Markdown
Contributor

sorry for late comment here, but just had the time to check this.
re ciphersuites
it's better to follow NIST guidelines
https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29
you must at least remove the cliflag.InsecureTLSCiphers() ones

@klzsysy

klzsysy commented Oct 10, 2023

Copy link
Copy Markdown
Author

OK, it is no problem to delete the default value of ciphersuites and let the users who need it configure it themselves.

auto-merge was automatically disabled October 10, 2023 02:14

Head branch was pushed to by a user without write access

@yuvalk

yuvalk commented Oct 10, 2023

Copy link
Copy Markdown
Contributor

OK, it is no problem to delete the default value of ciphersuites and let the users who need it configure it themselves.

question is, then what happens by default?
can you please update your after section in PR opening comment?

the idea is to have a sane default..
then of course, customer who need something else can configure it

@klzsysy

klzsysy commented Oct 10, 2023

Copy link
Copy Markdown
Author

OK, it is no problem to delete the default value of ciphersuites and let the users who need it configure it themselves.

question is, then what happens by default? can you please update your after section in PR opening comment?

the idea is to have a sane default.. then of course, customer who need something else can configure it

The effect of updating the default value has been updated in PR opening comment,You can see that the time of nmap output log has been updated.

It seems that leaving the default value blank has a good effect.

@yuvalk

yuvalk commented Oct 10, 2023

Copy link
Copy Markdown
Contributor

It seems that leaving the default value blank has a good effect.

then I dont think it's good enough, there are still insecure ciphers in that list

@klzsysy

klzsysy commented Oct 10, 2023 •

Copy link
Copy Markdown
Author

then I dont think it's good enough, there are still insecure ciphers in that list

so just follow the NIST guidelines ?
https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29

# TLS Cipher suites
TLS_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_256_GCM_SHA384

# result
> nmap --script ssl-enum-ciphers -p 1443 127.0.0.1
Starting Nmap 7.94 ( https://nmap.org ) at 2023-10-18 16:46 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0053s latency).

PORT     STATE SERVICE
1443/tcp open  ies-lm
| ssl-enum-ciphers:
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A
|       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
|     compressors:
|       NULL
|     cipher preference: client
|   TLSv1.3:
|     ciphers:
|       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|     cipher preference: server
|_  least strength: A

Nmap done: 1 IP address (1 host up) scanned in 3.51 seconds

@klzsysy

klzsysy commented Oct 18, 2023 •

Copy link
Copy Markdown
Author

@yuvalk
what do you think

@klzsysy

klzsysy commented Oct 24, 2023

Copy link
Copy Markdown
Author

@fedepaol
can you take a look, retested after resolving the conflict

@fedepaol

Copy link
Copy Markdown
Member

looks good, waiting for one last ack from @yuvalk

@yuvalk

yuvalk commented Oct 27, 2023

Copy link
Copy Markdown
Contributor

@yuvalk what do you think

this is great,
thank you!

@fedepaol yeah, you have my ack

@fedepaol
fedepaol added this pull request to the merge queue Oct 27, 2023
@fedepaol

Copy link
Copy Markdown
Member

thanks, sending to merge

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 27, 2023
@fedepaol
fedepaol added this pull request to the merge queue Oct 27, 2023
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 27, 2023
@fedepaol

Copy link
Copy Markdown
Member

@klzsysy mind squashing before I merge?
Thanks!

@klzsysy
klzsysy force-pushed the tls-security-config branch from 28a82b2 to 98bfd4e Compare October 30, 2023 04:14
@klzsysy

klzsysy commented Oct 30, 2023

Copy link
Copy Markdown
Author

@klzsysy mind squashing before I merge? Thanks!

done

@fedepaol
fedepaol enabled auto-merge October 30, 2023 09:31
auto-merge was automatically disabled October 31, 2023 03:03

Head branch was pushed to by a user without write access

@klzsysy
klzsysy force-pushed the tls-security-config branch from 98bfd4e to e73d08c Compare October 31, 2023 03:03
@klzsysy
klzsysy force-pushed the tls-security-config branch from 613a6d4 to a48d171 Compare November 13, 2023 09:32
@fedepaol
fedepaol enabled auto-merge November 17, 2023 09:49
@fedepaol
fedepaol added this pull request to the merge queue Nov 17, 2023
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 17, 2023
@fedepaol

Copy link
Copy Markdown
Member

Sorry I left this behind. I see now that needs rebasing? Mind doing so so I will merge?
Thanks again!

@klzsysy
klzsysy force-pushed the tls-security-config branch from b2b91e9 to 74e8bd1 Compare November 19, 2023 10:42
@klzsysy

klzsysy commented Nov 19, 2023

Copy link
Copy Markdown
Author

Sorry I left this behind. I see now that needs rebasing? Mind doing so so I will merge? Thanks again!

It should be possible to merge now

@klzsysy
klzsysy force-pushed the tls-security-config branch from 74e8bd1 to dc34ed1 Compare November 30, 2023 06:04
@fedepaol
fedepaol enabled auto-merge November 30, 2023 08:30
@fedepaol

Copy link
Copy Markdown
Member

sent to the merge queue

…via command line params

Set the default tls min version to VersionTLS12
Set the default tls cipher suites to mozilla's recommended values

Signed-off-by: Siyi.Yang <siyi.yang@smartx.com>
Co-authored-by: Federico Paolinelli <fpaoline@redhat.com>
@fedepaol
fedepaol force-pushed the tls-security-config branch from dc34ed1 to 8ac05b1 Compare November 30, 2023 13:14
@fedepaol
fedepaol added this pull request to the merge queue Nov 30, 2023
Merged via the queue into metallb:main with commit ebf28d0 Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants