cvsimport
[hcoop/zz_old/portal.git] / cert.mlt
1 <% @header [("title", ["SSL certificate permission requests"])];
2
3 val admin = Group.inGroupName "server";
4
5 if $"new" <> "" then
6 if $"kind" = "cert" then
7 if $"req" <> "" then
8 %><h3>You filled data in next to a textbox but didn't check the radio button next to it.</h3><%
9 elseif $"cert" = "" then
10 %><h3>Please fill in a path to a certificate.</h3><%
11 else
12 val cert = $"cert";
13 val msg = $"msg";
14
15 %>Are you sure you want to ask for permissions on an SSL certificate at <% cert %>?<br><br>
16 <a href="cert?cmd=request&req=Certificate+<% cert %>&msg=<% Web.urlEncode msg %>">Yes, I want to request that.</a><%
17 end
18 else
19 if $"cert" <> "" then
20 %><h3>You filled data in next to a textbox but didn't check the radio button next to it.</h3><%
21 elseif $"req" = "" then
22 %><h3>Please fill in a path to an OpenSSL request.</h3><%
23 else
24 val req = $"req";
25 val msg = $"msg";
26
27 %>Are you sure you want to ask for permissions on an SSL certificate to be created from an OpenSSL request at <% req %>?<br><br>
28 <a href="cert?cmd=request&req=OpenSSL+request+<% req %>&msg=<% Web.urlEncode msg %>">Yes, I want to request that.</a><%
29 end
30 end
31
32 elseif $"cmd" = "request" then
33 val id = Cert.add (Init.getUserId (), $"req", $"msg");
34 if not (Cert.notifyNew id) then
35 %><h3>Error sending e-mail notification</h3><%
36 end
37 %><h3>Request added</h3><%
38
39 elseif $"cmd" = "open" then
40 %><h3>Open requests</h3>
41 <a href="cert?cmd=list">List all requests</a><%
42
43 foreach (name, req) in Cert.listOpen () do %>
44 <br><hr><br>
45 <table class="blanks">
46 <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
47 <tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
48 <tr> <td>Request:</td> <td><% #data req %></td> </tr>
49 <tr> <td>Reason:</td> <td><% Web.html (#msg req) %></td> </tr>
50 </table>
51
52 <% if admin then %>
53 <br>
54 <a href="cert?mod=<% #id req %>">[Modify]</a>
55 <a href="cert?del=<% #id req %>">[Delete]</a><br>
56 To install, run: <i>tell adamc what text to put here</i>.
57 <% end %>
58
59 <% end
60
61 elseif $"cmd" = "list" then
62 %><h3>All requests</h3><%
63
64 foreach (name, req) in Cert.list () do %>
65 <br><hr><br>
66 <table class="blanks">
67 <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
68 <tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
69 <tr> <td>Request:</td> <td><% #data req %></td> </tr>
70 <tr> <td>Reason:</td> <td><% Web.html (#msg req) %></td> </tr>
71 </table>
72
73 <% if admin then %>
74 <br>
75 <a href="cert?mod=<% #id req %>">[Modify]</a>
76 <a href="cert?del=<% #id req %>">[Delete]</a>
77 <% end %>
78
79 <% end
80
81 elseif $"mod" <> "" then
82 Group.requireGroupName "server";
83 val id = Web.stoi ($"mod");
84 val req = Cert.lookup id;
85 val user = Init.lookupUser (#usr req) %>
86 <h3>Handle request</h3>
87
88 <form method="post">
89 <input type="hidden" name="save" value="<% id %>">
90 <table class="blanks">
91 <tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
92 <tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
93 <tr> <td>Status:</td> <td><select name="status">
94 <option value="0"<% if #status req = Cert.NEW then %> selected<% end %>>New</option>
95 <option value="1"<% if #status req = Cert.INSTALLED then %> selected<% end %>>Installed</option>
96 <option value="2"<% if #status req = Cert.REJECTED then %> selected<% end %>>Rejected</option>
97 </select></td> </tr>
98 <tr> <td>Request:</td> <td><input name="req" size="60" value="<% Web.html (#data req) %>"></td> </tr>
99 <tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
100 <tr> <td><input type="submit" value="Save"></td> </tr>
101 </table>
102 </form>
103
104 <% elseif $"save" <> "" then
105 Group.requireGroupName "server";
106 val id = Web.stoi ($"save");
107 val req = Cert.lookup id;
108 val oldStatus = #status req;
109 val newStatus = Cert.statusFromInt (Web.stoi ($"status"));
110 Cert.modify {req with data = $"req", msg = $"msg", status = newStatus};
111 if oldStatus <> newStatus then
112 if not (Cert.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
113 %><h3>Error sending e-mail notification</h3><%
114 end
115 end
116 %><h3>Request modified</h3>
117 Back to: <a href="cert?cmd=open">open requests</a>, <a href="cert?cmd=list">all requests</a>
118
119 <% elseif $"del" <> "" then
120 Group.requireGroupName "server";
121 val id = Web.stoi ($"del");
122 val req = Cert.lookup id;
123 val user = Init.lookupUser (#usr req)
124 %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
125 <a href="cert?del2=<% id %>">Yes, I'm sure!</a>
126
127 <% elseif $"del2" <> "" then
128 Group.requireGroupName "server";
129 val id = Web.stoi ($"del2");
130 Cert.delete id
131 %><h3>Request deleted</b><h3>
132 Back to: <a href="cert?cmd=open">open requests</a>, <a href="cert?cmd=list">all requests</a>
133
134 <% else %>
135
136 <h3>Request permissions on an SSL certificate</h3>
137
138 <p>Use this form to request use Domtool permissions to use an SSL certificate. Give the location of your certificate request or certificate within <tt>/afs/hcoop.net</tt>.</p>
139
140 <p>If you have your own certificate signed by an outside provider like Verisign, then choose the second option and give the path to that certificate.</p>
141
142 <p>If you want your certificate authenticated by chaining through HCoop's root certificate, then choose the first option and give the path to an OpenSSL certificate request. In the comments field, be sure to specify the number of days that you would like the certificate to be valid. If you do not specify a value, we will use 3650 days. Make sure that the key file is in the same directory as the certificate request, and that it has a "<tt>.key</tt>" extension.</p>
143
144 <p>Note that you can't use SSL certificates very well over HTTPS without an IP address assigned to your web virtual host. You can request one separately on <a href="ip">the IP address request page</a>.</p>
145
146 <p>The <a href="http://wiki.hcoop.net/MemberManual/ServingWebsites/SslCert">instructions on our wiki for creating SSL certificates</a> may be helpful.</p>
147
148 <form method="post">
149 <input type="hidden" name="new" value="1">
150 <table class="blanks">
151 <tr> <td>OpenSSL request: <input type="radio" name="kind" value="req" checked></td> <td><input name="req" size="60"></td> </tr>
152 <tr> <td>OpenSSL certificate: <input type="radio" name="kind" value="cert"></td> <td><input name="cert" size="60"></td> </tr>
153 <tr> <td>Additional comments:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
154 <tr> <td><input type="submit" value="Request"></td> </tr>
155 </table>
156 </form>
157
158 <% end %>
159
160 <% @footer[] %>