Skip to content

Commit 061cf13

Browse files
committed
Enable mtls for file_server by default
- inline the content of ops file enable-tls-on-file-server.yml - deprecate this ops file - configure tls.client_ca_cert - update tests and doc
1 parent 9863719 commit 061cf13

File tree

4 files changed

+70
-26
lines changed

4 files changed

+70
-26
lines changed

cf-deployment.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,11 @@ instance_groups:
10541054
bpm:
10551055
enabled: true
10561056
enable_consul_service_registration: false
1057+
https_server_enabled: true
1058+
tls:
1059+
cert: ((file_server_cert.certificate))
1060+
key: ((file_server_cert.private_key))
1061+
client_ca_cert: ((file_server_cert.ca))
10571062
loggregator: *diego_loggregator_client_properties
10581063
- name: routing-api
10591064
release: routing
@@ -2804,6 +2809,17 @@ variables:
28042809
extended_key_usage:
28052810
- server_auth
28062811

2812+
- name: file_server_cert
2813+
type: certificate
2814+
update_mode: converge
2815+
options:
2816+
ca: service_cf_internal_ca
2817+
common_name: file-server.service.cf.internal
2818+
alternative_names:
2819+
- file-server.service.cf.internal
2820+
extended_key_usage:
2821+
- server_auth
2822+
28072823
releases:
28082824
- name: binary-buildpack
28092825
url: https://bosh.io/d/github.com/cloudfoundry/binary-buildpack-release?v=1.1.21

operations/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ This is the README for Ops-files. To learn more about `cf-deployment`, go to the
3939
| [`disable-router-tls-termination.yml`](disable-router-tls-termination.yml) | Eliminates keys related to performing TLS termination within the gorouter job. | Useful for deployments where TLS termination is performed prior to the gorouter - for instance, on AWS, such termination is commonly done at the ELB. This also eliminates the need to specify `((router_ssl.certificate))` and `((router_ssl.private_key))` in the var files. | **NO** |
4040
| [`disable-http2.yml`](disable-http2.yml) | Prevent gorouter from accepting and forwarding HTTP/2 requests. | | **NO** |
4141
| [`disable-dynamic-asgs.yml`](disable-dynamic-asgs.yml) | Disable dynamic updates for security groups. | | **NO** |
42-
| [`disable-tls-tcp-routing-stage-1-unproxied-ports.yml`](disable-tls-tcp-routing-stage-1-unproxied-ports.yml) | Stage 1 deployment for disabling TLS for TCP Routes on. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO ** |
43-
| [`disable-tls-tcp-routing-stage-2-tcp-router-and-route-emitter.yml`](disable-tls-tcp-routing-stage-2-tcp-router-and-route-emitter.yml) | Stage 2 deployment for disabling TLS for TCP Routes on. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO ** |
44-
| [`disable-tls-tcp-routing-isolation-segment-stage-1-unproxied-ports.yml`](disable-tls-tcp-routing-isolation-segment-stage-1-unproxied-ports.yml) | Stage 1 deployment for disabling TLS for TCP Routes on isolation segments. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO ** |
45-
| [`disable-tls-tcp-routing-isolation-segment-stage-2-route-emitter.yml`](disable-tls-tcp-routing-isolation-segment-stage-2-route-emitter.yml) | Stage 2 deployment for disabling TLS for TCP Routes on isolation segments. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO ** |
42+
| [`disable-tls-tcp-routing-stage-1-unproxied-ports.yml`](disable-tls-tcp-routing-stage-1-unproxied-ports.yml) | Stage 1 deployment for disabling TLS for TCP Routes on. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO** |
43+
| [`disable-tls-tcp-routing-stage-2-tcp-router-and-route-emitter.yml`](disable-tls-tcp-routing-stage-2-tcp-router-and-route-emitter.yml) | Stage 2 deployment for disabling TLS for TCP Routes on. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO** |
44+
| [`disable-tls-tcp-routing-isolation-segment-stage-1-unproxied-ports.yml`](disable-tls-tcp-routing-isolation-segment-stage-1-unproxied-ports.yml) | Stage 1 deployment for disabling TLS for TCP Routes on isolation segments. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO** |
45+
| [`disable-tls-tcp-routing-isolation-segment-stage-2-route-emitter.yml`](disable-tls-tcp-routing-isolation-segment-stage-2-route-emitter.yml) | Stage 2 deployment for disabling TLS for TCP Routes on isolation segments. See [configuring TCP routes](https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#tls-tcp-routes) for more info. | | **NO** |
4646
| [`enable-cc-rate-limiting.yml`](enable-cc-rate-limiting.yml) | Enable rate limiting for UAA-authenticated endpoints. | Introduces variables `cc_rate_limiter_general_limit` and `cc_rate_limiter_unauthenticated_limit` | **NO** |
4747
| [`enable-cc-v2-rate-limiting.yml`](enable-cc-rate-limiting.yml) | Enable V2 API rate limiting for UAA-authenticated endpoints. | Introduces variables `cc_v2_rate_limiter_general_limit`, `cc_v2_rate_limiter_admin_limit` and `cc_v2_rate_limiter_reset_interval_in_minutes` | **NO** |
4848
| [`enable-cc-worker-metrics.yml`](enable-cc-worker-metrics.yml) | Enable metrics for cc-workers. | This will setup the metrics endpoint, configure the prom_scraper job and uses mTLS. If you want to use another scraper than prom_scraper you can additionally set `cc.prom_scraper.disabled` to true. | **NO** |
@@ -53,7 +53,7 @@ This is the README for Ops-files. To learn more about `cf-deployment`, go to the
5353
| [`enable-privileged-container-support.yml`](enable-privileged-container-support.yml) | Enables Diego privileged container support. | | **NO** |
5454
| [`enable-service-discovery.yml`](enable-service-discovery.yml) | Enables application service discovery | | **YES** |
5555
| [`enable-smb-volume-service.yml`](enable-smb-volume-service.yml) | Enables volume support and deploys an SMB broker and volume driver | As of cf-deployment v2, you must use the `smbbrokerpush` errand to cf push the smb broker after `bosh deploy` completes. | **NO** |
56-
| [`enable-tls-on-file-server.yml`](enable-tls-on-file-server.yml) | Enables TLS on file-server for assets | Enables downloading lifecycle assets over HTTPS | **NO** |
56+
| [`enable-tls-on-file-server.yml`](enable-tls-on-file-server.yml) | no-op, deprecated/obsolete | file-server mTLS is enabled by default since cf-d v54.10.0. | **NO** |
5757
| [`enable-v2-api.yml`](enable-v2-api.yml) | Enable Cloud Controller API v2 endpoints | | **NO** |
5858
| [`override-app-domains.yml`](override-app-domains.yml) | Switches from using the system domain as a shared app domain; allows the configuration of one or more shared app domains instead. | Adds [new variables](example-vars-files/vars-override-app-domains.yml).<br/> **CAUTION:** Seeding domains with a router group name (including TCP domains) may cause problems deploying. Please use the `cf` CLI to add shared domains with router group names. | **NO** |
5959
| [`rename-network-and-deployment.yml`](rename-network-and-deployment.yml) | Allows a deployer to rename the network and deployment by passing a variables `network_name` and `deployment_name` | **CAUTION:** If you are using this ops file along with another ops file that increases the number of instance groups (e.g. `perm-services.yml`), this ops file will not rename the network for those instance groups. | **YES** |
Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,2 @@
11
---
2-
- type: replace
3-
path: /instance_groups/name=api/jobs/name=file_server/properties/https_server_enabled?
4-
value: true
5-
- type: replace
6-
path: /instance_groups/name=api/jobs/name=file_server/properties/tls?
7-
value:
8-
cert: ((file_server_cert.certificate))
9-
key: ((file_server_cert.private_key))
10-
- type: replace
11-
path: /variables/-
12-
value:
13-
name: file_server_cert
14-
type: certificate
15-
update_mode: converge
16-
options:
17-
ca: service_cf_internal_ca
18-
common_name: file-server.service.cf.internal
19-
alternative_names:
20-
- file-server.service.cf.internal
21-
extended_key_usage:
22-
- server_auth
2+
# deprecated: content was integrated into cf-deployment.yml

units/tests/semantic_test/semantic_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,54 @@ func TestSemantic(t *testing.T) {
287287
t.Errorf("walk error: %v", err)
288288
}
289289
})
290+
291+
t.Run("file-server-mtls-enabled-by-default", func(t *testing.T) {
292+
// Test 1: Verify https_server_enabled is true
293+
httpsEnabled, err := helpers.BoshInterpolate(
294+
operationsSubDirectory,
295+
manifestPath,
296+
"",
297+
"--path", "/instance_groups/name=api/jobs/name=file_server/properties/https_server_enabled",
298+
)
299+
if err != nil {
300+
t.Fatalf("failed to get https_server_enabled: %v", err)
301+
}
302+
303+
if strings.TrimSpace(string(httpsEnabled)) != "true" {
304+
t.Errorf("expected https_server_enabled to be 'true', got '%s'", strings.TrimSpace(string(httpsEnabled)))
305+
}
306+
307+
// Test 2: Verify tls.client_ca_cert is configured
308+
clientCaCert, err := helpers.BoshInterpolate(
309+
operationsSubDirectory,
310+
manifestPath,
311+
"",
312+
"--path", "/instance_groups/name=api/jobs/name=file_server/properties/tls/client_ca_cert",
313+
)
314+
if err != nil {
315+
t.Fatalf("failed to get tls.client_ca_cert: %v", err)
316+
}
317+
318+
expectedCaCert := "((file_server_cert.ca))"
319+
if strings.TrimSpace(string(clientCaCert)) != expectedCaCert {
320+
t.Errorf("expected client_ca_cert to be '%s', got '%s'", expectedCaCert, strings.TrimSpace(string(clientCaCert)))
321+
}
322+
323+
// Test 3: Verify certificate variable exists
324+
certVariable, err := helpers.BoshInterpolate(
325+
operationsSubDirectory,
326+
manifestPath,
327+
"",
328+
"--path", "/variables/name=file_server_cert",
329+
)
330+
if err != nil {
331+
t.Fatalf("failed to get file_server_cert variable: %v", err)
332+
}
333+
334+
if len(certVariable) == 0 {
335+
t.Error("file_server_cert variable not found in manifest")
336+
}
337+
})
290338
}
291339

292340
func TestReleaseVersions(t *testing.T) {

0 commit comments

Comments
 (0)