Skip to content

Commit 8c5e015

Browse files
feat(core): Improve Fortigate sample configuration (#620)
* Adding additional replacements for firewall configuration * Fixing tests for Firewall instances
1 parent fbccc8e commit 8c5e015

File tree

7 files changed

+45
-8
lines changed

7 files changed

+45
-8
lines changed

reference-artifacts/Third-Party/firewall-example-FUTURE.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ edit FG-traffic
167167
set peertype any
168168
set proposal aes256-sha256
169169
set dhgrp 2
170-
set remote-gw ${PublicVpnTunnel2OutsideAddress1}
171-
set psksecret ${PublicPreSharedSecret2-1}
170+
set remote-gw ${PublicVpnTunnelOutsideAddress2}
171+
set psksecret ${PublicPreSharedSecret2}
172172
set dpd-retryinterval 10
173173
next
174174
end
@@ -199,8 +199,8 @@ edit FG-traffic
199199
set mtu 1427
200200
next
201201
edit "tgw-vpn2"
202-
set ip ${PublicCgwTunnel2InsideAddress1} 255.255.255.255
203-
set remote-ip ${PublicVpnTunnel2InsideAddress1} 255.255.255.255
202+
set ip ${PublicCgwTunnelInsideAddress2} 255.255.255.255
203+
set remote-ip ${PublicVpnTunnelInsideAddress2} 255.255.255.255
204204
set explicit-web-proxy enable
205205
set allowaccess ping
206206
set type tunnel
@@ -758,7 +758,7 @@ edit FG-traffic
758758
set route-map-out "rmap-outbound"
759759
set link-down-failover enable
760760
next
761-
edit ${PublicVpnTunnel2InsideAddress1}
761+
edit ${PublicVpnTunnelInsideAddress2}
762762
set capability-default-originate enable
763763
set remote-as ${PublicVpnBgpAsn1}
764764
set route-map-out "rmap-outbound"

src/deployments/cdk/src/apps/phase-1.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { CentralBucketOutput, LogBucketOutput } from '../deployments/defaults/ou
2020
import * as budget from '../deployments/billing/budget';
2121
import * as certificates from '../deployments/certificates';
2222
import * as defaults from '../deployments/defaults';
23-
import * as firewall from '../deployments/firewall/cluster';
23+
import * as firewallCluster from '../deployments/firewall/cluster';
2424
import * as firewallSubscription from '../deployments/firewall/subscription';
2525
import * as reports from '../deployments/reports';
2626
import * as ssm from '../deployments/ssm/session-manager';
@@ -288,7 +288,7 @@ export async function deploy({ acceleratorConfig, accountStacks, accounts, conte
288288
}
289289

290290
// Create the firewall
291-
await firewall.step2({
291+
await firewallCluster.step2({
292292
accountStacks,
293293
config: acceleratorConfig,
294294
outputs,

src/deployments/cdk/src/deployments/firewall/cluster/outputs.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ export const FirewallVpnTunnelOptions = t.interface({
5050
vpnTunnelOutsideAddress1: t.string,
5151
vpnBgpAsn1: t.string,
5252
preSharedSecret1: t.string,
53+
cgwTunnelInsideAddress2: t.string,
54+
cgwTunnelOutsideAddress2: t.string,
55+
cgwBgpAsn2: t.string,
56+
vpnTunnelInsideAddress2: t.string,
57+
vpnTunnelOutsideAddress2: t.string,
58+
vpnBgpAsn2: t.string,
59+
preSharedSecret2: t.string,
5360
});
5461

5562
export type FirewallVpnTunnelOptions = t.TypeOf<typeof FirewallVpnTunnelOptions>;

src/deployments/cdk/src/deployments/firewall/cluster/step-1.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export async function step1(props: FirewallStep1Props) {
3939
continue;
4040
}
4141

42-
// TODO We could create a nested stack here
4342
await createFirewallEips({
4443
scope: accountStack,
4544
vpcConfig,

src/deployments/cdk/src/deployments/firewall/cluster/step-2.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ async function createCustomerGateways(props: {
148148
vpnTunnelOutsideAddress1: options.getAttString('VpnOutsideIpAddress1'),
149149
vpnBgpAsn1: options.getAttString('VpnBgpAsn1'),
150150
preSharedSecret1: options.getAttString('PreSharedKey1'),
151+
cgwTunnelInsideAddress2: options.getAttString('CgwInsideIpAddress2'),
152+
cgwTunnelOutsideAddress2: options.getAttString('CgwOutsideIpAddress2'),
153+
cgwBgpAsn2: options.getAttString('CgwBgpAsn2'),
154+
vpnTunnelInsideAddress2: options.getAttString('VpnInsideIpAddress2'),
155+
vpnTunnelOutsideAddress2: options.getAttString('VpnOutsideIpAddress2'),
156+
vpnBgpAsn2: options.getAttString('VpnBgpAsn2'),
157+
preSharedSecret2: options.getAttString('PreSharedKey2'),
151158
};
152159

153160
// Creating VPN connection route table association and propagation

src/deployments/cdk/test/apps/unsupported-changes.mocks.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,13 @@ export function createPhaseInput(): Omit<PhaseInput, 'accountStacks'> {
734734
vpnTunnelOutsideAddress1: '35.182.31.119',
735735
vpnBgpAsn1: '64512',
736736
preSharedSecret1: 'yTHR4PMEE7GQJr8dnC4JsIgX9eXMpPUt',
737+
cgwTunnelInsideAddress2: '169.254.11.2',
738+
cgwTunnelOutsideAddress2: '3.97.102.213',
739+
cgwBgpAsn2: '65523',
740+
vpnTunnelInsideAddress2: '169.254.11.1',
741+
vpnTunnelOutsideAddress2: '52.60.189.14',
742+
vpnBgpAsn2: '65521',
743+
preSharedSecret2: '2ywd00tL_lEQ4fX9aoGBd41oUkjx6v6y',
737744
},
738745
},
739746
{
@@ -783,6 +790,13 @@ export function createPhaseInput(): Omit<PhaseInput, 'accountStacks'> {
783790
vpnTunnelOutsideAddress1: '35.182.50.24',
784791
vpnBgpAsn1: '64512',
785792
preSharedSecret1: 'T8euLki9G2ERUw0Z2qiFJkG_KFyh5ivW',
793+
cgwTunnelInsideAddress2: '169.254.150.38',
794+
cgwTunnelOutsideAddress2: '52.60.163.124',
795+
cgwBgpAsn2: '65523',
796+
vpnTunnelInsideAddress2: '169.254.150.37',
797+
vpnTunnelOutsideAddress2: '52.60.81.195',
798+
vpnBgpAsn2: '65521',
799+
preSharedSecret2: '.yPhfn75glcBbwNo4ZuMJ8T973F88gLC',
786800
},
787801
},
788802
{

src/lib/cdk-constructs/src/firewall/instance.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export interface FirewallVpnTunnelOptions {
1515
vpnTunnelOutsideAddress1: string;
1616
vpnBgpAsn1: string;
1717
preSharedSecret1: string;
18+
preSharedSecret2: string;
19+
vpnTunnelInsideAddress2: string;
20+
vpnTunnelOutsideAddress2: string;
21+
cgwTunnelInsideAddress2: string;
22+
cgwTunnelOutsideAddress2: string;
1823
}
1924

2025
export interface FirewallConfigurationProps {
@@ -170,6 +175,11 @@ export class FirewallInstance extends cdk.Construct {
170175
this.template.addReplacement(`\${${name}VpnTunnelInsideAddress1}`, vpnTunnelOptions?.vpnTunnelInsideAddress1);
171176
this.template.addReplacement(`\${${name}VpnBgpAsn1}`, vpnTunnelOptions?.vpnBgpAsn1);
172177
this.template.addReplacement(`\${${name}PreSharedSecret1}`, vpnTunnelOptions?.preSharedSecret1);
178+
this.template.addReplacement(`\${${name}CgwTunnelOutsideAddress2}`, vpnTunnelOptions?.cgwTunnelOutsideAddress2);
179+
this.template.addReplacement(`\${${name}CgwTunnelInsideAddress2}`, vpnTunnelOptions?.cgwTunnelInsideAddress2);
180+
this.template.addReplacement(`\${${name}VpnTunnelOutsideAddress2}`, vpnTunnelOptions?.vpnTunnelOutsideAddress2);
181+
this.template.addReplacement(`\${${name}VpnTunnelInsideAddress2}`, vpnTunnelOptions?.vpnTunnelInsideAddress2);
182+
this.template.addReplacement(`\${${name}PreSharedSecret2}`, vpnTunnelOptions?.preSharedSecret2);
173183
}
174184

175185
return networkInterface;

0 commit comments

Comments
 (0)