-
Notifications
You must be signed in to change notification settings - Fork 25
Add docs for client-gw mtls support #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,6 @@ | |
| *.war | ||
| *.nar | ||
| *.ear | ||
| *.zip | ||
| *.tar.gz | ||
| *.rar | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,93 @@ | ||||||||||||||
| # Secure Client-Gateway Communication with Mutual TLS | ||||||||||||||
|
|
||||||||||||||
| Mutual TLS (mTLS) adds client-side certificate authentication to ensure only trusted clients can call an API. In WSO2 Bijira you enable mTLS at the API proxy level by configuring the MTLS Authenticator mediation policy to validate client certificates or an intermediate CA chain during the TLS handshake. | ||||||||||||||
|
|
||||||||||||||
| This guide walks through the end-to-end steps on configuring mTLS for an API proxy to consume the API Proxy. | ||||||||||||||
|
Comment on lines
+3
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improve grammar and clarity. Several issues affect readability:
🔎 Proposed fixes-Mutual TLS (mTLS) adds client-side certificate authentication to ensure only trusted clients can call an API. In WSO2 Bijira you enable mTLS at the API proxy level by configuring the MTLS Authenticator mediation policy to validate client certificates or an intermediate CA chain during the TLS handshake.
+Mutual TLS (mTLS) adds client-side certificate authentication to ensure only trusted clients can call an API. In WSO2 Bijira, you enable mTLS at the API proxy level by configuring the MTLS Authenticator mediation policy to validate client certificates or an intermediate CA chain during the TLS handshake.
-This guide walks through the end-to-end steps on configuring mTLS for an API proxy to consume the API Proxy.
+This guide walks through the end-to-end steps for configuring mTLS for an API proxy.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| ## Prerequisites | ||||||||||||||
|
|
||||||||||||||
| 1. Set up [ Ballerina 2201.5.5](https://ballerina.io/downloads/swan-lake-release-notes/swan-lake-2201.5.5). | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update Ballerina to 2201.12.0 or later. The documentation references Ballerina 2201.5.5, which was released in 2023. Update to Swan Lake Update 12 (2201.12.0), which includes significant compiler, runtime, and library improvements. mTLS is supported across all recent Ballerina versions. 🧰 Tools🪛 markdownlint-cli2 (0.18.1)9-9: Spaces inside link text (MD039, no-space-in-links) 🤖 Prompt for AI Agents |
||||||||||||||
| 2. Open the `~/.ballerina/settings.toml` file and ensure you have configured an access token to Ballerina Central. If you have not configured an access token, follow the steps given below to configure one: | ||||||||||||||
| 1. Generate a token via [https://central.ballerina.io/dashboard?tab=token](https://central.ballerina.io/dashboard?tab=token). | ||||||||||||||
| 2. Download the generated `Settings.toml` file and copy it to your local `~/.ballerina` directory. | ||||||||||||||
|
|
||||||||||||||
| Alternatively, you can set the access token via the `BALLERINA_CENTRAL_ACCESS_TOKEN` environment variable. | ||||||||||||||
|
|
||||||||||||||
| ``` bash | ||||||||||||||
| export BALLERINA_CENTRAL_ACCESS_TOKEN=<access-token> | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ## Configure mTLS Policy | ||||||||||||||
|
|
||||||||||||||
| 1. Mutual SSL will be configured through a mediation. Please download the mediation app from [here](../../assets/files/develop-api-proxy/policy/authenticator-mtls.zip). | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a more descriptive link text. The link text "[here]" is non-descriptive and doesn't convey what the user will download. Update to explicitly indicate the mediation app. 🔎 Proposed fix-1. Mutual SSL will be configured through a mediation. Please download the mediation app from [here](../../assets/files/develop-api-proxy/policy/authenticator-mtls.zip).
+1. Mutual SSL will be configured through a mediation. Please download the [MTLS Authenticator mediation app](../../assets/files/develop-api-proxy/policy/authenticator-mtls.zip).📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.18.1)22-22: Link text should be descriptive (MD059, descriptive-link-text) 🤖 Prompt for AI Agents |
||||||||||||||
| 2. Open the `Ballerina.toml` file in your preferred text editor and modify the `org` parameter to match with your current Bijira organization. | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix grammar: remove "with". The phrase "match with your current" should be "match your current" for proper grammar. 🔎 Proposed fix-2. Open the `Ballerina.toml` file in your preferred text editor and modify the `org` parameter to match with your current Bijira organization.
+2. Open the `Ballerina.toml` file in your preferred text editor and modify the `org` parameter to match your current Bijira organization.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| 3. Build the mediation app and publish it to the Ballerina central using the following command. | ||||||||||||||
|
|
||||||||||||||
| !!!note | ||||||||||||||
| If setting up in dev environment use `export BALLERINA_DEV_CENTRAL=true` before following commands | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| bal pack | ||||||||||||||
| bal push | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ## Generate a Self-signed Certificate | ||||||||||||||
|
|
||||||||||||||
| !!! note | ||||||||||||||
| If you don't have a CA-signed certificate, use the following command to generate a self-signed certificate. | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| openssl req -x509 -newkey rsa:2048 -keyout mykey.pem -out mycert.pem -days 365 -nodes | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| 1. Open the certificate via the preferred text editor and get the content in PEM format. Convert the content in to URL encoding and copy the content to the clipboard for future use. | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add instructions for URL encoding the certificate. The documentation instructs users to "Convert the content in to URL encoding" but doesn't explain how to perform this conversion. This is a critical step that may not be obvious to all users. 🔎 Suggested additionConsider adding specific instructions or a command example for URL encoding, such as: 1. Open the certificate via the preferred text editor and get the content in PEM format. URL-encode the content using one of the following methods:
**Using Python:**
```bash
python3 -c "import urllib.parse; print(urllib.parse.quote(open('mycert.pem').read()))"Using online tools: Copy the encoded content to the clipboard for future use. In |
||||||||||||||
|
|
||||||||||||||
| ## Apply mTLS to API Proxy | ||||||||||||||
|
|
||||||||||||||
| 1. Sign in to the Bijira Console. | ||||||||||||||
| 2. In the Proxy Listing pane, click on the API proxy for which you want to enable MTLS. For instructions on how to create an API proxy component, see Develop an API Proxy: Step 1. | ||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| 3. Go to Develop, Policy page and click "Resource level policies". | ||||||||||||||
|
|
||||||||||||||
| !!! note | ||||||||||||||
| If you don't need OAuth2 to be enabled, remove the "OAuth2" mediation policy. | ||||||||||||||
|
|
||||||||||||||
| 4. Under the policies, select "MTLS Authenticator". | ||||||||||||||
| 5. Paste the URL encoded certificate content you copied to the clipboard in the above section and save. | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use hyphen in compound adjective. Line 55 uses "URL encoded" as a compound adjective before the noun. For proper grammar, use a hyphen: "URL-encoded". 🔎 Proposed fix-5. Paste the URL encoded certificate content you copied to the clipboard in the above section and save.
+5. Paste the URL-encoded certificate content you copied to the clipboard in the above section and save.📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[grammar] ~55-~55: Use a hyphen to join words. (QB_NEW_EN_HYPHEN) 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| !!! note | ||||||||||||||
| If you need to support multiple client certificates, you can use an intermediate CA certificate and add here. Once that is done, all certificates signed by the intermediate certificate will be allowed to access the resource. | ||||||||||||||
|
|
||||||||||||||
|  | ||||||||||||||
|
|
||||||||||||||
| 6. Deploy the API to development and then to the production environment. | ||||||||||||||
|
|
||||||||||||||
| ## Invoke the API Proxy | ||||||||||||||
|
|
||||||||||||||
| !!! note | ||||||||||||||
| If you haven’t removed OAuth2 policy, you will have to subscribe to the API and get access token. | ||||||||||||||
|
|
||||||||||||||
| You can use curl for this. Get the URL for the API from the dev portal and invoke API. | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| curl --request GET \ | ||||||||||||||
| --url <api_proxy_endpoint_url> \ | ||||||||||||||
| --header 'Accept: application/json' \ | ||||||||||||||
| --cert /<path>/mycert.pem \ | ||||||||||||||
| --key /<path>/mykey.pem | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| For a failed scenario, you will get the following error. | ||||||||||||||
|
|
||||||||||||||
| ```json | ||||||||||||||
| { | ||||||||||||||
| "error_message":"Invalid Credentials", | ||||||||||||||
| "code":"900901", | ||||||||||||||
| "error_description":"Make sure you have provided the correct security credentials." | ||||||||||||||
| } | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ## Configure a Custom Domain | ||||||||||||||
|
|
||||||||||||||
| To configure a custom domain for an API Proxy, follow the steps mentioned in [Configure a Custom Domain for Your Organization](../../../administer/settings/configure-a-custom-domain-for-your-organization/). | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if the custom domain configuration file exists
# First, let's see what files exist with "custom-domain" in the name
echo "=== Searching for custom domain configuration files ==="
find . -type f -name "*custom-domain*" 2>/dev/null
echo ""
echo "=== Checking directory structure under en/docs ==="
# Show the structure of en/docs to understand the organization
find en/docs -type d | head -30
echo ""
echo "=== Looking for administer directories ==="
find . -type d -name "administer" 2>/dev/null
echo ""
echo "=== File path resolution check ==="
# From the file location: en/docs/develop-api-proxy/policy/secure-client-gateway-communication-with-mtls.md
# Let's calculate where ../../../ goes
# Starting from: en/docs/develop-api-proxy/policy/
# Up 3 levels would be: en/
# Then: administer/settings/configure-a-custom-domain-for-your-organization/
echo "Resolved path should be: en/administer/settings/configure-a-custom-domain-for-your-organization/"
if [ -d "en/administer/settings/configure-a-custom-domain-for-your-organization" ]; then
echo "Directory EXISTS at calculated location"
ls -la "en/administer/settings/configure-a-custom-domain-for-your-organization/"
else
echo "Directory DOES NOT EXIST at calculated location"
fi
echo ""
echo "=== Checking if docs directory structure has administer section ==="
ls -la en/docs/ 2>/dev/null | head -20Repository: wso2/docs-bijira Length of output: 2845 Correct the relative path in the link. The link path has one too many directory levels. Change 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| Once the above step is completed, contact the Bijira team via [email protected] to enable mTLS for the given custom domain. | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Format email address as a proper markdown link. The email address appears as plain text without markdown formatting. Format it as a mailto link for better readability and compliance with markdown standards. 🔎 Proposed fix-Once the above step is completed, contact the Bijira team via [email protected] to enable mTLS for the given custom domain.
+Once the above step is completed, contact the Bijira team via [[email protected]](mailto:[email protected]) to enable mTLS for the given custom domain.📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.18.1)93-93: Bare URL used (MD034, no-bare-urls) 🤖 Prompt for AI Agents |
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammatical error: "step" should be "steps".
The phrase "Follow the step mentioned" should be "Follow the steps mentioned" since the referenced guide contains multiple configuration steps.
🔎 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents