Skip to main content
This guide explains the self-signed certificates used for secure communication between Linqra components.
For your convenience, all necessary certificates are pre-generated and available in the Linqra/keys folder. You can use these certificates directly for local development.

Pre-Generated Certificates

The following certificates and keystores are available in the Linqra/keys directory:
All certificates are configured with default password 123456 and are organized into:
  • Core client certificates for general use
  • Gateway certificates for both local and containerized environments
  • Eureka discovery certificates for both local and containerized environments
  • Service-specific certificates for containerized microservices

Certificate Generation

If you need to regenerate the certificates or understand how they were created, follow the instructions below.

Client Certificate

Generate a generic client certificate for your microservices:

Gateway Certificates

Generate certificates for the API Gateway:

Discovery Server Certificates

Generate certificates for the Eureka Discovery Server:

Service-Specific Certificates

For containerized environments, generate certificates for each service:

Truststore Configuration

Gateway Truststore

Import all certificates into the gateway truststore:

Client Truststore

Import all certificates into the client truststore:

Eureka Truststore

Import all certificates into the Eureka truststore:

Python Project Certificate Setup (CounterApp)

For Python projects like CounterApp that require mutual TLS (mTLS) authentication, you need to extract certificates from Java keystores and convert them to PEM format for use with Flask.

Prerequisites

Ensure you have the following files in your CounterApp/keys/ directory:
  • counter-app-keystore-container.jks (Java keystore)
  • client-truststore.jks (Java truststore)

Manual Certificate Extraction Process

If you need to manually extract certificates, follow these steps:

Step 1: Extract Certificate Aliases

Step 2: Extract Certificates from Truststore

Step 3: Convert DER to PEM Format

Step 4: Extract Server Certificate and Key

Step 5: Create CA Bundle

Step 6: Create CA Certificate for Client Signing

Step 7: Create Client Certificate

Step 8: Update CA Bundle

Step 9: Validate CA Bundle

Run Complete Certificate Setup Script

This script automatically handles ALL certificate setup parts:
  • 1: Get certificate aliases dynamically from truststore
  • 2: Extract all certificates from truststore (DER format)
  • 3: Convert DER certificates to PEM format
  • 4: Extract server certificate and private key from Java keystore
  • 5: Extract server private key from Java keystore
  • 6: Create CA bundle with all certificates
  • 7: Clean up temporary files and unnecessary certificates
  • 8: Create CA certificate for signing client certificates
  • 9: Create client certificate signed by the CA
  • 10: Update CA bundle with the CA certificate and cleanup
Final files after script execution:
  • server-cert.pem: Server certificate (for Flask HTTPS)
  • server-key.pem: Server private key (for Flask HTTPS)
  • ca-bundle.pem: Combined CA certificates (for server validation)
  • ca-key.pem: CA private key
  • ca-cert.pem: CA certificate
  • client-key.pem: Client private key
  • client-cert.pem: Client certificate
Note: The script is completely dynamic and will automatically detect and process all certificates in your truststore. All manual steps are now automated!

Part 3: Import Client Certificate for Browser Testing

Step 5a: Import Certificate into macOS Keychain
Alternative: Import via Keychain Access GUI (Recommended)
  1. Open Keychain Access application
  2. Go to File → Import Items…
  3. Select keys/certs/client-cert.pem and keys/certs/client-key.pem files
  4. Enter your macOS password when prompted
  5. Set trust settings to “Always Trust” for testing
Start Flask App with mTLS Enabled This step starts the Flask application with mutual TLS enabled.

Testing mTLS

Test with curl (should succeed):
Test without certificate (should fail):
Test in browser:
  • Open https://127.0.0.1:5001/health in Chrome
  • Chrome will prompt for certificate selection
  • Select the “client-app” certificate
  • Enter your macOS password when prompted

File Structure After Setup

Verification

To verify the contents of any truststore:
Replace <truststore-name> with either gateway-truststore, client-truststore, or eureka-truststore.

Edge Service SSL Configuration

For secure local development of the Edge Service, you’ll need to set up additional SSL certificates. These certificates enable HTTPS access through https://localhost:3000.

Generate Edge Service Certificate

Navigate to the keys directory and generate the required certificate:

Trust the Certificate

Security Best Practices

Never commit private keys or certificates to version control. These files should be generated locally and kept secure.
Add the following to your .gitignore file:
The generated certificates are valid for 365 days. For production environments, always use proper CA-signed certificates.

Certificate Details

The Edge Service certificate is configured with the following properties:
  • Validity: 365 days
  • Key Type: RSA 2048-bit
  • Common Name (CN): localhost
  • Organization Unit (OU): IT
  • Organization (O): Development
  • Location (L): Houston
  • State (ST): Texas
  • Country (C): US

Directory Structure

After generating the Edge Service certificates, your keys directory will include:
Ensure proper file permissions are set on the private key:
  • Linux/macOS: chmod 600 edge-private.key
  • Windows: Restrict access through file properties