From: adamch Date: Sun, 11 Nov 2007 20:34:39 +0000 (+0000) Subject: Certificate requests X-Git-Url: https://git.hcoop.net/hcoop/zz_old/portal.git/commitdiff_plain/d6e189f0fcedbb040189379c7cc67d7eeefc0315 Certificate requests --- diff --git a/cert.mlt b/cert.mlt new file mode 100644 index 0000000..58933db --- /dev/null +++ b/cert.mlt @@ -0,0 +1,148 @@ +<% @header [("title", ["SSL certificate permission requests"])]; + +val admin = Group.inGroupName "server"; + +if $"new" <> "" then + if $"kind" = "cert" then + if $"req" <> "" then + %>

You filled data in next to a textbox but didn't check the radio button next to it.

<% + else + val cert = $"cert"; + val msg = $"msg"; + + %>Are you sure you want to ask for permissions on an SSL certificate at <% cert %>?

+ Yes, I want to request that.<% + end + else + if $"cert" <> "" then + %>

You filled data in next to a textbox but didn't check the radio button next to it.

<% + else + val req = $"req"; + val msg = $"msg"; + + %>Are you sure you want to ask for permissions on an SSL certificate to be created from an OpenSSL request at <% req %>?

+ Yes, I want to request that.<% + end + end + +elseif $"cmd" = "request" then + val id = Cert.add (Init.getUserId (), $"req", $"msg"); + if not (Cert.notifyNew id) then + %>

Error sending e-mail notification

<% + end + %>

Request added

<% + +elseif $"cmd" = "open" then + %>

Open requests

+ List all requests<% + + foreach (name, req) in Cert.listOpen () do %> +


+ + + + + +
By: <% name %>
Time: <% #stamp req %>
Request: <% #data req %>
Reason: <% Web.html (#msg req) %>
+ +<% if admin then %> +
+ [Modify] + [Delete]
+ To install, run: tell adamc what text to put here. +<% end %> + +<% end + +elseif $"cmd" = "list" then + %>

All requests

<% + + foreach (name, req) in Cert.list () do %> +


+ + + + + +
By: <% name %>
Time: <% #stamp req %>
Request: <% #data req %>
Reason: <% Web.html (#msg req) %>
+ +<% if admin then %> +
+ [Modify] + [Delete] +<% end %> + +<% end + +elseif $"mod" <> "" then + Group.requireGroupName "server"; + val id = Web.stoi ($"mod"); + val req = Cert.lookup id; + val user = Init.lookupUser (#usr req) %> +

Handle request

+ +
+ + + + + + + + +
Requestor: <% #name user %>
Time: <% #stamp req %>
Status:
Request:
Message:
+
+ +<% elseif $"save" <> "" then + Group.requireGroupName "server"; + val id = Web.stoi ($"save"); + val req = Cert.lookup id; + val oldStatus = #status req; + val newStatus = Cert.statusFromInt (Web.stoi ($"status")); + Cert.modify {req with data = $"req", msg = $"msg", status = newStatus}; + if oldStatus <> newStatus then + if not (Cert.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then + %>

Error sending e-mail notification

<% + end + end + %>

Request modified

+ Back to: open requests, all requests + +<% elseif $"del" <> "" then + Group.requireGroupName "server"; + val id = Web.stoi ($"del"); + val req = Cert.lookup id; + val user = Init.lookupUser (#usr req) + %>

Are you sure you want to delete request by <% #name user %> for <% #data req %>?

+ Yes, I'm sure! + +<% elseif $"del2" <> "" then + Group.requireGroupName "server"; + val id = Web.stoi ($"del2"); + Cert.delete id + %>

Request deleted

+ Back to: open requests, all requests + +<% else %> + +

Request permissions on an SSL certificate

+ +

Use this form to request use Domtool permissions to use an SSL certificate. Give the location of your certificate request or certificate within /afs/hcoop.net. 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. 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.

+ +
+ + + + + + +
OpenSSL request:
OpenSSL certificate:
Additional comments:
+
+ +<% end %> + +<% @footer[] %> diff --git a/cert.sml b/cert.sml new file mode 100644 index 0000000..65ed392 --- /dev/null +++ b/cert.sml @@ -0,0 +1,12 @@ +structure Cert = Request(struct + val table = "Cert" + val adminGroup = "server" + fun subject _ = "SSL certificate request" + val template = "cert" + val descr = "SSL certificate" + + fun body (mail, data) = + (Mail.mwrite (mail, " Request: "); + Mail.mwrite (mail, data); + Mail.mwrite (mail, "\n")) + end) diff --git a/ip.mlt b/ip.mlt index b34929f..edbad91 100644 --- a/ip.mlt +++ b/ip.mlt @@ -14,7 +14,7 @@ if $"new" <> "" then Yes, I want to request that. <% elseif $"req" <> "" then - val id = Ip.add {usr = Init.getUserId(), node = nodeNum, data = $"req", msg = $"msg"}; + val id = Ip.add {usr = Init.getUserId (), node = nodeNum, data = $"req", msg = $"msg"}; if not (Ip.notifyNew id) then %>

Error sending e-mail notification

<% end diff --git a/tables.sql b/tables.sql index 1960b2b..12e879f 100644 --- a/tables.sql +++ b/tables.sql @@ -328,3 +328,16 @@ CREATE TABLE Ip( FOREIGN KEY (node) REFERENCES WebNode(id) ON DELETE CASCADE); CREATE SEQUENCE IpSeq START 1; + +CREATE TABLE Cert( + id INTEGER PRIMARY KEY, + usr INTEGER NOT NULL, + data TEXT NOT NULL, + msg TEXT NOT NULL, + status INTEGER NOT NULL, + stamp TIMESTAMP NOT NULL, + cstamp TIMESTAMP, + FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE, + FOREIGN KEY (node) REFERENCES WebNode(id) ON DELETE CASCADE); + +CREATE SEQUENCE CertSeq START 1;