Skip to content

Commit

Permalink
Merge pull request #32 from mart-ffbsee/master
Browse files Browse the repository at this point in the history
Add SSH Public Key via LUCI
  • Loading branch information
205er authored Feb 5, 2017
2 parents 8042eec + b9e5729 commit 147d342
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 42 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ Now start the build process. This takes some time:
```bash
make
```
*You have the oportunity to compile the firmware at more CPU Threats.
E.g. for 4-Threats type* `make -j4` .
*You have the opportunity to compile the firmware at more CPU Threats.*

*E.g. for 4-Threats type:* `make -j4`

The **firmware images** are now in the `bin`-folder. Use the firmware update
functionality of your router and upload the factory image to flash it with the freifunk firmware. The sysupgrade
Expand Down
7 changes: 5 additions & 2 deletions files/etc/sysupgrade.conf
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
15 changes: 15 additions & 0 deletions files/www/lan/cgi-bin/sshpubkey
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

%>
55 changes: 31 additions & 24 deletions files/www/lan/password.html
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()">&Auml;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&auml;tigung:</label> <input id="p2" type="password">
</div>
<p>Das Passwort sichert den Zugriff auf diese Weboberfl&auml;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&ouml;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&uuml;gt! Die bisher bereits eingetragenen bleiben ebenfalls erhalten!</p>
</fieldset>
<div>
<button class="final-button" type="button" onclick="apply()">&Auml;ndern</button>
</div>
</body>
</html>
44 changes: 30 additions & 14 deletions files/www/lan/password.js
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&ouml;rter sind nicht identisch.");
return;
} else {
setText('msg', "(I) Das Passwort wird ge&auml;ndert. Bitte die Seite neu laden.");
}
if(p1 != p2) {
setText('msg', "(E) Die Passw&ouml;rter sind nicht identisch.");
return;
}
else {
if(p1 == "") {
setText('msg', "Keine Passwort&auml;nderung.");
}
else {
setText('msg', "(I) Das Passwort wird ge&auml;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);
});
}
}

0 comments on commit 147d342

Please sign in to comment.