From 240bcf791115ed99dcd7b570aa1a8880645d457c Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Tue, 18 Sep 2018 17:49:12 +0300 Subject: [PATCH] Revoke, and then delete a certificate This functionality is manually tested. because of heavy reliance on server configuration and bash commands. Ruby OpenSSL library lacks a good way to manage revocation list programatically, which would be the best option to work with. We might still use command line tools in the end. --- app/controllers/admin/certificates_controller.rb | 2 +- app/models/certificate.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/certificates_controller.rb b/app/controllers/admin/certificates_controller.rb index a08654db3..34078aee7 100644 --- a/app/controllers/admin/certificates_controller.rb +++ b/app/controllers/admin/certificates_controller.rb @@ -28,7 +28,7 @@ module Admin end def destroy - if @certificate.destroy + if @certificate.revoke! && @certificate.destroy flash[:notice] = I18n.t('record_deleted') redirect_to admin_api_user_path(@api_user) else diff --git a/app/models/certificate.rb b/app/models/certificate.rb index cb28f629b..212114862 100644 --- a/app/models/certificate.rb +++ b/app/models/certificate.rb @@ -127,6 +127,7 @@ class Certificate < ActiveRecord::Base self.class.update_registry_crl self.class.reload_apache + self end class << self