Skip to content

Commit 6132ece

Browse files
arampriceselzocAlphasite
committed
Manually pass allowed IP addresses for WinRM firewall rules
Co-authored-by: Chris Selzo <[email protected]> Co-authored-by: Nishad Mathur <[email protected]>
1 parent cd355ad commit 6132ece

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

ci/pipelines/stemcells-windows-2019.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,12 +737,11 @@ jobs:
737737
COMMERCIAL_AWS_DEFAULT_REGION: ((AWS_PACKER_REGION))
738738
COMMERCIAL_AWS_ROLE_ARN: ((aws-stemcells_aws_access_key.role_arn))
739739
COMMERCIAL_AWS_SECRET_ACCESS_KEY: ((aws-stemcells_aws_access_key.password))
740-
CONCOURSE_GCP_CREDENTIALS_JSON: ((gcp_credentials_json))
741-
CONCOURSE_GOOGLE_PROJECT_ID: cf-bosh-concourse
742740
GOVCLOUD_AWS_ACCESS_KEY_ID: ((packer_user_gov_aws_access_key.username))
743741
GOVCLOUD_AWS_DEFAULT_REGION: ((AWS_GOVCLOUD_PACKER_REGION))
744742
GOVCLOUD_AWS_SECRET_ACCESS_KEY: ((packer_user_gov_aws_access_key.password))
745743
WINDOWS_STEMCELLS_GCP_CREDENTIALS_JSON: ((cff-bosh-windows-stemcells_bosh-153_gcp_credentials_json))
744+
ALLOWED_IP_ADDRESSES: 35.197.92.68 34.169.1.255 34.82.52.87 34.168.69.249 34.82.182.73
746745
- put: main-version
747746
params:
748747
file: version/number
@@ -1868,6 +1867,7 @@ jobs:
18681867
- put: azure-tested
18691868
params:
18701869
file: bosh-windows-stemcell/light-bosh-stemcell-*-azure-hyperv-((STEMCELL_OS_NAME))-go_agent.tgz
1870+
18711871
- name: wuts-azure
18721872
serial: true
18731873
plan:
@@ -1927,6 +1927,7 @@ jobs:
19271927
params:
19281928
release: azure-lock
19291929
tags: [broadcom]
1930+
19301931
- name: create-gcp
19311932
serial: true
19321933
serial_groups: [gcp-version]

ci/tasks/firewall-rules/configure-windows-firewall-rules.sh

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,11 @@ set -eu -o pipefail
33
set -x
44

55
# We have firewall rules that are necessary when creating Windows stemcells in AWS and GCP.
6-
# This script gets the IPs of our Concourse workers and ensures that they have access on the
6+
# This script ensures that the concourse worker egress IPs have access on the
77
# WinRM port (5985).
8-
9-
set +x
10-
echo "${CONCOURSE_GCP_CREDENTIALS_JSON}" | gcloud auth activate-service-account --key-file - --project "${CONCOURSE_GOOGLE_PROJECT_ID}"
11-
set -x
12-
concourse_worker_external_ips=$( \
13-
gcloud compute instances list \
14-
--project "${CONCOURSE_GOOGLE_PROJECT_ID}" \
15-
--filter="labels.instance_group:worker AND networkInterfaces.network:bosh-ecosystem-concourse" \
16-
--format="value(networkInterfaces[0].accessConfigs[0].natIP)" \
17-
)
18-
19-
if [ -z "${concourse_worker_external_ips}" ]; then
20-
echo "Unable to find Concourse worker IP addresses"
21-
exit 1
22-
fi
23-
248
# Set firewall rules in the GCP project
259
comma_separated_external_ips=""
26-
for external_ip in $concourse_worker_external_ips; do
10+
for external_ip in $ALLOWED_IP_ADDRESSES; do
2711
comma_separated_external_ips="${external_ip}/32,${comma_separated_external_ips}"
2812
done
2913
comma_separated_external_ips="${comma_separated_external_ips%,}"
@@ -35,7 +19,7 @@ gcloud compute firewall-rules update default-allow-winrm --project cff-bosh-wind
3519

3620
# Set firewall rules in the AWS project
3721
aws_ip_ranges=""
38-
for external_ip in $concourse_worker_external_ips; do
22+
for external_ip in $ALLOWED_IP_ADDRESSES; do
3923
aws_ip_ranges="{CidrIp=${external_ip}/32},${aws_ip_ranges}"
4024
done
4125
aws_ip_ranges="${aws_ip_ranges%,}"

ci/tasks/firewall-rules/configure-windows-firewall-rules.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ params:
1212
GOVCLOUD_AWS_ACCESS_KEY_ID:
1313
GOVCLOUD_AWS_DEFAULT_REGION:
1414
GOVCLOUD_AWS_SECRET_ACCESS_KEY:
15-
CONCOURSE_GCP_CREDENTIALS_JSON:
16-
CONCOURSE_GOOGLE_PROJECT_ID:
1715
WINDOWS_STEMCELLS_GCP_CREDENTIALS_JSON:
16+
ALLOWED_IP_ADDRESSES:
1817

1918
run:
2019
path: bosh-windows-stemcell-builder-ci/ci/tasks/firewall-rules/configure-windows-firewall-rules.sh

0 commit comments

Comments
 (0)