OpenSSL engine: leaf certificates get O=Internet Widgits Pty Ltd, ST=Some-State from system openssl.cnf
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc OpenSslHandler::generateCertificate() quanh đoạn tạo CSR leaf tại dòng 182 của OpenSslHandler.php, sau đó kiểm tra generateLeafConfig() và các tùy chọn CSR gốc để so sánh. Tái hiện bằng đoạn mã PHP được cung cấp hoặc tạo chứng chỉ leaf trong image Nextcloud đã nêu. Hoàn tất khi subject của chứng chỉ leaf chỉ chứa các trường do LibreSign thiết lập hoặc kế thừa, không có các giá trị mặc định của hệ thống OpenSSL.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Signer certificates created with the OpenSSL engine contain O=Internet Widgits Pty Ltd and ST=Some-State, although the root certificate has neither field: the leaf CSR is created without a config, so openssl_csr_new fills missing DN fields with the *_default values of the system openssl.cnf.
To reproduce
- Official
nextcloud:35.0.2-apacheimage (Debian 13), certificate engine OpenSSL. - Generate the root certificate with only CN, C and L:
occ libresign:configure:openssl --cn=… --c=DE --l=… - Let a user create their signature certificate and sign a PDF.
pdfsig signed.pdfshows:
Signer full Distinguished Name: O=Internet Widgits Pty Ltd,ST=Some-State,CN=…,UID=account:…,OU=libresign-ca-id:…,L=…,C=DE
while the root subject is onlyC=DE, L=…, OU=libresign-ca-id:…, CN=….
Minimal PHP reproduction inside the container:
$k = openssl_pkey_new(['private_key_bits' => 2048]);
$c = openssl_csr_new(['commonName' => 'x', 'countryName' => 'DE'], $k, ['digest_alg' => 'sha256']);
print_r(openssl_csr_get_subject($c)); // CN, C, ST => Some-State, O => Internet Widgits Pty Ltd
Cause: in OpenSslHandler::generateCertificate() the CSR is created as createCsr($this->getCsrNames(), $privateKey, ['digest_alg' => 'sha256']), without a config option. PHP then falls back to the system openssl.cnf (Debian: stateOrProvinceName_default = Some-State, 0.organizationName_default = Internet Widgits Pty Ltd) and adds those defaults for every DN field not passed. The root CSR passes a config file via getRootCsrOptions() and is not affected.
Expected behavior
The leaf DN contains only the fields LibreSign sets (CN, UID and the fields inherited from the root); passing a config (e.g. the leaf config from generateLeafConfig()) to createCsr would fix it.
Screenshots
No response
Operational System
Docker, official nextcloud:35.0.2-apache image (Debian 13), on Kubernetes
Browser Type and Version
Not browser-related (server-side certificate generation)
Libresign Version
15.0.12 (still present on main, OpenSslHandler.php line 182)
Nextcloud Server Version
35.0.2
Logs from Nextcloud Server
No log entries: certificate generation succeeds, only the subject is wrong.
Logs from Developers tools
No response
Additional context
Workaround: set OPENSSL_CONF for the PHP processes to a file that includes the system config and points [req] distinguished_name to an empty section:
.include /usr/lib/ssl/openssl.cnf
[ req ]
distinguished_name = req_dn_libresign
[ req_dn_libresign ]
With it, the CSR contains only the passed fields; TLS from PHP keeps working. Certificates issued before keep the placeholder until the user recreates their certificate.
- Ngôn ngữ chính
- PHP
- Star
- 844
- Fork
- 176
- Merge trung bình
- 13 giờ 46 phút
- Pull request đã merge (30 ngày)
- 299
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của LibreSign/libresign
-
backend enhancement good first issue php
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
LibreSign/libresign#9007 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
LibreSign/libresign#8284 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend enhancement php
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Maintainer thường phản hồi trong vòng 1 ngày
-
backend enhancement php
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của LibreSign/libresign
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 89/100
backdrop-contrib/commerce#65 ·
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Evalogical-Inc/devReady#66 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mollie/PrestaShop#1627 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
FriendsOfFlarum/follow-tags#118 ·
-
WebP — PHP 8.5 deprecation "Using null as an array offset" in url_to_path() for relative image URLsĐang mở✨️ai-candidate effort: [XS] module: webp cache priority: low type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày