mirror of
				https://github.com/DigitalDevices/octonet.git
				synced 2023-10-10 11:36:52 +00:00 
			
		
		
		
	password protection (currently disabled)
Added files and changes required for password protection
This commit is contained in:
		
							
								
								
									
										41
									
								
								octoserve/var/www/e401.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								octoserve/var/www/e401.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||||
| <html> | ||||
| <head> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||||
| <title>OctopusNet</title> | ||||
| <link rel="stylesheet" type="text/css" href="/style.css"> | ||||
| <script type="text/javascript" src="/menu.js"></script> | ||||
| <!--  Add included scripts here --> | ||||
|  | ||||
| <!-- Add page scripts here --> | ||||
| <script type="text/javascript"> | ||||
| </script> | ||||
|  | ||||
| </head> | ||||
| <body> | ||||
|  | ||||
|  | ||||
| <table class="maintable" align="center"> | ||||
|   <colgroup> | ||||
|     <col width="182px"/> | ||||
|     <col width="728px"/> | ||||
|   </colgroup> | ||||
|   <tr><td class="maintd" colspan="2"> | ||||
|     <a href="http://www.digitaldevices.de"><img src="/BannerDD.jpg" alt="DD" width="910" height="130" /></a> | ||||
|   </td></tr> | ||||
|   <tr><td class="maintd" colspan="2"> </td></tr> | ||||
|   <tr> | ||||
|     <td class="maintd"><script type="text/javascript">CreateMenu();</script></td> | ||||
|     <td class="content"> | ||||
|       <div> | ||||
|         <!-- Begin Content --> | ||||
|         <H1>401: admin login required</H1> | ||||
|         <!-- End Content --> | ||||
|       </div> | ||||
|     </td> | ||||
|   </tr> | ||||
|   <tr><td colspan="2"> </td></tr> | ||||
| </table> | ||||
|  | ||||
| </body> | ||||
| </html> | ||||
							
								
								
									
										52
									
								
								octoserve/var/www/setpasswd.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								octoserve/var/www/setpasswd.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| #!/usr/bin/lua | ||||
|  | ||||
| local host = os.getenv("HTTP_HOST") | ||||
| local proto = os.getenv("SERVER_PROTOCOL") | ||||
| local query = os.getenv("QUERY_STRING") | ||||
| local method = os.getenv("REQUEST_METHOD") | ||||
| local clength = os.getenv("CONTENT_LENGTH") | ||||
| local ctype = os.getenv("CONTENT_TYPE") | ||||
|  | ||||
| function http_print(s) | ||||
|   if s then | ||||
|     io.stdout:write(tostring(s).."\r\n") | ||||
|   else | ||||
|     io.stdout:write("\r\n") | ||||
|   end | ||||
| end | ||||
|  | ||||
| if #arg> 0 then | ||||
|   method="GET" | ||||
|   query="admin" | ||||
|   proto = "HTTP/1.0" | ||||
| end | ||||
|  | ||||
| function SendError(err,desc) | ||||
|   http_print(proto.." "..err) | ||||
|   http_print() | ||||
|   local file = io.open("e404.html") | ||||
|   if file then | ||||
|     local tmp = file:read("*a") | ||||
|     tmp = string.gsub(tmp,"404 Not Found",err .. " " .. desc) | ||||
|     http_print(tmp) | ||||
|     file:close() | ||||
|   end | ||||
| end | ||||
|  | ||||
|  | ||||
| if method == "GET" then | ||||
|   file = io.open("/tmp/pw","w") | ||||
|   if file then  | ||||
|     file:write(query.."\n") | ||||
|     file:write(query.."\n") | ||||
|     file:close() | ||||
|     os.execute('passwd admin </tmp/pw >/dev/null'); | ||||
|     os.execute('rm -f /tmp/pw >/dev/null'); | ||||
|   end | ||||
|   http_print(proto.." 204") | ||||
|   http_print() | ||||
|   return | ||||
|    | ||||
| else | ||||
|   SendError("500","What")   | ||||
| end | ||||
| @@ -56,6 +56,21 @@ function Change() | ||||
|   document.getElementById("SetButton").disabled = false; | ||||
| } | ||||
|  | ||||
| function SetPassword() | ||||
| { | ||||
|   pwd1 = document.getElementById("pwd1").value; | ||||
|   pwd2 = document.getElementById("pwd2").value; | ||||
|   if( pwd1 != pwd2 ) | ||||
|   { | ||||
|     document.getElementById("pwd1").value = ""; | ||||
|     document.getElementById("pwd2").value = ""; | ||||
|     document.getElementById("PwdError").style = "color:#F02000"; | ||||
|     return 0; | ||||
|   } | ||||
|   document.getElementById("PwdError").style = "color:#FFFFFF"; | ||||
|   location.replace('/setpasswd.lua?'+pwd1);   | ||||
| } | ||||
|  | ||||
| </script> | ||||
|  | ||||
| </head> | ||||
| @@ -83,7 +98,7 @@ function Change() | ||||
|               </form> | ||||
|             </td> | ||||
|             <td>See note below</td> | ||||
|           <tr> | ||||
|           </tr> | ||||
|  | ||||
|           <tr> | ||||
|             <td>Telnet</td> | ||||
| @@ -93,7 +108,7 @@ function Change() | ||||
|               </form> | ||||
|             </td> | ||||
|             <td>Enable it at your own risk</td> | ||||
|           <tr> | ||||
|           </tr> | ||||
|            | ||||
|           <tr> | ||||
|             <td>NODMS</td> | ||||
| @@ -103,7 +118,7 @@ function Change() | ||||
|               </form> | ||||
|             </td> | ||||
|             <td>Disable DMS announcement.</td> | ||||
|           <tr> | ||||
|           </tr> | ||||
|  | ||||
|           <tr> | ||||
|             <td>NODVBT</td> | ||||
| @@ -113,7 +128,7 @@ function Change() | ||||
|               </form> | ||||
|             </td> | ||||
|             <td>Disable DVBT announcement.</td> | ||||
|           <tr> | ||||
|           </tr> | ||||
|            | ||||
|           <tr> | ||||
|             <td>No DVB switch</td> | ||||
| @@ -123,7 +138,7 @@ function Change() | ||||
|               </form> | ||||
|             </td> | ||||
|             <td>Disable DVB switch emulation on S8.</td> | ||||
|           <tr> | ||||
|           </tr> | ||||
|            | ||||
|           <tr> | ||||
|             <td colspan="2" align="right"> | ||||
| @@ -137,6 +152,39 @@ function Change() | ||||
|             </td> | ||||
|           </tr> | ||||
|         </table> | ||||
|         <br/> | ||||
|         <!-- | ||||
|         <table class="tableleft" align="center" cellspacing="2px"> | ||||
|           <form action=""> | ||||
|           <tr> | ||||
|             <td align="right"> | ||||
|               New password | ||||
|             </td> | ||||
|             <td> | ||||
|               <input id="pwd1" type="Password" value="" size="30"> | ||||
|             </td> | ||||
|           </tr> | ||||
|           <tr> | ||||
|             <td align="right"> | ||||
|               Repeat new password | ||||
|             </td> | ||||
|             <td> | ||||
|               <input id="pwd2" type="Password" value="" size="30"> | ||||
|             </td> | ||||
|           </tr> | ||||
|           <tr> | ||||
|             <td> | ||||
|               <div Id="PwdError" Style="color:#FFFFFF"> | ||||
|                 Repeated password doesn't match | ||||
|               </div> | ||||
|             </td> | ||||
|             <td align="right"> | ||||
|               <input id="SetButton" type="Button" value="Set Password" onclick="SetPassword()" > | ||||
|             </td> | ||||
|           </tr> | ||||
|           </form> | ||||
|         </table> | ||||
|         --> | ||||
|         <div style="margin:20px; clear:both">  | ||||
|           <h3>Layer 2 Quality of Service</h3> | ||||
|           This is defined in the <b>IEEE 802.1Q</b> VLAN standard, and provides QoS in a local network.<br/> | ||||
|   | ||||
| @@ -74,9 +74,6 @@ if query ~= "" then | ||||
|           os.rename("/etc/securetty","/etc/securetty.bak"); -- temp fix to allow root login on telnet | ||||
|           os.execute("/etc/init.d/S91telnet restart")  | ||||
|         end | ||||
| --        if name == "vlan" then os.execute("/etc/init.d/S99octo restartoctonet&") end | ||||
| --	if name == "nodms" then os.execute("/etc/init.d/S99octo restartoctonet&") end | ||||
| --        if name == "nodvbt" then os.execute("/etc/init.d/S99octo restartoctonet&") end | ||||
|         if name == "vlan" then restart = 1 end | ||||
|         if name == "nodms" then restart = 1 end | ||||
|         if name == "nodvbt" then restart = 1 end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user