Commit graph

11401 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
d0f247c61c added rails logger 2025-04-16 11:47:52 +03:00
oleghasjanov
99b8650ccb added currect user as log 2025-04-16 11:47:52 +03:00
oleghasjanov
45caaded60 fix 2025-04-16 11:47:52 +03:00
oleghasjanov
6d388c52bd more logs 2025-04-16 11:47:52 +03:00
oleghasjanov
03a2d2c68d asd 2025-04-16 11:47:52 +03:00
oleghasjanov
b892242764 more logs 2025-04-16 11:47:52 +03:00
oleghasjanov
8cb976516c added more logs 2025-04-16 11:47:52 +03:00
oleghasjanov
4a06d00b9b added files to gitignore 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
36968f363e fixed tests 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
Timo Võhmar
c192d3bf08
Update CHANGELOG.md 2025-04-07 14:28:32 +03:00
Timo Võhmar
1dc3396391
Merge pull request #2774 from internetee/daily-force-delete-and-lift-email-subscribe
feat: Add lifted force delete domains to daily admin notification
2025-04-07 14:27:08 +03:00
oleghasjanov
8234a0fe68 updated styles 2025-04-04 14:14:58 +03:00
Timo Võhmar
220b26f0ce
Merge pull request #2777 from internetee/add-dockerfile-production
Added Dockerfile for production and updated gemfile
2025-04-03 11:44:13 +03:00
Timo Võhmar
59213ede5f
Update CHANGELOG.md 2025-04-02 12:59:18 +03:00
Timo Võhmar
32215c9c1f
Merge pull request #2775 from internetee/turn-off-company-validaiton
feat: add ability to skip business contact validation
2025-04-02 12:57:53 +03:00
tsoganov
94e8d928db Added Dockerfile for production and updated gemfile 2025-04-02 12:46:54 +03:00
oleghasjanov
bfecc3c40e refactor: improve force delete domain status tracking
- Add force_delete_domain_statuses_history_data to store force delete metadata
- Update force delete queries to use new JSON status history
- Refactor force delete tests to use travel_to helper
- Remove direct force_delete_start field usage
- Update status notes to include company identification number
2025-04-01 13:52:43 +03:00
oleghasjanov
f542ad036b added breakline 2025-04-01 12:34:03 +03:00
oleghasjanov
c77a4d494d feat: add ability to skip business contact validation
- Add environment variable 'allow_validate_business_contacts' to control business contact validation
- Remove redundant company_is_relevant? method
- Add integration test for skipping company validation
2025-04-01 12:26:53 +03:00
Timo Võhmar
ebc9fd4871
Update CHANGELOG.md 2025-03-31 16:58:27 +03:00
Timo Võhmar
05210ddbba
Merge pull request #2764 from internetee/2747-multiple-underscores-in-email-addresses
# Improve email validation regex pattern and add comprehensive tests
2025-03-31 16:56:23 +03:00
oleghasjanov
917e426d91 feat: Add lifted force delete domains to daily admin notification
- Add tracking of lifted force delete domains with reason and date in json_statuses_history
- Modify ForceDeleteDailyAdminNotifierJob to include both force deleted and lifted domains
- Update admin mailer template to show separate tables for force deleted and lifted domains
- Update tests to reflect new functionality and fix timing issues with yesterday's data

Key changes:
- Store lift reason and date when canceling force delete
- Add new query method for finding lifted force delete domains
- Split email template into two sections
- Fix tests to properly handle the yesterday time window
2025-03-31 16:07:04 +03:00
Timo Võhmar
bcc178388d
Update CHANGELOG.md 2025-03-28 14:27:46 +02:00
Timo Võhmar
8d33bd5de0
Merge pull request #2771 from internetee/ipv6-whitelist-support
feat: support IPv6 /64 range in white IP validation
2025-03-28 14:25:33 +02:00
oleghasjanov
8ccfaef699 fixed integration test 2025-03-24 15:43:06 +02:00
oleghasjanov
bc01dfaa3a feat: support IPv6 /64 range in white IP validation
- Split IP validation logic for IPv4 and IPv6 addresses
- Add specific validation for IPv6 to allow only single addresses (/128) or /64 ranges
- Remove old network address calculation for IPv6
- Keep IPv4 address limit validation unchanged
- Add localization for new IPv6 validation error message
- Add test coverage for IPv6 validation:
  * Test for valid /64 range
  * Test for valid single address
  * Test for invalid ranges (/48 and /96)
2025-03-24 15:16:10 +02:00
Timo Võhmar
7ae4ebda53
Update CHANGELOG.md 2025-03-24 14:14:44 +02:00
Timo Võhmar
5946afc729
Merge pull request #2770 from internetee/2750-admin-contact-cannot-be-a-minor-clean
2750 admin contact cannot be a minor clean
2025-03-24 14:13:26 +02:00
oleghasjanov
98f0bb283e fix path to localize issue 2025-03-21 13:45:07 +02:00
oleghasjanov
58a1dbafb0 rollback 2025-03-21 12:42:18 +02:00
oleghasjanov
4b1d29944f fixed another one failed system test 2025-03-21 12:33:57 +02:00
oleghasjanov
7ef22c6894 fix system test 2025-03-21 12:24:20 +02:00
oleghasjanov
f79f32fb5d added condition for underage 2025-03-21 12:09:47 +02:00
oleghasjanov
9fa14c0c07 added condition 2025-03-20 16:45:25 +02:00
oleghasjanov
e6cb30b599 added check 2025-03-20 16:39:20 +02:00
oleghasjanov
7799727867 feat: add age validation for admin contacts
- Add AgeValidation module for consistent age checks
- Validate admin contacts must be at least 18 years old
- Move age validation logic from Domain to shared module
- Add tests for admin contact age validation
- Fix JSON format for admin_contacts_allowed_ident_type setting

This change ensures that administrative contacts must be adults (18+),
using the same age validation logic as for registrants. The validation
works with both birthday and Estonian ID formats. Settings are now
properly stored as JSON strings for consistent parsing.
2025-03-20 16:37:38 +02:00