-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add digitalocean ACME Authenticator
Closes: https://forums.truenas.com/t/add-digitalocean-as-acme-dns-authenicator/29879 Signed-off-by: Thomas Bettler <[email protected]>
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/middlewared/middlewared/plugins/acme_protocol_/authenticators/digitalocean.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import logging | ||
|
||
from certbot_dns_digitalocean._internal.dns_digitalocean import _DigitalOceanClient | ||
|
||
from middlewared.api.current import DigitalOceanSchemaArgs | ||
|
||
from .base import Authenticator | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class DigitalOceanAuthenticator(Authenticator): | ||
|
||
NAME = 'digitalocean' | ||
PROPAGATION_DELAY = 60 | ||
SCHEMA_MODEL = DigitalOceanSchemaArgs | ||
|
||
def initialize_credentials(self): | ||
self.token = self.attributes.get('token') | ||
|
||
@staticmethod | ||
async def validate_credentials(middleware, data): | ||
return data | ||
|
||
def _perform(self, domain, validation_name, validation_content): | ||
self.get_client().add_txt_record(domain, validation_name, validation_content, 600) | ||
|
||
def get_client(self): | ||
return _DigitalOceanClient(self.token) | ||
|
||
def _cleanup(self, domain, validation_name, validation_content): | ||
self.get_client().del_txt_record(domain, validation_name, validation_content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters