Commit graph

263 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
0ba69ea848 added interface handler 2025-04-16 11:47:52 +03:00
oleghasjanov
4d33898856 added logs 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
99b8650ccb added currect user as log 2025-04-16 11:47:52 +03:00
oleghasjanov
03a2d2c68d asd 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
Timo Võhmar
268b942042
Merge pull request #2741 from internetee/disclose-phone-num-for-org-registrants
Update company_register gem and fix logger dependency
2025-01-31 17:52:57 +02:00
oleghasjanov
803276d8c8 Add phone number validation for Estonian organization contacts
- Add OrgRegistrantPhoneCheckerJob execution for contact creation and update
- Rename validate_* methods to maybe_validate_* for consistency
- Add tests for phone number validation in REPP API
- Fix method naming and add proper job arguments

This ensures phone numbers are validated against company register data
for Estonian organization contacts after creation or update.
2025-01-30 12:49:20 +02: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
637cabf95f Handling contact verifications 2024-11-14 08:37:09 +02:00
tsoganov
ce01b0847c Fix poll messages crashing 2024-10-15 15:13:46 +03:00
Sergei Tsoganov
c67a21c7ba Improved stats query 2023-12-21 17:26:01 +02:00
Sergei Tsoganov
7736e1c828 Added extra query for log domains destroy events 2023-12-21 12:00:55 +02:00
Sergei Tsoganov
6e271a9242 Updated .codeclimate.yml 2023-12-19 13:09:11 +02:00
Sergei Tsoganov
e68039902d Foxed codeclimate issue 2023-12-19 11:09:17 +02:00
Sergei Tsoganov
7db8b5d970 Removed date_from attribute 2023-12-19 09:38:00 +02:00
Sergei Tsoganov
0ca07a50fb Changed date_from default dates 2023-12-15 16:19:52 +02:00
Sergei Tsoganov
c1e48197cb Refactored sql query for stats calculation 2023-12-15 15:49:29 +02:00
Sergei Tsoganov
533b10aad1 Temporarily changed date_from for stats 2023-12-14 21:19:07 +02:00
Sergei Tsoganov
ea48a1cca1 Removed batching of log_domain records 2023-12-14 20:55:17 +02:00
Sergei Tsoganov
e73faae879 Refactored statistics caclulation 2023-12-14 13:26:31 +02:00
Sergei Tsoganov
7863322c9d Registrar ip restriction on every request 2023-08-04 13:43:02 +03:00
Sergei Tsoganov
b86fac03b5 Corrected integration tests 2023-08-04 12:46:56 +03:00
Sergei Tsoganov
d150c1bc3d Modified registrar ip restriction 2023-08-04 11:59:40 +03:00
Sergei Tsoganov
52b3b3a6cf Added integration tests for user certificate validation 2023-07-13 13:03:10 +03:00
Sergei Tsoganov
cbe78e505b Fixed codeclimate issues 2023-07-13 12:32:33 +03:00
Sergei Tsoganov
65ae5adbb8 Validation of user certificates 2023-07-13 11:19:11 +03:00
Sergei Tsoganov
5c1cede31e Fixed codeclimate issue 2023-07-10 15:56:45 +03:00
Sergei Tsoganov
1dcfd1d414 Updated base_controller.rb 2023-07-10 15:47:59 +03:00
Sergei Tsoganov
fe6015491c Updated base_test 2023-07-10 14:40:18 +03:00
Sergei Tsoganov
f68d8e91c2 Add admin mailers and tests to white_ips 2023-07-10 09:51:56 +03:00
Sergei Tsoganov
1c8a46bd89 Added committed param to white ip 2023-07-07 16:05:06 +03:00
Sergei Tsoganov
e00e44c9b8 Modified white ip form and created mailer 2023-07-05 15:28:43 +03:00
Sergei Tsoganov
97c11f5dfd Added error messages translations to white ips 2023-07-04 11:33:06 +03:00
Sergei Tsoganov
c234449dae Modified white ip form 2023-07-03 15:43:30 +03:00
Sergei Tsoganov
de9921d667 Reject blank admin user emails 2023-06-29 11:19:24 +03:00
Sergei Tsoganov
0ad2fd5a1b Created user admin scope 2023-06-29 10:46:45 +03:00
Sergei Tsoganov
47b6a1b87a Added endpoints for creating and downloading api user certificates 2023-06-28 15:48:40 +03:00
Sergei Tsoganov
b558c80e83 Added user certificate REPP endpoint and mailer 2023-06-09 17:05:22 +03:00
Sergei Tsoganov
a4d28a0ee2 Covered with tests api users and white ips 2023-06-01 16:27:34 +03:00
Sergei Tsoganov
47849e3d36 Added missing param 2023-05-30 16:29:11 +03:00