forked from ffulm/firmware
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from mart-ffbsee/master
Add SSH Public Key via LUCI
- Loading branch information
Showing
5 changed files
with
84 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Keep ssh keys on sysupgrade | ||
# Keep SSL keys on sysupgrade | ||
/etc/uhttpd.crt | ||
/etc/uhttpd.key | ||
/etc/uhttpd.key | ||
|
||
# Keep SSH authorized keys on sysupgrade | ||
/etc/dropbear/authorized_keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/haserl | ||
<% | ||
echo -en "content-type: text/plain\r\n\r\n" | ||
|
||
sshpubkey="$GET_sshpubkey" | ||
|
||
echo "$sshpubkey" >> /etc/dropbear/authorized_keys | ||
if [ $? -eq 0 ]; then | ||
echo "(I) Public Key hinzugefuegt." | ||
chmod 600 /etc/dropbear/authorized_keys | ||
else | ||
echo "(E) Es ist ein Fehler aufgetreten." | ||
fi | ||
|
||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<title>Password</title> | ||
<meta charset="utf-8"/> | ||
<link rel="stylesheet" type="text/css" href="style.css" /> | ||
<script src="shared.js"></script> | ||
<script src="password.js"></script> | ||
</head> | ||
<body onload="init();"> | ||
|
||
<fieldset> | ||
<legend>Passwort</legend> | ||
<div> | ||
<label>Neues Password:</label> <input id="p1" type="password"> | ||
</div> | ||
<div> | ||
<label>Bestätigung:</label> <input id="p2" type="password"> | ||
</div> | ||
<p>Das Passwort sichert den Zugriff auf diese Weboberfläche, sowie den Direktzugriff auf den Router via <a href="https://de.wikipedia.org/wiki/Secure_Shell">SSH</a>. Der Benutzername lautet "root".</p> | ||
</fieldset> | ||
<div> | ||
<button class="button red sharp" type="button" onclick="apply()">Ändern</button> | ||
</div> | ||
|
||
</body> | ||
<head> | ||
<title>Password</title> | ||
<meta charset="utf-8"/> | ||
<link rel="stylesheet" type="text/css" href="style.css" /> | ||
<script src="shared.js"></script> | ||
<script src="password.js"></script> | ||
</head> | ||
<body onload="init();"> | ||
<fieldset> | ||
<legend>Passwort</legend> | ||
<div> | ||
<label>Neues Password:</label> <input id="p1" type="password"> | ||
</div> | ||
<div> | ||
<label>Bestätigung:</label> <input id="p2" type="password"> | ||
</div> | ||
<p>Das Passwort sichert den Zugriff auf diese Weboberfläche</a> ab, sowie den Direktzugriff auf den Router via <a href="https://de.wikipedia.org/wiki/Secure_Shell">SSH</a>. Der Benutzername lautet "root".</p> | ||
<p>ACHTUNG: Es ist nicht möglich hier ein leeres Passwort zu setzen!</p> | ||
</fieldset> | ||
<fieldset> | ||
<legend>SSH Public Key</legend> | ||
<div> | ||
<label>SSH Public Key</label> <input id="s1"> | ||
</div> | ||
<p>Der SSH Public Key dient zum sicheren Einloggen per SSH<br /></p> | ||
<p>Ein hier eingetragener SSH Public Key wird hinzugefügt! Die bisher bereits eingetragenen bleiben ebenfalls erhalten!</p> | ||
</fieldset> | ||
<div> | ||
<button class="final-button" type="button" onclick="apply()">Ändern</button> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
|
||
function init() { | ||
$("p1").focus(); | ||
$("p1").focus(); | ||
} | ||
|
||
function apply() | ||
{ | ||
p1 = $('p1').value; | ||
p2 = $('p2').value; | ||
p1 = $('p1').value; | ||
p2 = $('p2').value; | ||
s1 = $('s1').value; | ||
|
||
$('p1').value = ""; | ||
$('p2').value = ""; | ||
$('p1').value = ""; | ||
$('p2').value = ""; | ||
$('s1').value = ""; | ||
|
||
if(p1 != p2) { | ||
setText('msg', "(E) Die Passwörter sind nicht identisch."); | ||
return; | ||
} else { | ||
setText('msg', "(I) Das Passwort wird geändert. Bitte die Seite neu laden."); | ||
} | ||
if(p1 != p2) { | ||
setText('msg', "(E) Die Passwörter sind nicht identisch."); | ||
return; | ||
} | ||
else { | ||
if(p1 == "") { | ||
setText('msg', "Keine Passwortänderung."); | ||
} | ||
else { | ||
setText('msg', "(I) Das Passwort wird geändert. Bitte die Seite neu laden."); | ||
send("/cgi-bin/password", { func : "set_password", pass1 : p1, pass2 : p2 }, function(data) { | ||
setText('msg', data); | ||
}); | ||
} | ||
} | ||
|
||
send("/cgi-bin/password", { func : "set_password", pass1 : p1, pass2 : p2 }, function(data) { | ||
setText('msg', data); | ||
}); | ||
if(s1 == "") { | ||
setText('msg', ""); | ||
} | ||
else { | ||
send("/cgi-bin/sshpubkey", { func : "set_sshpubkey", sshpubkey : s1}, function(data) { | ||
setText('msg', data); | ||
}); | ||
} | ||
} |