-
Notifications
You must be signed in to change notification settings - Fork 43
Mission: Istio Security
ID | Short Name |
---|---|
|
|
Group | Owner |
---|---|
Security |
Gytis Trikleris |
This mission showcases Istio security concepts whereby access to services is controlled by the platform rather than independently by constituent applications.
Here we’ll outline how to apply a security policy that allows clients to obtain a greeting from a Greeting Service while forbidding direct access to the underlying implementation. Further, we’ll explore different ways to change this policy on the fly.
In a microservice topology, not all services are intended to be invoked over the public internet. In fact, opening access in this fashion often presents a security hole. It is therefore far more prudent to restrict invocations only to known clients or dependent services.
-
Security
-
Istio
-
Mutual TLS
-
OpenShift cluster running with Istio and authentication.
-
Automatic sidecar injection is enabled.
-
oc
is available and is logged in to the cluster. -
oc
has permissions to create namespaces, service accounts and grant them permissions.
A dual-module application with a web page and a greeting
service in one deployment and a name
service in another deployment.
Name
service returns a configurable name string, by default - "World".
Greeting
service first gets a name from the name
service and then returns a greeting message string - "Hello, ${name}!".
Web page has a mission description and a button with a result field. Buttons trigger a REST call to the greeting
service and displays whatever is returned in the result field.
Before starting the scenarios, deploy the services with FMP or S2I.
This scenario demonstrates a mutual transport level security between the services.
-
Open booster’s web page via Istio ingress route.
-
echo http://$(oc get route istio-ingress -o jsonpath='{.spec.host}{"\n"}' -n istio-system)/
-
-
Click "Invoke" button. You should see "Hello, World!" message in a result box.
-
Modify greeting service’s deployment to not inject Istio sidecar. Do that by setting all
sidecar.istio.io/inject
annotation values tofalse
in the greeting service’s deployment configuration.-
oc edit deploymentconfigs/<greeting deployment name>
-
-
Open booster’s web page via greeting service’s route. We cannot access it via Istio ingress any more, because this service is no longer part of the service mesh.
-
echo http://$(oc get route <greeting route name> -o jsonpath='{.spec.host}{"\n"}' -n $(oc project -q))/
-
-
Greeting service invocation will fail with a reset connection, because the greeting service has to be inside a service mesh in order to access the name service.
-
Cleanup by setting
sidecar.istio.io/inject
values to true-
oc edit deploymentconfigs/<greeting deployment name>
-
This scenario demonstrates access control when using mutual TLS.
-
Open booster’s web page via Istio ingress route.
-
echo http://$(oc get route istio-ingress -o jsonpath='{.spec.host}{"\n"}' -n istio-system)/
-
-
Click "Invoke" button. You should see "Hello, World!" message in a result box.
-
Configure Istio Mixer to block greeting service from accessing name service.
rules/block-greeting-service.yml
configures a denier with a rule to block a request from a greeting to a name service.-
oc apply -f rules/block-greeting-service.yml
-
-
Click 'Invoke' button. You should see an HTTP 403 error, because the greeting service request to the name service has failed.
-
Now configure Istio Mixer to only allow requests to a name service from a greeting service with an
sa-greeting
service account. This rule works in the same way as the previous one, just has a different matcher.-
oc apply -f <(sed -e "s/TARGET_NAMESPACE/$(oc project -q)/g" rules/require-service-account-and-label.yml)
-
-
Click 'Invoke' button. You should see "Hello, World!" message. This requests chain works, because greeting service is deployed with a service account
sa-greeting
. -
Cleanup
-
oc delete -f rules/require-service-account-and-label.yml
-
-
Booster’s web page contains mission description.
-
Mutual TLS acceptance criteria.
-
Greeting service is outside service mesh and name service is inside service mesh.
-
"Invoke" click returns an error.
-
-
Greeting and name services are inside service mesh.
-
"Invoke" click returns "Hello, World!”.
-
-
-
Access control acceptance criteria (label and service account is required to access name service).
-
rule/block-greeting-service.yml
enabled-
"Invoke" click returns an error.
-
-
rule/require-service-account-and-label.yml
enabled-
"Invoke" click returns "Hello, World!".
-
-
To be checked:
-
Can we access some “TLS info” from the web page to verify if a pod is a member ?
-
How we can exclude a pod from TLS and enable it after