summaryrefslogtreecommitdiff
path: root/src/ejabberd_admin.erl
diff options
context:
space:
mode:
authorKonstantinos Kallas <konstantinos.kallas@hotmail.com>2017-08-12 17:14:23 +0300
committerKonstantinos Kallas <konstantinos.kallas@hotmail.com>2017-08-12 17:14:23 +0300
commita72a7f830af9bd72a86cbc7aed2f78e46ea0a781 (patch)
tree8e9d036cc270e0923a703e78853363d8034a031d /src/ejabberd_admin.erl
parentMove the ca_url to the config file (diff)
Add support to revoke a certificate by providing the pem
This is important so that a user can revoke a certificate that is not acquired or logged from our acme client
Diffstat (limited to 'src/ejabberd_admin.erl')
-rw-r--r--src/ejabberd_admin.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl
index ceafed56..87ddb932 100644
--- a/src/ejabberd_admin.erl
+++ b/src/ejabberd_admin.erl
@@ -270,8 +270,8 @@ get_commands_spec() ->
#ejabberd_commands{name = revoke_certificate, tags = [acme],
desc = "Revokes the selected certificate",
module = ?MODULE, function = revoke_certificate,
- args_desc = ["The domain of the certificate in question"],
- args = [{domain, string}],
+ args_desc = ["The domain or file (in pem format) of the certificate in question {domain:Domain | file:File}"],
+ args = [{domain_or_file, string}],
result = {res, restuple}},
#ejabberd_commands{name = import_piefxis, tags = [mnesia],
@@ -602,8 +602,14 @@ list_certificates(Verbose) ->
{invalid_option, String}
end.
-revoke_certificate(Domain) ->
- ejabberd_acme:revoke_certificate(Domain).
+revoke_certificate(DomainOrFile) ->
+ case ejabberd_acme:is_valid_revoke_cert(DomainOrFile) of
+ true ->
+ ejabberd_acme:revoke_certificate(DomainOrFile);
+ false ->
+ String = io_lib:format("Bad argument: ~s", [DomainOrFile]),
+ {invalid_argument, String}
+ end.
%%%
%%% Purge DB