Skip to content

IaaS Firewalling ​

Firewall rules (distributed firewall - DFW) are managed directly in the NSX interface. The concept where such rules are applied is described in the Distributed Firewall section.

Accessing IaaS Firewall ​

Each Sub-Provider has two active directory groups, one for read-write access and one for read-only.

Accessing via API ​

To access the NSX API, open the ESC Portal and navigate to:

Administration → Cloud Service Settings → IaaS Services

From there, select your vCD Sub‑Provider.

In the Sub‑Provider view, open the NSX API Certificates tab. Here, you can add the certificates required to access the NSX API for your configured vCD pods.

NSX API Endpoint
https://api.nsx.<pod>.private.cloud.swisscom.ch/api/v1/
To get your pod, open the NSX-T GUI. You will find the url in your browser url field. For the api, you must prepend api. in front of the domain.

Example:
https://api.nsx.sci99.private.cloud.swisscom.ch/api/v1/

Note: To access this service, you need the space level permission NSX API Certificate User on the default space.

To manage the firewall rules over an api, a special access is required. In NSX-T terminology this access is called principal identity. The basics behind is mTLS.

Create a certificate client ​

To get a principal identity, first a certificate is required. This is not provided by Swisscom but has to be created on customer side.

To upload a certificate client, special access in SCO is required. This access is defined per space level. Grant yourself (or your sub-provider admin to you) access in the corresponding space. You need the access "NSX API Certificate User".

On a Unix-like system, where openssl is available create a private key and certificate. The following should create a private key (keep secret) and a certificate (send to Swisscom).

Bash
openssl req -newkey rsa:4096 -sha256 -x509 -days 365 -subj "/CN=aat-101" -extensions usr_cert -nodes -keyout aat-101-nsxt.key -out aat-101-nsxt.pem
# Output
........+.....+.+.....+.......+..+....+.....+....+...+++++++++++++++++++++++++++++++++++++++++++++*..+......+.....+....+..+.......+.....+.+.....+.+.....+.........+.........+...+....+...+.....+++++++++++++++++++++++++++++++++++++++++++++*.+.......+...+..+....+..............+.+......+...........+.......+..................+..............+.+........+.+...........+.......+........+...+....+...+..+..........+..+....+.....+.......+..+............+...+.......+...........+...+......+......+...+.+...+...+........+.......+...+...........+......+.......+...+...+.....+.+.....+...+.............+.........+...+.....+...+.........+..................+++++...+......+...+.....+...+...+.+.....+...+.+.....+.+......+++++++++++++++++++++++++++++++++++++++++++++*.+...+...............+.......+...............+..+++++++++++++++++++++++++++++++++++++++++++++*.+...........................+...........+.+.........+..+...+....+.....+...+.........+.........+.+...+......+.........+..+...............+..........+......+............+...+....................+.........+.........................+...+..+....+.....+.+........+.+.........+...........+....+...........+......+....+..+.............+........................+.....+.......+.................................+...+++++
-----

The certificate is a text file (PEM) and starts with -----BEGIN CERTIFICATE-----.

and on a Windows based machine (without openssl) a private key and a certificate can be created like this:

PowerShell
New-SelfSignedCertificate -Subject "CN=aat-101" `
-CertStoreLocation "cert:\CurrentUser\My" `
-KeyExportPolicy Exportable `
-KeyUsage CertSign,DigitalSignature `
-KeyLength 4096 `
-KeyUsageProperty All `
-KeyAlgorithm 'RSA' `
-HashAlgorithm 'SHA256' `
-Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" `
-NotAfter (Get-Date).AddYears(1)

$certName = "aat-101"
$pemPath = "$env:USERPROFILE\Downloads\$certName"

# Find the certificate in the user's personal store
$cert = Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like "*$certName*"}

if ($cert -eq $null) {
    Write-Host "Certificate not found."
    exit
}

# Export the certificate to PEM format
$certPem = [System.Convert]::ToBase64String($cert.RawData)
$certPem = "-----BEGIN CERTIFICATE-----`r`n" + ($certPem -split '(.{64})' -ne '' -join "`r`n") + "`r`n-----END CERTIFICATE-----"

# Export the private key to PEM format
$keyPem = [System.Convert]::ToBase64String($cert.PrivateKey.ExportPkcs8PrivateKey())
$keyPem = "-----BEGIN CERTIFICATE-----`r`n" + ($keyPem -split '(.{64})' -ne '' -join "`r`n") + "`r`n-----END CERTIFICATE----"

# Save certificate to .pem file
$certPath = "$pemPath.pem"
$certPem | Out-File -FilePath $certPath -Encoding ascii -NoNewline

# Save private key to .key file
$keyPath = "$pemPath.key"
$keyPem | Out-File -FilePath $keyPath -Encoding ascii -NoNewline

Write-Host "Certificate exported to: $certPath"
Write-Host "Private key exported to: $keyPath"

The certificate is a text file (PEM-format - with the above command the file is called aat-101-nsxt.pem) and its content starts with -----BEGIN CERTIFICATE-----.

After you created the certificate and private key, upload the certificate to the portal. The certificates are managed through the sub-provider. Inside the sub-provider, go to NSX API Certificates. Then you add a new NSX API Certificate. Afterwards you should see your certificate deployed and you can immediately start using it.

Usage ​

Here are a couple of examples how to communicate with the NSX-T api from a Unix-like system. The private key and public certificate from the previous step are required.

The complete api is documented by Broadcom.

You can also use the Terraform provider nsxt.

In this example, the user aat-101 on the NSX-T https://api.nsx.sci99.private.cloud.swisscom.ch is used. Your environment depends on your tenant information. Jump to the NSX-T web UI to view the NSX-T instance you are in. Be aware to use the api.nsx.<ENVIRONEMT> and not nsx.<ENVIRONEMT> to communicate with principal identities.

Bash
export NSXT_MANAGER="https://api.nsx.sci99.private.cloud.swisscom.ch"
export CERTIFICATE="aat-101-nsxt"
Bash
# First get your project id over the api
PROJECT="$(curl --silent --key "${CERTIFICATE}.key" --cert "${CERTIFICATE}.pem" --request GET "${NSXT_MANAGER}/policy/api/v1/orgs/default/projects" | jq -r '.results[0].id')"
echo $PROJECT
# Output
0ae3ccdd-9da8-4598-8f20-913a74e9022b
Bash
# Get a list of security policies
curl --silent --key "${CERTIFICATE}.key" --cert "${CERTIFICATE}.pem" --request GET "${NSXT_MANAGER}/policy/api/v1/orgs/default/projects/${PROJECT}/infra/domains/default/security-policies"
Json
# Output
{"results" : [], "result_count" : 0, "sort_by" : "precedence", "sort_ascending" : true}

Accessing via GUI ​

To access the NSX interface, open the ESC Portal and navigate to:

Administration → Cloud Service Settings → IaaS Services

From there, select your vCD Sub‑Provider.

In the Sub‑Provider view, you’ll find a Jump to NSX link on the right side. Click this link to open the NSX interface directly.

View the Provider Rules (Swisscom managed rules) ​

Each sub-provider gets a couple of DFW rules which are relevant for basic functionality. Those rules must stay as is and not be touched.

Add custom firewalling rules ​

Custom firewall rules should be added in the application category. How those are named and ordered depends on the needs. Each section is applied somewhere. To not apply every rule (regardless of the source and destination) to each VM and host system, NSX has a concept of applying DFW sections (a group of rules) to certain objects.

  1. Navigate to the category application

  2. Create a new Rule Section

  3. Disable TCP Strict in the section settings

  4. Apply the section to one or multiple groups

  5. Add sources, destinations and services

Accessing Flow Logs ​

Flow Logs show network traffic sessions at virtual NIC level, including whether traffic was allowed or blocked.

Prerequisites ​

To access Flow Logs, you need one of the following tenant roles: Tenant IaaS Firewall Viewer, Tenant IaaS Firewall Admin, or Tenant Admin.

Open Flow Logs ​

To view Flow Logs in the ESC Portal, open the Security tab and select Flow Logs.

Enter a VM name in the VM Name field to load Flow Logs. Data is fetched automatically.

Click the info icon next to each flow in the list to view details.

Please note

  • By default, Flow Logs from the last 24 hours are shown.
  • Flow Log data is retained for a maximum of 24 hours.
  • Timestamps shown in the details are in UTC (Zulu time).
  • As VM Name fill in the actual VM name, other names like hostname or other naming are not supported in the search.

Filters ​

Above the list, customers can further filter the retrieved data using the following properties.

FilterDescription
Rule IdEnter a rule ID to display only matching Flow Logs.
Start DateSelect a date and time to display Flow Logs generated after that time.
End DateSelect a date and time to display Flow Logs generated before that time.
ProtocolsSelect one or more protocols to display Flow Logs that match your selection.
Source IPEnter a source IP to display Flow Logs that match your input.
Destination IPEnter a destination IP to display Flow Logs that match your input.
Destination Port (Or Range)Enter a port or port range in the format <start_port>-<end_port> (for example, 5000-9000) to display Flow Logs that match your input.
EventSelect the event type (Allowed or Blocked) from the dropdown.