Commit graph

3150 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
45caaded60 fix 2025-04-16 11:47:52 +03:00
oleghasjanov
6d388c52bd more logs 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
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
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
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
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
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
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
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
oleghasjanov
98f0bb283e fix path to localize issue 2025-03-21 13:45:07 +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
Timo Võhmar
38dc5466e9
Merge pull request #2723 from internetee/company-validator-during-creation
feat: restore company validation for Estonian organizations
2025-02-12 10:33:28 +02:00
oleghasjanov
2d103bda99 fix: improve admin contact validation messages
- Update error message for missing admin contact to be more concise
- Standardize admin contact validation message for invalid ident type
- Remove redundant error message formatting

The changes make admin contact validation messages more consistent
throughout the application, using "Admin contact" terminology instead
of "Administrative contact" for better clarity and consistency.
2025-02-05 11:53:56 +02:00
oleghasjanov
a56237c84f fix: update admin contact validation error code
- Change error code from 2004 to 2306 for admin contact validation
- Add explicit validation check for required admin contacts
- Update tests to expect new error code

The error code 2306 better reflects the EPP standard for policy-based
validation failures. This change makes the error handling more consistent
with EPP specifications when validating admin contact requirements.
2025-02-05 10:54:21 +02:00
oleghasjanov
9d036f9af3 added virtual attribute for skip whois update 2025-02-03 14:08:50 +02:00
oleghasjanov
38fdc35496 Remove extra update 2025-02-03 14:08:50 +02:00
oleghasjanov
2ec545b3aa feat: add status notes to force delete notifications
- Add notes parameter to force delete interactions to provide more context
- Include company registry status in force delete notifications
- Add status mapping constants for better readability
- Move status note assignment before save in force delete process

Technical details:
- Add notes field to Domains::ForceDelete::Base interaction
- Update force delete notifications to include status notes
- Add REGISTRY_STATUSES mapping in CompanyRegisterStatusJob
- Update tests to verify new notification format
2025-02-03 14:08:50 +02:00
oleghasjanov
45c77f7052 fix: improve company registry data processing
- Switch company_register branch to issues-with-upcoming-data
- Convert ident to string when querying company data
- Add extended logging in CompanyRegisterStatusJob
- Disable automatic merging in renovate.json

Technical changes:
- Update dependencies: date, net-protocol, net-smtp, timeout
2025-02-03 14:08:48 +02:00
oleghasjanov
f2978599b4 feat: add admin contact ident type validation
- Add new setting for allowed admin contact ident types
- Add validation for admin contact ident types on domain create/update
- Add UI controls for managing allowed ident types
- Add tests for new validation rules
- Update domain model to respect new settings

The changes allow configuring which identification types (private person,
organization, birthday) are allowed for administrative contacts. This is
enforced when creating new domains or adding new admin contacts.
2025-02-03 13:59:03 +02:00
oleghasjanov
cd5de3bd14 commit
feat: make technical contacts optional for all domains

- Remove automatic tech contact assignment from admin contacts
- Set minimum tech contacts to 0 for all registrant types
- Update tests to reflect optional tech contacts
- Keep max tech contacts limit from settings

This change implements the requirement to make technical contacts optional
for all domain types while maintaining the maximum limit from settings.
Previously tech contacts were required for organizations and automatically
copied from admin contacts.
2025-01-31 15:49:35 +02:00
oleghasjanov
c2affb393f Refactor domain admin contact validation logic
- Remove validate_admin_contact_type validation
- Extract age calculation logic into separate methods
- Add helper methods for Estonian ID and birthday age checks
- Improve code organization and readability
- Split complex require_admin_contacts? method into smaller methods
2025-01-31 13:01:00 +02:00
oleghasjanov
863dcce647 Add admin contact validation rules based on registrant type and age
- Add validation requiring admin contacts for legal entity registrants
- Add validation requiring admin contacts for underage private registrants:
  - Under 18 years old for birthday-based identification
  - Under 18 years old for Estonian ID numbers
- Make admin contacts optional for:
  - Adult private registrants (18+ years)
  - Adult Estonian ID holders
  - Non-Estonian private registrants
- Add tests covering all new validation scenarios
- Add helper methods to calculate age and parse Estonian ID birth dates
2025-01-31 12:49:14 +02:00
oleghasjanov
3c169bb00b Make admin contacts optional for private registrants
This change makes admin contacts optional for private registrants while keeping them mandatory for organizations. The changes include:

- Updated Domain model validations to make admin and tech contacts optional (min=0) for private registrants
- Added validation rules methods to handle different requirements based on registrant type
- Modified EPP domain creation to support domains without admin contacts for private registrants
- Updated attach_default_contacts to skip adding contacts for private registrants
- Added comprehensive test coverage for:
  - Domain model validations with private/org registrants
  - EPP domain creation without admin contacts for private registrants
  - REPP API contact management for private registrants

This implements the requirement to make admin contacts optional for private registrations of .ee domains while maintaining the existing validation rules for organizations.
2025-01-07 12:24:57 +02:00
Timo Võhmar
1a063fb1ae
Merge pull request #2666 from internetee/2665-fix-expired-status
Manage domain auto expiry status
2024-12-31 10:52:11 +02:00
oleghasjanov
d0a39bf469 remove company creation validation 2024-11-25 14:48:28 +02:00
oleghasjanov
7f6c4f24a6 added more logs 2024-11-25 12:46:46 +02:00
oleghasjanov
88d7689295 changed ident to string 2024-11-25 12:44:01 +02:00
oleghasjanov
95f5acb2b0 change test mode directly 2024-11-25 12:40:09 +02:00
oleghasjanov
cded813955 added details to error message 2024-11-25 12:29:20 +02:00
oleghasjanov
1dd0d29635 added retries 2024-11-25 12:27:13 +02:00
oleghasjanov
748a146fe5 added logs to exception 2024-11-25 12:18:56 +02:00
oleghasjanov
959ac0a9b2 mock method 2024-11-25 12:15:50 +02:00
oleghasjanov
025eb26f3b added logs to company register 2024-11-25 12:11:24 +02:00