-
Notifications
You must be signed in to change notification settings - Fork 12
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 #838 from kernelkit/add-ssh-config
Add ssh config
- Loading branch information
Showing
35 changed files
with
719 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
#!/bin/bash | ||
# Store and convert RSA PUBLIC/PRIVATE KEYs to be able to use them in | ||
# OpenSSHd. | ||
set -e | ||
|
||
NAME="$1" | ||
DIR="$2" | ||
PUBLIC="$3" | ||
PRIVATE="$4" | ||
TMP="$(mktemp)" | ||
|
||
echo -e '-----BEGIN RSA PRIVATE KEY-----' > "$DIR/$NAME" | ||
echo "$PRIVATE" >> "$DIR/$NAME" | ||
echo -e '-----END RSA PRIVATE KEY-----' >> "$DIR/$NAME" | ||
|
||
echo -e "-----BEGIN RSA PUBLIC KEY-----" > "$TMP" | ||
echo -e "$PUBLIC" >> "$TMP" | ||
echo -e "-----END RSA PUBLIC KEY-----" >> "$TMP" | ||
|
||
ssh-keygen -i -m PKCS8 -f "$TMP" > "$DIR/$NAME.pub" | ||
chmod 0600 "$DIR/$NAME.pub" | ||
chmod 0600 "$DIR/$NAME" | ||
chown sshd:sshd "$DIR/$NAME.pub" | ||
chown sshd:sshd "$DIR/$NAME" |
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
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,24 @@ | ||
# SSH Management | ||
|
||
The default SSH hostkey is generated on first boot and is used in both | ||
SSH and NETCONF (SSH transport). Custom keys can be added to the | ||
configuration in `ietf-keystore`. The ony suuported hostkey type is | ||
RSA for now, so the private must be `ietf-crypto-types:rsa-private-key-format` and the public key | ||
`ietf-crypto-types:ssh-public-key-format` | ||
|
||
## Use your own SSH hostkeys | ||
|
||
Hostkeys can be generated with OpenSSL: | ||
```bash | ||
openssl genpkey -quiet -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -outform PEM > mykey | ||
openssl rsa -RSAPublicKey_out < mykey > mykey.pyb | ||
``` | ||
Store the keys in `ietf-keystore` _without_ the header and footer information | ||
created by OpenSSL. | ||
|
||
After the key has been stored in the keystore and given the name | ||
_mykey_ it can be added to SSH configuration: | ||
|
||
admin@example:/> configure | ||
admin@example:/config/> edit ssh | ||
admin@example:/config/ssh/> set hostkey mykey |
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
4 changes: 1 addition & 3 deletions
4
package/skeleton-init-finit/skeleton/etc/finit.d/available/sshd.conf
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,4 +1,2 @@ | ||
task <pid/syslogd> \ | ||
[S] /usr/bin/ssh-hostkeys -- Verifying SSH host keys | ||
service <task/ssh-hostkeys/success> env:-/etc/default/sshd \ | ||
service <pid/syslogd> env:-/etc/default/sshd \ | ||
[2345] /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
# SSH is now configurable, add default settings to configuration | ||
|
||
file=$1 | ||
temp=${file}.tmp | ||
|
||
jq '.["infix-services:ssh"] = { | ||
"enabled": true, | ||
"hostkey": ["genkey"], | ||
"listen": [ | ||
{"name": "ipv4", "address": "0.0.0.0", "port": 22}, | ||
{"name": "ipv6", "address": "::", "port": 22} | ||
] | ||
}' "$file" > "$temp" | ||
|
||
mv "$temp" "$file" |
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,2 @@ | ||
migratedir = $(pkgdatadir)/migrate/1.3 | ||
dist_migrate_DATA = 10-ssh-server.sh |
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,2 +1,2 @@ | ||
SUBDIRS = 1.0 1.1 1.2 | ||
SUBDIRS = 1.0 1.1 1.2 1.3 | ||
migratedir = $(pkgdatadir)/migrate |
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
Oops, something went wrong.