Mitigation Strategy: Protect the Root CA Private Key (CAROOT
)
-
Description:
- Identify
CAROOT
: Runmkcert -CAROOT
in your terminal to determine the location of theCAROOT
directory. This directory is created bymkcert
and contains the critical root CA private key and certificate. - Restrict File Permissions: Use your operating system's file permission system (e.g.,
chmod
on Linux/macOS, file properties on Windows) to restrict access to theCAROOT
directory immediately after runningmkcert -install
. Only the user who ranmkcert -install
(and potentially other administrators who need to generate certificates) should have read/write access. Example (Linux/macOS):chmod 700 $(mkcert -CAROOT) # Only the owner has read/write/execute
- Individual
mkcert
Installations (Shared Environments): If using a shared development environment, strongly encourage (or enforce) each developer to run their ownmkcert
installation. Each developer should:- Run
mkcert -install
under their own user account. - Be responsible for protecting their own
CAROOT
directory. This isolates compromises.
- Run
- Root CA Rotation: Periodically create a new root CA using
mkcert
:- Backup (Optional): Securely back up the old
CAROOT
directory if you need to retain old certificates. - Delete: Delete the entire existing
CAROOT
directory. - Reinstall: Run
mkcert -install
to generate a new root CA and install it. - Regenerate: Use the new root CA to regenerate all necessary development certificates.
- Communicate: Inform the team about the new root CA (if using a shared environment). They may need to re-trust the new CA.
- Backup (Optional): Securely back up the old
- Identify
-
Threats Mitigated:
- Threat: Root CA Private Key Compromise.
- Severity: Critical.
- Threat: Unauthorized Certificate Issuance.
- Severity: High.
- Threat: Root CA Private Key Compromise.
-
Impact:
- Root CA Private Key Compromise: Risk reduced from Critical to Low (if all steps are followed).
- Unauthorized Certificate Issuance: Risk reduced from High to Low.
-
Currently Implemented:
- File Permissions: Implemented on the development server using
chmod 700
. - Individual Installations: Not implemented.
- Root CA Rotation: Not implemented.
- File Permissions: Implemented on the development server using
-
Missing Implementation:
- Individual Installations: All developers share the same
mkcert
installation on the development server. - Root CA Rotation: No formal process or schedule for root CA rotation is in place.
- Individual Installations: All developers share the same
Mitigation Strategy: Limit Trust Store Installation
-
Description:
- Understand Installation: Before running
mkcert -install
, be aware of which trust stores (system, browser, specific applications)mkcert
will modify. This behavior can vary slightly depending on the operating system andmkcert
version. - Selective Installation (Recommended): Instead of using
mkcert -install
for all developers, provide instructions for manually trusting the root CA only in the specific browsers or applications where it's absolutely necessary for development. This avoids system-wide trust. The manual trust process is not directly part ofmkcert
, but it's a crucial mitigation related to howmkcert
's output is used. - Uninstall Instructions: Provide clear instructions on how to remove the CA generated by
mkcert
.
- Understand Installation: Before running
-
Threats Mitigated:
- Threat: Widespread Trust of Development CA.
- Severity: High.
- Threat: Unintentional Trust of Malicious Certificates.
- Severity: Medium.
- Threat: Widespread Trust of Development CA.
-
Impact:
- Widespread Trust of Development CA: Risk reduced from High to Medium (or Low, with very limited installation).
- Unintentional Trust of Malicious Certificates: Risk reduced from Medium to Low.
-
Currently Implemented:
- Selective Installation: Partially implemented. Some developers use
mkcert -install
, others manually trust. - Uninstall Instructions: Not implemented.
- Selective Installation: Partially implemented. Some developers use
-
Missing Implementation:
- Selective Installation: Need to standardize on manual trust and provide clear instructions.
- Uninstall Instructions: No documentation exists for uninstalling the root CA.
Mitigation Strategy: Use Distinct Naming with mkcert
-
Description:
- Consistent Prefixing: When generating certificates with
mkcert
, always use a clear and consistent prefix (or other distinguishing characteristic) in the hostname. This makes it visually obvious that the certificate is for development. Examples:mkcert dev-api.example.com mkcert local-myproject.test mkcert john-dev.example.org
- Avoid Production-Like Names: Never use hostnames that resemble your production domains without a clear development-related prefix. For example, avoid using
mkcert api.example.com
ifapi.example.com
is your production API endpoint.
- Consistent Prefixing: When generating certificates with
-
Threats Mitigated:
- Threat: Accidental Deployment of Development Certificates to Production.
- Severity: Medium.
- Threat: Accidental Deployment of Development Certificates to Production.
-
Impact:
- Accidental Deployment of Development Certificates to Production: Risk reduced from Medium to Low (especially when combined with other mitigations like deployment pipeline checks).
-
Currently Implemented:
- Naming Conventions: Partially implemented. Some developers use prefixes, others don't.
-
Missing Implementation:
- Naming Conventions: Need to enforce a consistent naming convention across the team.