raannakasturi commited on
Commit
347c128
1 Parent(s): b412ac4

refactor: Update app.py for CNAME generation and verification

Browse files
Files changed (3) hide show
  1. .gitignore +1 -1
  2. app.py +3 -6
  3. getTokenCert.py +8 -2
.gitignore CHANGED
@@ -1,6 +1,6 @@
1
  .env
2
  certificate*
3
- /raannakasturi
4
  /thenayankasturi*
5
  /__pycache__
6
  *.json
 
1
  .env
2
  certificate*
3
+ /raanna*
4
  /thenayankasturi*
5
  /__pycache__
6
  *.json
app.py CHANGED
@@ -7,7 +7,7 @@ from gen_client_cnames import gen_client_cnames
7
  from verify_cname import verify_cname
8
 
9
  def gen_cname(i_domains):
10
- cf_domain = "sileruagartha.eu.org"
11
  cname_recs, cname_values = gen_client_cnames(i_domains, cf_domain)
12
  table_data = []
13
  for rec, value in zip(cname_recs, cname_values):
@@ -74,11 +74,9 @@ def app():
74
  key_type = gr.Radio(label="Select SSL key type", choices=["rsa", "ec"], interactive=True, value='ec')
75
  key_size_dropdown = gr.Dropdown(label="Select Key Size", choices=['2048', '4096'], value='4096', visible=False) # Initially visible
76
  key_curve_dropdown = gr.Dropdown(label="Select Key Curve", choices=['SECP256R1', 'SECP384R1'], value='SECP384R1', visible=True) # Initially hidden
77
-
78
  key_type.change(fn=update_key_options, inputs=key_type, outputs=[key_size_dropdown, key_curve_dropdown])
79
  wildcard.change(fn=update_ca_server, inputs=wildcard, outputs=ca_server)
80
  btn3 = gr.Button(value="Generate SSL Certificate")
81
-
82
  with gr.Row():
83
  with gr.Column():
84
  pvt = gr.Textbox(label="Your Private Key", placeholder="Your Private Key will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
@@ -91,14 +89,13 @@ def app():
91
  crtfile = gr.File(label="Download your SSL Certificate")
92
  btn3.click(gen_ssl, inputs=[domains_input, wildcard, email_input, ca_server, key_type, key_size_dropdown, key_curve_dropdown], outputs=[pvt, pvtfile, csr, csrfile, crt, crtfile])
93
  try:
94
- webui.queue(default_concurrency_limit=15).launch()
 
95
  except Exception as e:
96
  print(f"Error: {e}")
97
- sys.exit(1)
98
 
99
  if __name__ == "__main__":
100
  try:
101
  app()
102
  except Exception as e:
103
  print(f"Error: {e}")
104
- sys.exit(1)
 
7
  from verify_cname import verify_cname
8
 
9
  def gen_cname(i_domains):
10
+ cf_domain = "silerudaagartha.eu.org"
11
  cname_recs, cname_values = gen_client_cnames(i_domains, cf_domain)
12
  table_data = []
13
  for rec, value in zip(cname_recs, cname_values):
 
74
  key_type = gr.Radio(label="Select SSL key type", choices=["rsa", "ec"], interactive=True, value='ec')
75
  key_size_dropdown = gr.Dropdown(label="Select Key Size", choices=['2048', '4096'], value='4096', visible=False) # Initially visible
76
  key_curve_dropdown = gr.Dropdown(label="Select Key Curve", choices=['SECP256R1', 'SECP384R1'], value='SECP384R1', visible=True) # Initially hidden
 
77
  key_type.change(fn=update_key_options, inputs=key_type, outputs=[key_size_dropdown, key_curve_dropdown])
78
  wildcard.change(fn=update_ca_server, inputs=wildcard, outputs=ca_server)
79
  btn3 = gr.Button(value="Generate SSL Certificate")
 
80
  with gr.Row():
81
  with gr.Column():
82
  pvt = gr.Textbox(label="Your Private Key", placeholder="Your Private Key will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
 
89
  crtfile = gr.File(label="Download your SSL Certificate")
90
  btn3.click(gen_ssl, inputs=[domains_input, wildcard, email_input, ca_server, key_type, key_size_dropdown, key_curve_dropdown], outputs=[pvt, pvtfile, csr, csrfile, crt, crtfile])
91
  try:
92
+ #webui.queue(default_concurrency_limit=15).launch()
93
+ webui.queue().launch()
94
  except Exception as e:
95
  print(f"Error: {e}")
 
96
 
97
  if __name__ == "__main__":
98
  try:
99
  app()
100
  except Exception as e:
101
  print(f"Error: {e}")
 
getTokenCert.py CHANGED
@@ -52,9 +52,12 @@ def answer_challenge(client, challenge, response, domain):
52
 
53
  def finalize_order(client, order, deadline):
54
  try:
55
- return client.poll_and_finalize(order, deadline=deadline)
 
56
  except Exception as e:
 
57
  print(f"Error finalizing order: {e}")
 
58
  return None
59
 
60
  def retrieve_certificate(final_order):
@@ -65,9 +68,12 @@ def retrieve_certificate(final_order):
65
  return None
66
 
67
  def verify_tokens(client, challs, order):
68
- deadline = datetime.datetime.now() + datetime.timedelta(seconds=90)
69
  answers = []
70
  responses = {}
 
 
 
71
  for domain, challenge_list in challs.items():
72
  print(f"Fetching challenges for domain: {domain}")
73
  for challenge in challenge_list:
 
52
 
53
  def finalize_order(client, order, deadline):
54
  try:
55
+ data = client.poll_and_finalize(order, deadline=deadline)
56
+ return data
57
  except Exception as e:
58
+ data = client.poll_and_finalize(order, deadline=deadline)
59
  print(f"Error finalizing order: {e}")
60
+ print(data)
61
  return None
62
 
63
  def retrieve_certificate(final_order):
 
68
  return None
69
 
70
  def verify_tokens(client, challs, order):
71
+ deadline = datetime.datetime.now() + datetime.timedelta(seconds=180)
72
  answers = []
73
  responses = {}
74
+ print(client)
75
+ print(challs)
76
+ print(order)
77
  for domain, challenge_list in challs.items():
78
  print(f"Fetching challenges for domain: {domain}")
79
  for challenge in challenge_list: