fbett/le_acme2 问题修复 & 功能扩展

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

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

fbett/le_acme2

Composer 安装命令:

composer require fbett/le_acme2

包简介

Letsencrypt PHP ACME v2 client

README 文档

README

Scrutinizer Build Status Scrutinizer Quality Score Latest Stable Version License PHP Version Require

LetsEncrypt client library for ACME v2 written in PHP.

This library is inspired by yourivw/LEClient, completely rewritten and enhanced with some new features:

  • Support for Composer autoload (including separated Namespaces)
  • Automatic renewal process
  • Managed HTTP authentication process
  • Response caching mechanism
  • Prevents blocking while waiting for server results
  • Optional set a preferred chain

The aim of this client is to make an easy-to-use and integrated solution to create a LetsEncrypt-issued SSL/TLS certificate with PHP.

You have the possibility to use the HTTP authentication: You need to be able to redirect specific requests (see below)

You have also the possibility to use DNS authentication: You need to be able to set dynamic DNS configurations.

Wildcard certificates can only be requested by using the dns authentication.

Current version

Tested with LetsEncrypt staging and production servers.

Prerequisites

The minimum required PHP version is 8.2.

This client also depends on cURL and OpenSSL.

Getting Started

Install via composer:

composer require fbett/le_acme2

Also have a look at the LetsEncrypt documentation for more information and documentation on LetsEncrypt and ACME.

Example Integration

  • Create a working directory. Warning: This directory will also include private keys, so i suggest to place this directory somewhere not in the root document path of the web server. Additionally this directory should be protected to be read from other web server users.
mkdir /etc/ssl/le-storage/
chown root:root /etc/ssl/le-storage
chmod 0600 /etc/ssl/le-storage
  • (HTTP authorization only) Create a directory for the acme challenges. It must be reachable by http/https.
mkdir /var/www/acme-challenges
  • (HTTP authorization only) Redirect specific requests to your acme-challenges directory

Example apache virtual host configuration:

<VirtualHost ...>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule \.well-known/acme-challenge/(.*)$ https://your-domain.com/path/to/acme-challenges/$1 [R=302,L]
    </IfModule>
</VirtualHost>
  • (DNS authorization only) Set the DNS configuration

If DNSWriter::write(...) is called, set the DNS configuration like described in:

https://letsencrypt.org/docs/challenge-types/#dns-01-challenge

(By adding the digest as a TXT record for the subdomain '_acme-challenge'.)

  • Use the certificate bundle, if the certificate is issued:
if($order->isCertificateBundleAvailable()) {

    $bundle = $order->getCertificateBundle();
    
    $pathToPrivateKey = $bundle->path . $bundle->private;
    $pathToCertificate = $bundle->path . $bundle->certificate;
    $pathToIntermediate = $bundle->path . $bundle->intermediate;
    
    $order->enableAutoRenewal(); // If the date of expiration is closer than thirty days, the order will automatically start the renewal process.
}

If a certificate is renewed, the path will also change.

My integrated workflow is the following:

  • User enables SSL to a specific domain in my control panel
  • The cronjob of this control panel will detect these changes and tries to create or get an order like in the sample.
  • The cronjob will fetch the information within the certificate bundle, if the certificate bundle is ready (mostly on the second run for challenge type HTTP and on the third run for challenge type DNS)
  • The cronjob will also build the Apache virtual host files and will restart the Apache2 service, if the new config file is different.

Please take a look on the Samples for a full sample workflow.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

fbett/le_acme2 适用场景与选型建议

fbett/le_acme2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.41k 次下载、GitHub Stars 达 33, 最近一次更新时间为 2018 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 fbett/le_acme2 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 33
  • Watchers: 4
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-26