Policy Rule¶
The final step in the security posture is to add a ruleset to the Valtix Gateway. Each ruleset will have a set of policies that defines your security posture. When traffic is inspected, Valtix Gateway will go from top to bottom of the ruleset to identify if traffic matches the policy rule, hence the order of the policy matters. Security profiles can be attached to policy rules for deep packet inspection. Below is a diagram of how each security component is related in a ruleset.
HTTP Forward Proxy¶
Step 1: Create HTTP Proxy Service
- Navigate to Manage -> Security Policies -> Services
- Click Create
- For the Service Type, select Forward Proxy
- Provide a name for the service object (e.g. egress-proxy-http)
- [Optional] Add a description. (e.g. http egress service)
- In the service table, enter the following values:
Parameter | Description |
---|---|
Decryption Profile | Decryption profile to use for encrypted traffic. For HTTP traffic, this can be empty. |
Dst Port | Destination port of the egress traffic. For HTTP, the default port is 80. |
Protocol: | HTTP or HTTPS. Select HTTP |
Step 2: Create HTTP policy rule in ruleset
- Click Manage -> Security Policies -> Rules
- Find the ruleset name that's associated with the Egress Gateway
- Click the rule set name
- There is already a rule here to allow the health check traffic from the load balancer on port 65534 (this port number was specified during the gateway creation)
- Click Create to create a new rule
- A new rule editor opens in the slide over panel on the right
- Add a name to the rule (e.g. any-egress-http)
- In the Type dropdown select Forward Proxy
- In the Service dropdown select egress-proxy-http (or the name provided to the http service created)
- In the Source dropdown select any (We will look in the later sections on how to restrict the Source by defining source address objects with cloud native attributes like VM Tags etc)
- Destination would be hard coded to any as gateway acts as a proxy and Valtix transparently changes the destination to the Gateway
- In the Action select Allow Log. This allows the Gateway to accept the traffic and log the flows that can be checked in the Investigate section of the Valtix Dashboard
- Leave all the profiles to empty, the rules will be enhanced to use these profiles in the later part of the tutorial
- Click Add
- You can create more rules if required. In this section of the tutorial you will not add any more rules
- Click Save to save all the rules and click Yes in the confirmation
- It takes a few seconds to save the policy. Once the rule set is saved, the Gateway instances pull the ruleset from the controller during the regular message exchange process
Step 3: Verify Traffic
Valtix Gateway is now configured to accept traffic on port 80 from any source. Run a sample curl command from the EC2 instance and check the logs
- SSH to the EC2 instance created in the spoke1-vpc. Default user is
centos
. (eg. ssh -i <private_key.pem> centos@<ec2_eip>) curl http://www.google.com
- Note a successful response
- Navigate to to Investigate -> Traffic Summary -> Logs
- Select the Gateway from the top pulldown
- Check that the logs appear in the table.
- If you want to see the flow of the traffic, you can navigate to Investigate -> Flow Analytics -> All Events. You would see 2 flows:
- EC2 instance Valtix Gateway
- Valtix Gateway www.google.com
- Check the FQDN column and verify that it shows www.google.com
- Check the Rule ID column and verify that it show the rule name that was configured (any-egress-http)
- Click on the Session ID to see the logs only for this session. (We will use this Session ID later to check more things)
HTTPS Forward Proxy¶
In the HTTP Proxy section, we setup a HTTP plain text traffic and egressed to http://www.google.com. In this section we will setup a certificate and a decryption profile so that Valtix Gateway can inspect traffic going out on TLS to https://www.google.com
Step 1: Create Certificate
Create/Import a certificate that will be used to sign the certificates from the external hosts and forwards to the clients. This certificate must be installed on all the app/client instances as a trusted root CA to avoid TLS certificate errors. For the tutorial purposes, we will generate a self-signed certificate. We will also ignore the TLS errors on the client machines.
- Navigate to Manage -> Certificates
- Click Create
- Choose Generate (Self-signed) as the Method
- Click Generate
- Provide a Name (e.g egress-self-signed)
- Click Save
Step 2: Create Decryption Profile
- Go to Manage -> Decryption
- Click Create
- Provide a name (e.g egress-tls-profile)
- In the Method dropdown choose Select Existing
- In the certificate dropdown choose the certificate created above (e.g egress-self-signed)
Step 3: Create HTTPS Proxy Service
- Navigate to Manage -> Security Policies -> Services
- Click Create
- For the Service Type, select Forward Proxy
- Provide a name for the service (e.g. egress-proxy-https)
- Add a description (e.g. https egress service)
- In the service table, enter the following values:
- Decryption Profile: Choose the decryption profile created in the previous section (e.g egress-tls-profile)
- Dst Port: 443
- Protocol: HTTPS
- Click Save
Step 4: Create HTTPS policy rule in ruleset
- Click Manage -> Security Policies -> Rules
- Find the ruleset name that's associated with the Egress Gateway
- Click the ruleset name
- There is already a rule here to allow the health check traffic from the load balancer on port 65534 (this port number was specified during the gateway creation) and another HTTP proxy rule that was added in the previous sections
- Click Create to create a new rule
- A new rule editor opens in the slide over panel on the right
- Add a name to the rule (e.g. any-egress-https)
- In the Type dropdown select Forward Proxy
- In the Service dropdown select egress-proxy-https (or the name provided to the http service created)
- In the Source dropdown select any
- Destination would be hard coded to any as gateway acts as a proxy and Valtix transparently changes the destination to the Gateway
- In the Action select Allow Log. This allows the Gateway to accept the traffic and log the flows that can be checked in the Investigate section of the Valtix Dashboard
- Leave all the profiles to empty, the rules will be enhanced to use these profiles in the later part of the tutorial
- Click Add
- Create more rules if required. In this section of the tutorial you will not add any more rules
- Click Save to save all the rules and click Yes in the confirmation
- It takes a few seconds to save the policy. Once the rule set is saved, the Gateway instances pull the ruleset from the controller during the regular message exchange process
Step 5: Verify Traffic
- SSH to the EC2 instance created in the spoke1-vpc
curl https://www.google.com
- Since the certificate is not installed as a trusted root CA on the EC2 instance you will see a certificate error. You can install the certificate that is being used on the Gateway as a trusted CA on the EC2 instance or choose to ignore certifcate verification. For this tutorial, we will choose to ignore the error.
curl -k https://www.google.com
- Note a successful response
- Naviagte to Investigate -> Flow Analytics -> All Events
- Select the Gateway from the top pulldown
- Check that the logs show in the table
- There are two (2) sessions created:
- EC2 instance Valtix Gateway
- Valtix Gateway www.google.com
- Check the FQDN column and verify that it shows www.google.com
- Check the Rule ID column and verify that it show the rule name that was configured (any-egress-http)
- Click on the Session ID to see the logs only for this session. (We will use this Session ID later to check more things)
Step 6:Verify Certificate
- run some other commands to see the certificate and verify that the certificate received from Google is signed by the self-signed certificate. Run the following command
curl https://www.google.com -vk 2>&1 | grep -A 5 -i "server certificate"
- You should see an output that looks similar to the following
* Server certificate:
* subject: CN=www.google.com,OU=NetSec,O=Valtix Inc.,L=SantaClara,ST=California,C=US
* start date: Dec 14 21:09:52 2020 GMT
* expire date: Dec 15 21:09:52 2021 GMT
* common name: www.google.com
* issuer: O=Valtix
- run this command from another machine or your laptop that accesses Google directly without going via Valtix.
curl https://www.google.com -vk 2>&1 | grep -A 5 -i "server certificate"
- You should see output similar to the following:
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=www.google.com
* start date: Nov 10 14:41:09 2020 GMT
* expire date: Feb 2 14:41:08 2021 GMT
* issuer: C=US; O=Google Trust Services; CN=GTS CA 1O1
* SSL certificate verify ok.
Notice the subject and issuer shows Google. 1. You can repeat these steps on other sites and verify certificate with and without Valtix.
Tech Notes
To install the certificate as a trusted CA on the EC2 instance, check this link
Tag-based Policy¶
Valtix Controller discovers all the instances and records of IP addresses, tags and other attributes. This allows us to create policy base on various attributes. This section we'll modify our existing policy to allow traffic for instances with certain tags.
Step 1: Create Address Object
- Go to the AWS console and add the tags to the EC2 instances
- Add a tag to the EC2 instance spoke1-z1-app with key Category and value prod
- Add a tag to the EC2 instance spoke1-z2-app with key Category and value dev
- It might take a minute or 2 for the Valtix Controller to detect the newly added tag
- Navigate to Manage -> Security Policies -> Addresses
- Click Create Address.
- Select Src/Dest.
- Provide a name (e.g vm-tag-dev)
- Select the object type as User Defined Tag
- Select the Cloud Account, region (e.g us-east-1) and VPC (e.g spoke1-vpc)
- Select the Instance Tag as Category and the Instance Tag Value as dev
- Click Save to save the address object
Click the address object and notice the addresses detected for the tag. You can see both the private and public IP addresses of the spoke1-z2-app instance in the details.
Step 2: Associate address object to rule
- Click Manage -> Security Policies -> Rule Sets
- Find the ruleset name that's associated with the Egress Gateway
- Click the rule set name
- We will be changing the source address for https traffic
- Click the table row any-egress-https and click Edit
- In the editor panel, set the Source to vm-tag-dev and click Save to save the rule
- Click Save to save the ruleset
- The rule shows spoke1-z1-apps-subnet as a Source Address in the rules table
Step 3: Validate Traffic
- SSH to the EC2 instance spoke1-z1-app created in the spoke1-vpc
curl https://www.example.com -kv -o /dev/null
- This should fail for a prod instance as policy rule allows only dev tags
- SSH to the EC2 instance spoke1-z2-app created in the spoke1-vpc
curl https://www.example.com -kv -o /dev/null
- You should receive a successful response for this dev instance
Go back to the AWS console and change the Category tag on spoke1-z1-app to dev and wait for a minute or two for the Valtix Controller to detect this change.
Check the details of the address object and verify that the IP address of spoke1-z1-app appears.
Re-run the above commands on this instance and verify it is now successful