Skip to content

Commit 147d342

Browse files
authored
Merge pull request #32 from mart-ffbsee/master
Add SSH Public Key via LUCI
2 parents 8042eec + b9e5729 commit 147d342

File tree

5 files changed

+84
-42
lines changed

5 files changed

+84
-42
lines changed

Diff for: README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ Now start the build process. This takes some time:
5858
```bash
5959
make
6060
```
61-
*You have the oportunity to compile the firmware at more CPU Threats.
62-
E.g. for 4-Threats type* `make -j4` .
61+
*You have the opportunity to compile the firmware at more CPU Threats.*
62+
63+
*E.g. for 4-Threats type:* `make -j4`
6364

6465
The **firmware images** are now in the `bin`-folder. Use the firmware update
6566
functionality of your router and upload the factory image to flash it with the freifunk firmware. The sysupgrade

Diff for: files/etc/sysupgrade.conf

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
# Keep ssh keys on sysupgrade
1+
# Keep SSL keys on sysupgrade
22
/etc/uhttpd.crt
3-
/etc/uhttpd.key
3+
/etc/uhttpd.key
4+
5+
# Keep SSH authorized keys on sysupgrade
6+
/etc/dropbear/authorized_keys

Diff for: files/www/lan/cgi-bin/sshpubkey

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/haserl
2+
<%
3+
echo -en "content-type: text/plain\r\n\r\n"
4+
5+
sshpubkey="$GET_sshpubkey"
6+
7+
echo "$sshpubkey" >> /etc/dropbear/authorized_keys
8+
if [ $? -eq 0 ]; then
9+
echo "(I) Public Key hinzugefuegt."
10+
chmod 600 /etc/dropbear/authorized_keys
11+
else
12+
echo "(E) Es ist ein Fehler aufgetreten."
13+
fi
14+
15+
%>

Diff for: files/www/lan/password.html

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
<!DOCTYPE html>
22

33
<html>
4-
<head>
5-
<title>Password</title>
6-
<meta charset="utf-8"/>
7-
<link rel="stylesheet" type="text/css" href="style.css" />
8-
<script src="shared.js"></script>
9-
<script src="password.js"></script>
10-
</head>
11-
<body onload="init();">
12-
13-
<fieldset>
14-
<legend>Passwort</legend>
15-
<div>
16-
<label>Neues Password:</label> <input id="p1" type="password">
17-
</div>
18-
<div>
19-
<label>Bestätigung:</label> <input id="p2" type="password">
20-
</div>
21-
<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>
22-
</fieldset>
23-
<div>
24-
<button class="button red sharp" type="button" onclick="apply()">&Auml;ndern</button>
25-
</div>
26-
27-
</body>
4+
<head>
5+
<title>Password</title>
6+
<meta charset="utf-8"/>
7+
<link rel="stylesheet" type="text/css" href="style.css" />
8+
<script src="shared.js"></script>
9+
<script src="password.js"></script>
10+
</head>
11+
<body onload="init();">
12+
<fieldset>
13+
<legend>Passwort</legend>
14+
<div>
15+
<label>Neues Password:</label> <input id="p1" type="password">
16+
</div>
17+
<div>
18+
<label>Best&auml;tigung:</label> <input id="p2" type="password">
19+
</div>
20+
<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>
21+
<p>ACHTUNG: Es ist nicht m&ouml;glich hier ein leeres Passwort zu setzen!</p>
22+
</fieldset>
23+
<fieldset>
24+
<legend>SSH Public Key</legend>
25+
<div>
26+
<label>SSH Public Key</label> <input id="s1">
27+
</div>
28+
<p>Der SSH Public Key dient zum sicheren Einloggen per SSH<br /></p>
29+
<p>Ein hier eingetragener SSH Public Key wird hinzugef&uuml;gt! Die bisher bereits eingetragenen bleiben ebenfalls erhalten!</p>
30+
</fieldset>
31+
<div>
32+
<button class="final-button" type="button" onclick="apply()">&Auml;ndern</button>
33+
</div>
34+
</body>
2835
</html>

Diff for: files/www/lan/password.js

+30-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11

22
function init() {
3-
$("p1").focus();
3+
$("p1").focus();
44
}
55

66
function apply()
77
{
8-
p1 = $('p1').value;
9-
p2 = $('p2').value;
8+
p1 = $('p1').value;
9+
p2 = $('p2').value;
10+
s1 = $('s1').value;
1011

11-
$('p1').value = "";
12-
$('p2').value = "";
12+
$('p1').value = "";
13+
$('p2').value = "";
14+
$('s1').value = "";
1315

14-
if(p1 != p2) {
15-
setText('msg', "(E) Die Passw&ouml;rter sind nicht identisch.");
16-
return;
17-
} else {
18-
setText('msg', "(I) Das Passwort wird ge&auml;ndert. Bitte die Seite neu laden.");
19-
}
16+
if(p1 != p2) {
17+
setText('msg', "(E) Die Passw&ouml;rter sind nicht identisch.");
18+
return;
19+
}
20+
else {
21+
if(p1 == "") {
22+
setText('msg', "Keine Passwort&auml;nderung.");
23+
}
24+
else {
25+
setText('msg', "(I) Das Passwort wird ge&auml;ndert. Bitte die Seite neu laden.");
26+
send("/cgi-bin/password", { func : "set_password", pass1 : p1, pass2 : p2 }, function(data) {
27+
setText('msg', data);
28+
});
29+
}
30+
}
2031

21-
send("/cgi-bin/password", { func : "set_password", pass1 : p1, pass2 : p2 }, function(data) {
22-
setText('msg', data);
23-
});
32+
if(s1 == "") {
33+
setText('msg', "");
34+
}
35+
else {
36+
send("/cgi-bin/sshpubkey", { func : "set_sshpubkey", sshpubkey : s1}, function(data) {
37+
setText('msg', data);
38+
});
39+
}
2440
}

0 commit comments

Comments
 (0)