1 <% @header [("title", ["IP address requests"])];
3 val admin = Group.inGroupName "server";
5 val nodeNum = case $"node" of
7 | node => Web.stoi node;
10 val port = Web.stoi ($"port");
13 %>Are you sure you want to ask for an IP address with port <% port %> free on machine <% Init.nodeName nodeNum %>?<br><br>
14 <a href="ip?node=<% nodeNum %>&req=<% port %>&msg=<% Web.urlEncode msg %>">Yes, I want to request that.</a>
16 <% elseif $"req" <> "" then
17 val id = Ip.add {usr = Init.getUserId (), node = nodeNum, data = $"req", msg = $"msg"};
18 if not (Ip.notifyNew id) then
19 %><h3>Error sending e-mail notification</h3><%
21 %><h3>Request added</h3><%
23 elseif $"cmd" = "open" then
24 %><h3>Open requests</h3>
25 <a href="ip?cmd=list">List all requests</a><%
27 foreach (name, req) in Ip.listOpen () do %>
29 <table class="blanks">
30 <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
31 <tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
32 <tr> <td>Node:</td> <td><% Web.html (Init.nodeName (#node req)) %></td> </tr>
33 <tr> <td>Port:</td> <td><% #data req %></td> </tr>
34 <tr> <td>Reason:</td> <td><% Web.html (#msg req) %></td> </tr>
39 <a href="ip?mod=<% #id req %>">[Modify]</a>
40 <a href="ip?del=<% #id req %>">[Delete]</a><br>
42 <li> Choose a new IP address <tt>69.90.123.<i>NNN</i></tt> from those available.</li>
43 <li> Add new entry to <tt>/etc/network/interfaces</tt> on mire, where <tt><i>N</i></tt> is some incremented number.
44 <blockquote><pre>auto eth0:N
45 iface eth0:N inet static
47 netmask 255.255.255.224
49 </pre></blockquote></li>
50 <li> Edit <tt>/etc/apache2/ports.conf</tt> and add the following lines:
51 <blockquote><pre>Listen 69.90.123.NNN:80
52 Listen 69.90.123.NNN:443</pre></blockquote></li>
53 <li> Run <tt>ifup eth0:<i>N</i></tt>.
54 <li> Restart Apache with <tt>/etc/init.d/apache2 restart</tt>.</li>
60 elseif $"cmd" = "list" then
61 %><h3>All requests</h3><%
63 foreach (name, req) in Ip.list () do %>
65 <table class="blanks">
66 <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
67 <tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
68 <tr> <td>Node:</td> <td><% Web.html (Init.nodeName (#node req)) %></td> </tr>
69 <tr> <td>Port:</td> <td><% #data req %></td> </tr>
70 <tr> <td>Reason:</td> <td><% Web.html (#msg req) %></td> </tr>
75 <a href="ip?mod=<% #id req %>">[Modify]</a>
76 <a href="ip?del=<% #id req %>">[Delete]</a>
81 elseif $"mod" <> "" then
82 Group.requireGroupName "server";
83 val id = Web.stoi ($"mod");
84 val req = Ip.lookup id;
85 val user = Init.lookupUser (#usr req) %>
86 <h3>Handle request</h3>
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 %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
93 <tr> <td>Node:</td> <td><select name="node">
94 <% foreach node in Init.listNodes () do %>
95 <option value="<% #id node %>"<% if #id node = #node req then %> selected<% end %>><% Web.html (#name node) %> (<% Web.html (#descr node) %>; Debian <% Web.html (#debian node) %>)</option>
98 <tr> <td>Status:</td> <td><select name="status">
99 <option value="0"<% if #status req = Ip.NEW then %> selected<% end %>>New</option>
100 <option value="1"<% if #status req = Ip.INSTALLED then %> selected<% end %>>Installed</option>
101 <option value="2"<% if #status req = Ip.REJECTED then %> selected<% end %>>Rejected</option>
103 <tr> <td>Port:</td> <td><input name="port" size="6" value="<% Web.html (#data req) %>"></td> </tr>
104 <tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
105 <tr> <td><input type="submit" value="Save"></td> </tr>
109 <% elseif $"save" <> "" then
110 Group.requireGroupName "server";
111 val id = Web.stoi ($"save");
112 val node = Web.stoi ($"node");
113 val req = Ip.lookup id;
114 val oldStatus = #status req;
115 val newStatus = Ip.statusFromInt (Web.stoi ($"status"));
116 Ip.modify {req with node = node, data = $"port", msg = $"msg", status = newStatus};
117 if oldStatus <> newStatus then
118 if not (Ip.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then
119 %><h3>Error sending e-mail notification</h3><%
122 %><h3>Request modified</h3>
123 Back to: <a href="ip?cmd=open">open requests</a>, <a href="ip?cmd=list">all requests</a>
125 <% elseif $"del" <> "" then
126 Group.requireGroupName "server";
127 val id = Web.stoi ($"del");
128 val req = Ip.lookup id;
129 val user = Init.lookupUser (#usr req)
130 %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
131 <a href="ip?del2=<% id %>">Yes, I'm sure!</a>
133 <% elseif $"del2" <> "" then
134 Group.requireGroupName "server";
135 val id = Web.stoi ($"del2");
137 %><h3>Request deleted</b><h3>
138 Back to: <a href="ip?cmd=open">open requests</a>, <a href="ip?cmd=list">all requests</a>
142 <h3>Request an IP address</h3>
144 <p>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.</p>
147 <input type="hidden" name="new" value="1">
148 <table class="blanks">
149 <tr> <td>Machine:</td> <td><select name="node">
150 <% foreach node in Init.listNodes () do %>
151 <option value="<% #id node %>"<% if #id node = nodeNum then %> selected<% end %>><% Web.html (#name node) %> (<% Web.html (#descr node) %>; Debian <% Web.html (#debian node) %>)</option>
154 <tr> <td>Port#:</td> <td><input name="port" size="6" value="443"></td> </tr>
155 <tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
156 <tr> <td><input type="submit" value="Request"></td> </tr>