From 047812d549e190c79576b4cce8cd128ddf73608b Mon Sep 17 00:00:00 2001 From: adamch Date: Sun, 11 Nov 2007 19:42:35 +0000 Subject: [PATCH] IP address requesting (untested because of fyodor outage) --- granter_usual.sh | 5 ++ ip.mlt | 148 +++++++++++++++++++++++++++++++++++++++++++ ip.sml | 12 ++++ remind/remind.sml | 10 +++ tables.sql | 14 ++++ vmailpasswd/pass.sml | 2 +- 6 files changed, 190 insertions(+), 1 deletion(-) create mode 100755 granter_usual.sh create mode 100644 ip.mlt create mode 100644 ip.sml diff --git a/granter_usual.sh b/granter_usual.sh new file mode 100755 index 0000000..3fc24f6 --- /dev/null +++ b/granter_usual.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +./granter.sh www-data >grant.tmp +psql -f grant.tmp hcoop_hcoop +rm grant.tmp diff --git a/ip.mlt b/ip.mlt new file mode 100644 index 0000000..b34929f --- /dev/null +++ b/ip.mlt @@ -0,0 +1,148 @@ +<% @header [("title", ["IP address requests"])]; + +val admin = Group.inGroupName "server"; + +val nodeNum = case $"node" of + "" => 2 + | node => Web.stoi node; + +if $"new" <> "" then + val port = Web.stoi ($"port"); + val msg = $"msg"; + + %>Are you sure you want to ask for an IP address with port <% port %> free on machine <% Init.nodeName nodeNum %>?

+ Yes, I want to request that. + +<% elseif $"req" <> "" then + 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 + %>

Request added

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

Open requests

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


+ + + + + + +
By: <% name %>
Time: <% #stamp req %>
Node: <% Web.html (Init.nodeName (#node req)) %>
Port: <% #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 Ip.list () do %> +


+ + + + + + +
By: <% name %>
Time: <% #stamp req %>
Node: <% Web.html (Init.nodeName (#node req)) %>
Port: <% #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 = Ip.lookup id; + val user = Init.lookupUser (#usr req) %> +

Handle request

+ +
+ + + + + + + + +
Requestor: <% #name user %>
Time: <% #stamp req %>
Node: +
Status:
Port:
Message:
+
+ +<% elseif $"save" <> "" then + Group.requireGroupName "server"; + val id = Web.stoi ($"save"); + val node = Web.stoi ($"node"); + val req = Ip.lookup id; + val oldStatus = #status req; + val newStatus = Ip.statusFromInt (Web.stoi ($"status")); + Ip.modify {req with node = node, data = $"port", msg = $"msg", status = newStatus}; + if oldStatus <> newStatus then + if not (Ip.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = 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 = Ip.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"); + Ip.delete id + %>

Request deleted

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

Request an IP address

+ +

Use this form to request use of a particular port. If your request is granted, you will be assigned rights to your port on a particular IP address. The most common use of this form is to ask for an IP address to use with an SSL virtual web host. We will grant requests in very few other cases. Try to use free ports on the base IP address of one of the machines on which we grant member log-in.

+ +
+ + + + + + +
Machine:
Port#:
Reason:
+
+ +<% end %> + +<% @footer[] %> \ No newline at end of file diff --git a/ip.sml b/ip.sml new file mode 100644 index 0000000..447834a --- /dev/null +++ b/ip.sml @@ -0,0 +1,12 @@ +structure Ip = RequestH(struct + val table = "Ip" + val adminGroup = "server" + fun subject _ = "IP address request" + val template = "ip" + val descr = "IP address" + + fun body {node, mail, data = port} = + (Mail.mwrite (mail, " IP address for port: "); + Mail.mwrite (mail, port); + Mail.mwrite (mail, "\n")) + end) diff --git a/remind/remind.sml b/remind/remind.sml index 32bf3c9..01d0982 100644 --- a/remind/remind.sml +++ b/remind/remind.sml @@ -74,6 +74,16 @@ fun main _ = write "To make a payment, visit:\n"; write " https://members2.hcoop.net/\n"; write "and use the PayPal or Google Checkout link.\n"; + + write "\nIf you don't know how to get a username and password for members2.hcoop.net, visit:\n"; + write " http://wiki2.hcoop.net/MemberManual/MigrationGuide\n"; + write "for a reminder. (\"Step 1\" is all you need to read.)\n"; + + write "\nIf for whatever reason you don't plan to pay the amount suggested in this e-mail,\n"; + write "_please_ don't stay silent. Reply to this message explaining your circumstances.\n"; + write "We are doing limited-time monetary grants on request, due to the extra costs\n"; + write "associated with setting up our new servers.\n"; + ignore (Mail.mclose m) end end diff --git a/tables.sql b/tables.sql index ea3633c..1960b2b 100644 --- a/tables.sql +++ b/tables.sql @@ -314,3 +314,17 @@ CREATE TABLE Sec( FOREIGN KEY (node) REFERENCES WebNode(id) ON DELETE CASCADE); CREATE SEQUENCE SecSeq START 1; + +CREATE TABLE Ip( + id INTEGER PRIMARY KEY, + usr INTEGER NOT NULL, + node 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 IpSeq START 1; diff --git a/vmailpasswd/pass.sml b/vmailpasswd/pass.sml index fc0a595..fbbf26f 100644 --- a/vmailpasswd/pass.sml +++ b/vmailpasswd/pass.sml @@ -14,7 +14,7 @@ fun change (email, old, new) = String.toString old, "\" \"", String.toString new, - "\" >/tmp/pass1 2>/tmp/pass2"] + "\" >/dev/null 2>/dev/null"] in OS.Process.isSuccess (OS.Process.system cmd) end -- 2.20.1