@@ -285,14 +285,15 @@ def revoke_certificate(self, reason: int = 0) -> None:
285
285
cert_obj = jose .ComparableX509 (OpenSSL .crypto .load_certificate (OpenSSL .crypto .FILETYPE_PEM , self .certificate ))
286
286
self .acme_client .revoke (cert_obj , reason )
287
287
288
- def new_account (self , verify_ssl = True ) -> None :
288
+ def new_account (self , verify_ssl = True , user_agent = 'simple_acme_dns/v2' ) -> None :
289
289
"""
290
290
Registers a new ACME account at the set ACME `directory` URL. By running this method, you are agreeing to the
291
291
ACME servers terms of use.
292
292
293
293
Args:
294
294
verify_ssl (bool): Verify the SSL certificate of the ACME server when making requests.
295
-
295
+ user_agent (str): Configures the user agent that is sent when making requests to the ACME server.
296
+
296
297
Examples:
297
298
>>> client.new_account()
298
299
"""
@@ -301,7 +302,7 @@ def new_account(self, verify_ssl=True) -> None:
301
302
self .account_key = jose .JWKRSA (key = rsa_key )
302
303
303
304
# Initialize our ACME client object
304
- self .net = client .ClientNetwork (self .account_key , user_agent = 'simple_acme_dns/v2' , verify_ssl = verify_ssl )
305
+ self .net = client .ClientNetwork (self .account_key , user_agent = user_agent , verify_ssl = verify_ssl )
305
306
self .directory_obj = messages .Directory .from_json (self .net .get (self .directory ).json ())
306
307
self .acme_client = client .ClientV2 (self .directory_obj , net = self .net )
307
308
@@ -421,6 +422,7 @@ def load_account(json_data: str) -> 'ACMEClient':
421
422
422
423
# Format the serialized data back into the object
423
424
verify_ssl = acct_data .get ('verify_ssl' , True )
425
+ user_agent = acct_data .get ('user_agent' , 'simple_acme_dns/v2' )
424
426
obj .directory = acct_data .get ('directory' , None )
425
427
obj .domains = acct_data .get ('domains' , [])
426
428
obj .certificate = acct_data .get ('certificate' , '' ).encode ()
@@ -431,7 +433,7 @@ def load_account(json_data: str) -> 'ACMEClient':
431
433
obj .account_key = jose .JWKRSA .json_loads (acct_data ['account_key' ])
432
434
433
435
# Re-initialize the ACME client and registration
434
- obj .net = client .ClientNetwork (obj .account_key , user_agent = 'simple_acme_dns/1.0.0' , verify_ssl = verify_ssl )
436
+ obj .net = client .ClientNetwork (obj .account_key , user_agent = user_agent , verify_ssl = verify_ssl )
435
437
obj .directory_obj = messages .Directory .from_json (obj .net .get (obj .directory ).json ())
436
438
obj .acme_client = client .ClientV2 (obj .directory_obj , net = obj .net )
437
439
obj .account = obj .acme_client .query_registration (obj .account )
0 commit comments