Commit graph

85 commits

Author SHA1 Message Date
oleghasjanov
ae96863b88 feat: Implement P12 certificate generation improvements
- Replace hardcoded P12 password with randomly generated one
- Add p12_password column to certificates table
- Update certificate serializer to include p12 password in response
- Remove deprecated certificate revocation logic
- Add tests for certificate revocation functionality
- Implement async P12 generation via Sidekiq job
- Add job uniqueness to prevent parallel certificate generation

Migration changes:
- Replace p12_password_digest with p12_password column
- Add safety measures for column removal
2025-04-16 11:47:52 +03:00
oleghasjanov
072f4440e2 fixed tests 2025-04-16 11:47:52 +03:00
oleghasjanov
fe90d787c2 fix: improve certificate parsing and file extensions
- Fix PKCS12 container parsing by using consistent password
- Add proper file extensions for certificate downloads (.key, .csr, .crt)
- Improve private key parsing by removing unnecessary Base64 decoding
- Add error logging for certificate parsing failures
- Clean up certificate serializer code

The main changes include:
- Using P12_PASSWORD consistently across generation and parsing
- Adding proper file extensions for different certificate types
- Fixing private key parsing to handle PEM format correctly
- Adding detailed error logging for debugging purposes
- Removing redundant code comments and improving code clarity

This commit improves the reliability of certificate handling
and provides better user experience with correct file extensions.
2025-04-16 11:47:52 +03:00
oleghasjanov
0925fa4d4b feat: Implement new certificate generation service
- Refactor certificate generation into a dedicated service object
- Add Base64 encoding for p12 binary data storage
- Implement serial number generation and storage
- Remove deprecated certificate generation code
- Simplify certificate status checks
- Update certificate controller to use new generator
- Add proper password handling for p12 containers

The main changes include:
- Moving certificate generation logic to CertificateGenerator service
- Proper handling of binary data encoding
- Implementing serial number tracking for future CRL support
- Removing old certificate generation and validation code
- Simplifying the certificate lifecycle management

This commit provides a more maintainable and robust certificate
generation system while preparing for future CRL implementation.
2025-04-16 11:47:52 +03:00
oleghasjanov
4343c9f207 change to standard algorithm 2025-04-16 11:47:52 +03:00
oleghasjanov
1d853b5da9 add logs 2025-04-16 11:47:52 +03:00
oleghasjanov
d85b93b8f2 fixed password field in p12 container 2025-04-16 11:47:52 +03:00
oleghasjanov
c08c3878e0 fix: improve p12 container generation with proper certificate status
Fix p12 containers being incorrectly generated with revoked status
Add proper serial number generation based on current time
Improve CRL handling in certificate_revoked? method
Fix controller parameter naming from cert_params to p12_params
Add comprehensive tests for certificate status and CRL handling
Include diagnostic methods for troubleshooting CRL issues
This commit resolves the issue where certificates were incorrectly
considered revoked during p12 container generation due to missing
or improperly handled CRL files.
2025-04-16 11:47:52 +03:00
oleghasjanov
3b594cf30d fix tests 2025-04-16 11:47:52 +03:00
oleghasjanov
0fe20bd63b Fixed Certificate#update_crl test to properly verify CRL updater script call
The test for Certificate.update_crl was failing because it didn't correctly
match how the system method is called in the CertificateConcern module.
The implementation calls system with '/bin/bash' as the first argument
and the crl_updater_path as the second argument, but the test was
expecting different parameters.

- Simplified the test_update_crl_should_call_crl_updater_script test to
  directly verify the script path is used without trying to intercept
  the system call
- Added proper environment variable handling for crl_updater_path
- Ensured original method is restored after test execution
2025-04-16 11:47:52 +03:00
oleghasjanov
5355397025 feat: improve certificate download extensions
Update certificate download functionality to use appropriate file extensions:
- Use .p12 extension for PKCS#12 files
- Keep .pem extension for PEM-encoded files (CSR, CRT, private key)

This change ensures that downloaded certificate files have the correct extension based on their format, making it easier for users to identify and use the files correctly.
2025-04-16 11:47:52 +03:00
oleghasjanov
51035d1ddf Add UserCertificate model with tests
- Create UserCertificate model with validations and certificate renewal logic
- Add tests for UserCertificate model functionality
- Add user certificates fixtures for testing
- Add association between ApiUser and UserCertificates
- Add required gems: dry-types, dry-struct, openssl
- Add /certs to .gitignore

This commit implements the base model for storing user certificates in the
database, including private keys, CSRs, certificates and P12 files. The model
includes basic validation and certificate renewal functionality, with
comprehensive test coverage.
2025-04-16 11:47:50 +03:00
tsoganov
55848e1000 Added birthday ident verification 2025-01-27 16:26:20 +02:00
tsoganov
0085f99e02 Modified identification request webhook 2024-11-14 08:37:09 +02:00
tsoganov
d04622c49f Fixed request endpoint uri 2024-11-14 08:37:09 +02:00
tsoganov
637cabf95f Handling contact verifications 2024-11-14 08:37:09 +02:00
Oleg Hasjanov
6c7abf1123 updated request for get reference user data 2023-10-31 12:42:40 +02:00
Sergei Tsoganov
0f16ec77f5 Added csv export to registrar api_users and white_ips 2023-05-15 14:11:46 +03:00
Sergei Tsoganov
4bf656f425 Fixed partial search formatter 2023-04-06 14:20:17 +03:00
Sergei Tsoganov
33175eea88 Fixed ransack attributes 2023-04-06 14:15:05 +03:00
Sergei Tsoganov
aa8d8c35e8 Fixed ransack admin search 2023-04-06 13:54:03 +03:00
Sergei Tsõganov
5e6dbac462 Refactored monthly invoice generation job 2022-10-12 09:59:21 +03:00
olegphenomenon
00d97aac06 fixed tests 2022-09-01 15:04:04 +03:00
Sergei Tsõganov
ee1117021b Enabled partial search 2022-07-14 15:48:38 +03:00
olegphenomenon
33b373c9cb fixed tests, fixed some codeclimate warnings 2022-06-02 10:37:39 +03:00
olegphenomenon
368e904d5e fixed reload balance and directo 2022-05-17 10:11:26 +03:00
olegphenomenon
5c306accc3 update export invoices task and add request for update invoice status when invoice is cancelled 2022-05-11 11:17:47 +03:00
olegphenomenon
8812f8da22 fixed tests 2022-05-11 11:17:47 +03:00
olegphenomenon
fdf70359d1 refactoring 2022-05-11 11:17:47 +03:00
olegphenomenon
9856a2a5c0 refactoring 2022-05-11 11:17:47 +03:00
olegphenomenon
29e7f954f3 remove legacy code 2022-05-11 11:17:47 +03:00
olegphenomenon
5aacaef006 move billing secret to application.yml 2022-05-11 11:17:47 +03:00
olegphenomenon
204629a62b change acceptable tokens 2022-05-11 11:17:47 +03:00
olegphenomenon
c54c89baf7 eis_billing-request-to-generate-invoice-28-03-2022 2022-05-11 11:17:47 +03:00
olegphenomenon
223f53161b updated invoices status request 2022-05-11 11:17:47 +03:00
olegphenomenon
ee1408e49f added encryptor and service object status invoice request 2022-05-11 11:17:47 +03:00
olegphenomenon
28dcf047ef added encoder for billing request 2022-05-11 11:17:47 +03:00
olegphenomenon
a9ea8e92a1 refactoring lhv connect 2022-05-11 11:17:47 +03:00
olegphenomenon
ab8c911da1 updated directo feature 2022-05-11 11:17:47 +03:00
olegphenomenon
8201e1e0d0 updated e-invoice response controller - added inherit from base class 2022-05-11 11:17:47 +03:00
olegphenomenon
d0236be063 updated tests 2022-05-11 11:17:47 +03:00
olegphenomenon
7e0c6b3afb added tokens 2022-05-11 11:17:47 +03:00
olegphenomenon
c2969fa877 change logic for generate invoice 2022-05-11 11:17:47 +03:00
olegphenomenon
ccd9260ce8 comment out generating invoices via lhv transaction 2022-05-11 11:17:47 +03:00
olegphenomenon
de9504fef7 added ssl verification 2022-05-11 11:17:47 +03:00
olegphenomenon
61c90b73ca added billing staging endpoint 2022-05-11 11:17:47 +03:00
olegphenomenon
5e0d1ff619 added jobs for send e invoice data to billing system and received response 2022-05-11 11:17:47 +03:00
olegphenomenon
0259dd7fec added directo handler for interaction with billing system 2022-05-11 11:17:47 +03:00
olegphenomenon
dbc7525dd5 added one time tasks for import data to billing system 2022-05-11 11:17:47 +03:00
olegphenomenon
84669297b5 added generator reference number which comes from billing system 2022-05-11 11:17:47 +03:00