mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 14:06:21 +02:00
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
This commit is contained in:
parent
072f4440e2
commit
ae96863b88
13 changed files with 157 additions and 64 deletions
|
@ -0,0 +1,21 @@
|
|||
class ChangeP12PasswordDigestToP12PasswordInCertificates < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
add_column :certificates, :p12_password, :string
|
||||
|
||||
Certificate.find_each do |cert|
|
||||
cert.update_column(:p12_password, cert.p12_password_digest)
|
||||
end
|
||||
|
||||
safety_assured { remove_column :certificates, :p12_password_digest }
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :certificates, :p12_password_digest, :string
|
||||
|
||||
Certificate.find_each do |cert|
|
||||
cert.update_column(:p12_password_digest, cert.p12_password)
|
||||
end
|
||||
|
||||
safety_assured { remove_column :certificates, :p12_password }
|
||||
end
|
||||
end
|
|
@ -590,11 +590,11 @@ CREATE TABLE public.certificates (
|
|||
revoked boolean DEFAULT false NOT NULL,
|
||||
private_key bytea,
|
||||
p12 bytea,
|
||||
p12_password_digest character varying,
|
||||
expires_at timestamp without time zone,
|
||||
serial character varying,
|
||||
revoked_at timestamp without time zone,
|
||||
revoked_reason integer
|
||||
revoked_reason integer,
|
||||
p12_password character varying
|
||||
);
|
||||
|
||||
|
||||
|
@ -5727,6 +5727,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||
('20241206085817'),
|
||||
('20250204094550'),
|
||||
('20250219102811'),
|
||||
('20250313122119');
|
||||
('20250313122119'),
|
||||
('20250319104749');
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue