summaryrefslogtreecommitdiffstats
path: root/freeradius3-listpasswdfiles-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-09-14 00:29:35 +0000
committerTed Trask <ttrask01@yahoo.com>2014-09-14 00:29:35 +0000
commitabaa1ce203d44749ca6073cb55c2016b6787deb0 (patch)
tree6632012da7a8e775c3e9646b167ed941644065e5 /freeradius3-listpasswdfiles-html.lsp
parent3449c5940995b0486cddc8ff8389a381649b961a (diff)
downloadacf-freeradius3-abaa1ce203d44749ca6073cb55c2016b6787deb0.tar.bz2
acf-freeradius3-abaa1ce203d44749ca6073cb55c2016b6787deb0.tar.xz
Add listpasswdfiles, viewpasswdfile, and editpasswdentry actions for managing passwd files
We obtain the config by running 'radiusd -XC' and parsing the result passwd files are parsed/displayed based upon the format defined in freeradius config Use posix.crypt to set encrypted password generating salt from /dev/urandom, defaulting to SHA-512
Diffstat (limited to 'freeradius3-listpasswdfiles-html.lsp')
-rw-r--r--freeradius3-listpasswdfiles-html.lsp63
1 files changed, 63 insertions, 0 deletions
diff --git a/freeradius3-listpasswdfiles-html.lsp b/freeradius3-listpasswdfiles-html.lsp
new file mode 100644
index 0000000..a3b454c
--- /dev/null
+++ b/freeradius3-listpasswdfiles-html.lsp
@@ -0,0 +1,63 @@
+<% local view, viewlibrary, page_info, session = ...
+htmlviewfunctions = require("htmlviewfunctions")
+html = require("acf.html")
+%>
+
+<%
+function convertsize(size)
+ if string.find(size, "k$") then
+ return tonumber(string.match(size, "[%d.]*")) * 1024.0
+ elseif string.find(size, "M$") then
+ return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0
+ elseif string.find(size, "G$") then
+ return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0
+ else
+ return tonumber(string.match(size, "[%d.]*"))
+ end
+end
+%>
+
+<script type="text/javascript">
+ if (typeof jQuery == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ if (typeof $.tablesorter == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ $(document).ready(function() {
+ $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
+ });
+</script>
+
+<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Passwd Configuration"}), page_info) %>
+<table id="list" class="tablesorter"><thead>
+ <tr>
+ <th>Action</th>
+ <th>File</th>
+ <th>Size</th>
+ <th>Last Modified</th>
+ </tr>
+</thead><tbody>
+<% local filename = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
+<% for k,v in ipairs( view.value ) do %>
+ <tr>
+ <td>
+ <% filename.value = v.filename %>
+ <% if viewlibrary.check_permission("viewpasswdfile") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="View", action="viewpasswdfile"}), page_info, -1) %>
+ <% end %>
+ </td>
+ <td><%= html.html_escape(v.filename) %></td>
+ <td><span class="hide"><%= convertsize(v.size) %>b</span><%= html.html_escape(v.size) %></td>
+ <td><%= html.html_escape(v.mtime) %></td>
+ </tr>
+<% end %>
+</tbody></table>
+<% htmlviewfunctions.displaysectionend(header_level) %>