mirror of
				https://github.com/laurivosandi/certidude
				synced 2025-10-30 17:09:19 +00:00 
			
		
		
		
	Major refactoring, CA is associated with it's hostname now
This commit is contained in:
		| @@ -1,4 +1,4 @@ | ||||
| <h1>{{authority.slug}} management</h1> | ||||
| <h1>{{authority.common_name}} management</h1> | ||||
|  | ||||
| <p>Hi {{session.username}},</p> | ||||
|  | ||||
| @@ -9,51 +9,26 @@ | ||||
|  | ||||
| {% set s = authority.certificate.identity %} | ||||
|  | ||||
|  | ||||
| <input id="search" class="icon search" type="search" placeholder="hostname, IP-address, etc"/> | ||||
|  | ||||
| <h1>Pending requests</h1> | ||||
|  | ||||
| <ul> | ||||
|     {% for j in authority.requests %} | ||||
| <ul id="pending_requests"> | ||||
|     {% for request in authority.requests %} | ||||
|          {% include "request.html" %} | ||||
|     {% else %} | ||||
|         <li>Great job! No certificate signing requests to sign.</li> | ||||
| 	{% endfor %} | ||||
|     <li class="notify"> | ||||
|         <p>No certificate signing requests to sign! You can  submit a certificate signing request by:</p> | ||||
|         <pre>certidude setup client {{authority.common_name}}</pre> | ||||
|     </li> | ||||
| </ul> | ||||
|  | ||||
| <h1>Signed certificates</h1> | ||||
|  | ||||
| <ul id="signed_certificates"> | ||||
|     {% for j in authority.signed | sort | reverse %} | ||||
|         <li id="certificate_{{ j.sha256sum }}" data-dn="{{ j.identity }}"> | ||||
|             <a class="button icon download" href="/api/ca/{{authority.slug}}/signed/{{j.common_name}}/">Fetch</a> | ||||
|             <button class="icon revoke" onClick="javascript:$(this).addClass('busy');$.ajax({url:'/api/ca/{{authority.slug}}/signed/{{j.common_name}}/',type:'delete'});">Revoke</button> | ||||
|  | ||||
|             <div class="monospace"> | ||||
|             {% include 'img/iconmonstr-certificate-15-icon.svg' %} | ||||
|             {{j.identity}} | ||||
|             </div> | ||||
|  | ||||
|             {% if j.email_address %} | ||||
|             <div class="email">{% include 'img/iconmonstr-email-2-icon.svg' %} {{ j.email_address }}</div> | ||||
|             {% endif %} | ||||
|  | ||||
|             <div class="monospace"> | ||||
|             {% include 'img/iconmonstr-key-2-icon.svg' %} | ||||
|             <span title="SHA-256 of public key"> | ||||
|             {{ j.sha256sum }} | ||||
|             </span> | ||||
|             {{ j.key_length }}-bit | ||||
|             {{ j.key_type }} | ||||
|             </div> | ||||
|  | ||||
|             <div> | ||||
|             {% include 'img/iconmonstr-flag-3-icon.svg' %} | ||||
|             {{j.key_usage}} | ||||
|             </div> | ||||
|  | ||||
|             <div class="status"> | ||||
|             {% include 'status.html' %} | ||||
|             </div> | ||||
|         </li> | ||||
|     {% for certificate in authority.signed | sort | reverse %} | ||||
|         {% include "signed.html" %} | ||||
| 	{% endfor %} | ||||
| </ul> | ||||
|  | ||||
| @@ -61,7 +36,7 @@ | ||||
|  | ||||
| <p>To fetch certificate revocation list:</p> | ||||
| <pre> | ||||
| curl {{request.url}}/revoked/ | openssl crl -text -noout | ||||
| curl {{window.location.href}}api/revoked/ | openssl crl -text -noout | ||||
| </pre> | ||||
| <!-- | ||||
| <p>To perform online certificate status request</p> | ||||
|   | ||||
| @@ -35,18 +35,36 @@ ul { | ||||
|     padding: 0; | ||||
| } | ||||
|  | ||||
| #pending_requests .notify { | ||||
|     display: none; | ||||
| } | ||||
|  | ||||
| #pending_requests .notify:only-child { | ||||
|     display: block; | ||||
| } | ||||
|  | ||||
|  | ||||
| button, .button, input[type='search'], input[type='text'] { | ||||
|     border: 1pt solid #ccc; | ||||
|     border-radius: 6px; | ||||
| } | ||||
|  | ||||
| button, .button { | ||||
|     color: #000; | ||||
|     float: right; | ||||
|     border: 1pt solid #ccc; | ||||
|     background-color: #eee; | ||||
|     border-radius: 6px; | ||||
|     margin: 2px; | ||||
|     padding: 6px 12px; | ||||
|     background-position: 6px; | ||||
|     box-sizing: border-box; | ||||
| } | ||||
|  | ||||
| input[type='search'], input[type='text'] { | ||||
|     padding: 4px 4px 4px 36px; | ||||
|     background-position: 6px; | ||||
|     width: 100%; | ||||
| } | ||||
|  | ||||
| button:disabled, .button:disabled { | ||||
|     color: #888; | ||||
| } | ||||
| @@ -108,7 +126,7 @@ h2 svg { | ||||
|     top: 16px; | ||||
| } | ||||
|  | ||||
| p, td, footer, li, button { | ||||
| p, td, footer, li, button, input { | ||||
|     font-family: 'PT Sans Narrow'; | ||||
|     font-size: 14pt; | ||||
| } | ||||
| @@ -155,6 +173,7 @@ li { | ||||
| .icon.revoke { background-image: url("../img/iconmonstr-x-mark-5-icon.svg"); } | ||||
| .icon.download { background-image: url("../img/iconmonstr-download-12-icon.svg"); } | ||||
| .icon.sign { background-image: url("../img/iconmonstr-pen-10-icon.svg"); } | ||||
| .icon.search { background-image: url("../img/iconmonstr-magnifier-4-icon.svg"); } | ||||
|  | ||||
| /* Make sure this is the last one */ | ||||
| .icon.busy{background-image:url("https://software.opensuse.org/assets/ajax-loader-ea46060b6c9f42822a3d58d075c83ea2.gif");} | ||||
|   | ||||
							
								
								
									
										2
									
								
								certidude/static/error.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								certidude/static/error.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| <h1>{{ message.title }}</h1> | ||||
| <p>{{ message.description }}</p> | ||||
							
								
								
									
										27
									
								
								certidude/static/img/iconmonstr-magnifier-4-icon.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								certidude/static/img/iconmonstr-magnifier-4-icon.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
|  | ||||
|  | ||||
| <!-- The icon can be used freely in both personal and commercial projects with no attribution required, but always appreciated.  | ||||
| You may NOT sub-license, resell, rent, redistribute or otherwise transfer the icon without express written permission from iconmonstr.com --> | ||||
|  | ||||
|  | ||||
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||||
|  | ||||
| <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | ||||
|  | ||||
| 	 width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> | ||||
|  | ||||
| <path id="magnifier-4-icon" d="M448.225,394.243l-85.387-85.385c16.55-26.081,26.146-56.986,26.146-90.094 | ||||
|  | ||||
| 	c0-92.989-75.652-168.641-168.643-168.641c-92.989,0-168.641,75.652-168.641,168.641s75.651,168.641,168.641,168.641 | ||||
|  | ||||
| 	c31.465,0,60.939-8.67,86.175-23.735l86.14,86.142C429.411,486.566,485.011,431.029,448.225,394.243z M103.992,218.764 | ||||
|  | ||||
| 	c0-64.156,52.192-116.352,116.35-116.352s116.353,52.195,116.353,116.352s-52.195,116.352-116.353,116.352 | ||||
|  | ||||
| 	S103.992,282.92,103.992,218.764z M138.455,188.504c34.057-78.9,148.668-69.752,170.248,12.862 | ||||
|  | ||||
| 	C265.221,150.329,188.719,144.834,138.455,188.504z"/> | ||||
|  | ||||
| </svg> | ||||
|  | ||||
| After Width: | Height: | Size: 1.2 KiB | 
| @@ -8,6 +8,7 @@ | ||||
|     <script type="text/javascript" src="/js/jquery-2.1.4.min.js"></script> | ||||
|     <script type="text/javascript" src="/js/nunjucks.min.js"></script> | ||||
|     <script type="text/javascript" src="/js/certidude.js"></script> | ||||
|     <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> | ||||
| </head> | ||||
| <body> | ||||
|     <div id="container"> | ||||
|   | ||||
| @@ -3,8 +3,16 @@ $(document).ready(function() { | ||||
|  | ||||
|     $.ajax({ | ||||
|         method: "GET", | ||||
|         url: "/api/ca/", | ||||
|         url: "/api/session/", | ||||
|         dataType: "json", | ||||
|         error: function(response) { | ||||
|             if (response.responseJSON) { | ||||
|                 var msg = response.responseJSON | ||||
|             } else { | ||||
|                 var msg = { title: "Error " + response.status, description: response.statusText } | ||||
|             } | ||||
|             $("#container").html(nunjucks.render('error.html', { message: msg })); | ||||
|         }, | ||||
|         success: function(session, status, xhr) { | ||||
|             console.info("Loaded CA list:", session); | ||||
|  | ||||
| @@ -15,7 +23,7 @@ $(document).ready(function() { | ||||
|  | ||||
|             $.ajax({ | ||||
|                 method: "GET", | ||||
|                 url: "/api/ca/" + session.authorities[0], | ||||
|                 url: "/api/", | ||||
|                 dataType: "json", | ||||
|                 success: function(authority, status, xhr) { | ||||
|                     console.info("Got CA:", authority); | ||||
| @@ -61,12 +69,33 @@ $(document).ready(function() { | ||||
|  | ||||
|                     source.addEventListener("request_submitted", function(e) { | ||||
|                         console.log("Request submitted:", e.data); | ||||
|                         $.ajax({ | ||||
|                             method: "GET", | ||||
|                             url: "/api/request/lauri-c720p/", | ||||
|                             dataType: "json", | ||||
|                             success: function(request, status, xhr) { | ||||
|                                 console.info(request); | ||||
|                                 $("#pending_requests").prepend( | ||||
|                                     nunjucks.render('request.html', { request: request })); | ||||
|                             } | ||||
|                         }); | ||||
|  | ||||
|                     }); | ||||
|  | ||||
|                     source.addEventListener("request_signed", function(e) { | ||||
|                         console.log("Request signed:", e.data); | ||||
|                         $("#request_" + e.data).slideUp("normal", function() { $(this).remove(); }); | ||||
|                         // TODO: Insert <li> to signed certs list | ||||
|  | ||||
|                         $.ajax({ | ||||
|                             method: "GET", | ||||
|                             url: "/api/signed/lauri-c720p/", | ||||
|                             dataType: "json", | ||||
|                             success: function(certificate, status, xhr) { | ||||
|                                 console.info(certificate); | ||||
|                                 $("#signed_certificates").prepend( | ||||
|                                     nunjucks.render('signed.html', { certificate: certificate })); | ||||
|                             } | ||||
|                         }); | ||||
|                     }); | ||||
|  | ||||
|                     source.addEventListener("certificate_revoked", function(e) { | ||||
| @@ -74,11 +103,11 @@ $(document).ready(function() { | ||||
|                         $("#certificate_" + e.data).slideUp("normal", function() { $(this).remove(); }); | ||||
|                     }); | ||||
|  | ||||
|                     $("#container").html(nunjucks.render('authority.html', { authority: authority, session: session })); | ||||
|                     $("#container").html(nunjucks.render('authority.html', { authority: authority, session: session, window: window })); | ||||
|  | ||||
|                     $.ajax({ | ||||
|                         method: "GET", | ||||
|                         url: "/api/ca/" + authority.slug + "/lease/", | ||||
|                         url: "/api/lease/", | ||||
|                         dataType: "json", | ||||
|                         success: function(leases, status, xhr) { | ||||
|                             console.info("Got leases:", leases); | ||||
| @@ -96,6 +125,18 @@ $(document).ready(function() { | ||||
|                                         released: leases[j].released ? new Date(leases[j].released).toLocaleString() : null | ||||
|                                     }})); | ||||
|                             } | ||||
|  | ||||
|                             /* Set up search box */ | ||||
|                             $("#search").on("keyup", function() { | ||||
|                                 var q = $("#search").val().toLowerCase(); | ||||
|                                 $(".filterable").each(function(i, e) { | ||||
|                                     if ($(e).attr("data-dn").toLowerCase().indexOf(q) >= 0) { | ||||
|                                         $(e).show(); | ||||
|                                     } else { | ||||
|                                         $(e).hide(); | ||||
|                                     } | ||||
|                                 }); | ||||
|                             }); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|   | ||||
| @@ -1,37 +1,37 @@ | ||||
| <li id="request_{{ j.md5sum }}"> | ||||
| <li id="request_{{ request.sha256sum }}" class="filterable"> | ||||
|  | ||||
| <a class="button icon download" href="/api/ca/{{authority.slug}}/request/{{j.common_name}}/">Fetch</a> | ||||
| {% if j.signable %} | ||||
| <button class="icon sign" onClick="javascript:$(this).addClass('busy');$.ajax({url:'/api/ca/{{authority.slug}}/request/{{j.common_name}}/',type:'patch'});">Sign</button> | ||||
| <a class="button icon download" href="/api/request/{{request.common_name}}/">Fetch</a> | ||||
| {% if request.signable %} | ||||
| <button class="icon sign" onClick="javascript:$(this).addClass('busy');$.ajax({url:'/api/request/{{request.common_name}}/',type:'patch'});">Sign</button> | ||||
| {% else %} | ||||
| <button title="Please use certidude command-line utility to sign unusual requests" disabled>Sign</button> | ||||
| {% endif %} | ||||
| <button class="icon revoke" onClick="javascript:$(this).addClass('busy');$.ajax({url:'/api/ca/{{authority.slug}}/request/{{j.common_name}}/',type:'delete'});">Delete</button> | ||||
| <button class="icon revoke" onClick="javascript:$(this).addClass('busy');$.ajax({url:'/api/request/{{request.common_name}}/',type:'delete'});">Delete</button> | ||||
|  | ||||
|  | ||||
| <div class="monospace"> | ||||
| {% include 'img/iconmonstr-certificate-15-icon.svg' %} | ||||
| {{j.identity}} | ||||
| {{request.identity}} | ||||
| </div> | ||||
|  | ||||
| {% if j.email_address %} | ||||
| <div class="email">{% include 'img/iconmonstr-email-2-icon.svg' %} {{ j.email_address }}</div> | ||||
| {% if request.email_address %} | ||||
| <div class="email">{% include 'img/iconmonstr-email-2-icon.svg' %} {{ request.email_address }}</div> | ||||
| {% endif %} | ||||
|  | ||||
| <div class="monospace"> | ||||
| {% include 'img/iconmonstr-key-2-icon.svg' %} | ||||
| <span title="SHA-1 of public key"> | ||||
| {{ j.sha256sum }} | ||||
| {{ request.sha256sum }} | ||||
| </span> | ||||
| {{ j.key_length }}-bit | ||||
| {{ j.key_type }} | ||||
| {{ request.key_length }}-bit | ||||
| {{ request.key_type }} | ||||
| </div> | ||||
|  | ||||
| {% set key_usage = j.key_usage %} | ||||
| {% set key_usage = request.key_usage %} | ||||
| {% if key_usage %} | ||||
| <div> | ||||
| {% include 'img/iconmonstr-flag-3-icon.svg' %} | ||||
| {{j.key_usage}} | ||||
| {{request.key_usage}} | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
|   | ||||
							
								
								
									
										31
									
								
								certidude/static/signed.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								certidude/static/signed.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <li id="certificate_{{ certificate.sha256sum }}" data-dn="{{ certificate.identity }}" class="filterable"> | ||||
|     <a class="button icon download" href="/api/signed/{{certificate.common_name}}/">Fetch</a> | ||||
|     <button class="icon revoke" onClick="javascript:$(this).addClass('busy');$.ajax({url:'/api/signed/{{certificate.common_name}}/',type:'delete'});">Revoke</button> | ||||
|  | ||||
|     <div class="monospace"> | ||||
|     {% include 'img/iconmonstr-certificate-15-icon.svg' %} | ||||
|     {{certificate.identity}} | ||||
|     </div> | ||||
|  | ||||
|     {% if certificate.email_address %} | ||||
|     <div class="email">{% include 'img/iconmonstr-email-2-icon.svg' %} {{ certificate.email_address }}</div> | ||||
|     {% endif %} | ||||
|  | ||||
|     <div class="monospace"> | ||||
|     {% include 'img/iconmonstr-key-2-icon.svg' %} | ||||
|     <span title="SHA-256 of public key"> | ||||
|     {{ certificate.sha256sum }} | ||||
|     </span> | ||||
|     {{ certificate.key_length }}-bit | ||||
|     {{ certificate.key_type }} | ||||
|     </div> | ||||
|  | ||||
|     <div> | ||||
|     {% include 'img/iconmonstr-flag-3-icon.svg' %} | ||||
|     {{certificate.key_usage}} | ||||
|     </div> | ||||
|  | ||||
|     <div class="status"> | ||||
|     {% include 'status.html' %} | ||||
|     </div> | ||||
| </li> | ||||
		Reference in New Issue
	
	Block a user