tourze/ca-trust-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tourze/ca-trust-bundle

Composer 安装命令:

composer require tourze/ca-trust-bundle

包简介

Check local CA file security

README 文档

README

English | 中文

Latest Version PHP Version License Build Status Quality Score Code Coverage Total Downloads

A Symfony bundle for inspecting and verifying system root CA certificates to ensure security and trustworthiness.

Table of Contents

Features

  • List and inspect system root CA certificates
  • Filter certificates by keyword, signature algorithm, or expiration status
  • Verify certificate trustworthiness against multiple online services
  • Output in both table and JSON formats
  • Comprehensive certificate details including fingerprint, issuer, and validity dates

Requirements

  • PHP 8.3 or higher
  • OpenSSL extension
  • Symfony 7.3 or higher

Installation

composer require tourze/ca-trust-bundle

Configuration

This bundle works out of the box without additional configuration. The bundle automatically registers its services when installed.

Quick Start

After installation, you can immediately start using the bundle:

# Register the bundle in your bundles.php (auto-configured in most cases)
# Add to config/bundles.php:
# Tourze\CATrustBundle\CATrustBundle::class => ['all' => true],

# List all system certificates
bin/console ca-trust:list-certs

# Search for specific certificates
bin/console ca-trust:list-certs --keyword="DigiCert"

# Verify certificate trustworthiness
bin/console ca-trust:list-certs --verify

Usage

Basic Commands

# List all certificates
bin/console ca-trust:list-certs

# Search certificates by keyword (matches organization, issuer, or domain)
bin/console ca-trust:list-certs --keyword="DigiCert"
bin/console ca-trust:list-certs -k "DigiCert"

# Filter by signature algorithm
bin/console ca-trust:list-certs --signature="SHA256"
bin/console ca-trust:list-certs -s "SHA256"

# Show expired certificates
bin/console ca-trust:list-certs --show-expired

# Output in JSON format
bin/console ca-trust:list-certs --format=json
bin/console ca-trust:list-certs -f json

# Verify certificate trustworthiness
bin/console ca-trust:list-certs --verify
bin/console ca-trust:list-certs -c

# Combine multiple options
bin/console ca-trust:list-certs -k "DigiCert" -s "SHA256" --show-expired -c -f json

Output Format

Table Output

The table output includes the following columns:

  • #: Index number
  • Organization: Certificate organization
  • Issuer: Certificate issuer
  • Domain: Primary domain
  • Signature: Certificate fingerprint
  • Valid From: Certificate validity start date
  • Valid Until: Certificate expiration date
  • Signature Algorithm: Algorithm used for signing

When using the --verify option, additional columns appear:

  • Verification results from each service (Pass/Fail/Unknown)
  • Overall verification status

JSON Output

JSON output provides more detailed information including:

  • Complete fingerprint
  • Full domain list
  • Verification results (when using --verify)
  • Additional certificate metadata

Certificate Verification

When using the --verify option, the system verifies certificate trustworthiness through multiple online services:

Verification Services

  1. crt.sh - Checks if the certificate exists in public Certificate Transparency (CT) logs
  2. Mozilla - Verifies if the certificate is in Mozilla's trusted root certificate list

Verification Results

  • Pass - Certificate is verified and considered trustworthy
  • Fail - Certificate failed verification and may not be trustworthy
  • Unknown - Unable to determine certificate status due to connection issues or API limitations

Advanced Usage

Custom Verification Services

You can extend the bundle by creating custom certificate verification services. Implement the CheckerInterface and register your service:

use Tourze\CATrustBundle\Verification\CheckerInterface;
use Tourze\CATrustBundle\Verification\VerificationStatus;

class CustomChecker implements CheckerInterface 
{
    public function verify(SslCertificate $certificate): VerificationStatus
    {
        // Your verification logic here
        return VerificationStatus::PASSED;
    }
    
    public function getName(): string
    {
        return 'Custom';
    }
}

Integration with Logging

The bundle supports PSR-3 compatible logging for audit trails:

use Tourze\CATrustBundle\Verification\Checker\CrtShChecker;
use Psr\Log\LoggerInterface;

$logger = // your logger instance
$checker = new CrtShChecker($logger);

Performance Considerations

  • Verification requests are made synchronously and may take time
  • Consider caching verification results for frequently checked certificates
  • Network timeouts may affect verification accuracy

Dependencies

This bundle relies on the following key libraries:

  • composer/ca-bundle: For retrieving system CA root certificates
  • spatie/ssl-certificate: For parsing and processing SSL certificates
  • symfony/console: For creating command-line tools
  • symfony/http-client: For interacting with online verification services

Testing

# Run tests
./vendor/bin/phpunit packages/ca-trust-bundle/tests

# Run static analysis
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/ca-trust-bundle

Contributing

Please see CONTRIBUTING.md for details on how to contribute to this project.

License

The MIT License (MIT). Please see License File for more information.

tourze/ca-trust-bundle 适用场景与选型建议

tourze/ca-trust-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tourze/ca-trust-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tourze/ca-trust-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 tourze/ca-trust-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-03