Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default ssh port configurable #466

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ The following environment variables are supported:
public key authentication. Note that if SSH is not enabled this will take
effect when SSH becomes enabled.

* `SSH_PORT` (Default: `22`)

* `STAGE_LIST` (Default: `stage*`)

If set, then instead of working through the numeric stages in order, this list will be followed. For example setting to `"stage0 stage1 mystage stage2"` will run the contents of `mystage` before stage2. Note that quotes are needed around the list. An absolute or relative path can be given for stages outside the pi-gen directory.
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export WPA_PASSWORD
export WPA_COUNTRY
export ENABLE_SSH="${ENABLE_SSH:-0}"
export PUBKEY_ONLY_SSH="${PUBKEY_ONLY_SSH:-0}"
export SSH_PORT

export LOCALE_DEFAULT="${LOCALE_DEFAULT:-en_GB.UTF-8}"

Expand Down
4 changes: 4 additions & 0 deletions stage2/01-sys-tweaks/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [ "${PUBKEY_ONLY_SSH}" = "1" ]; then
s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' "${ROOTFS_DIR}"/etc/ssh/sshd_config
fi

if [ -n "${SSH_PORT}" ]; then
sed -i "s/#Port 22/Port ${SSH_PORT}/" "${ROOTFS_DIR}/etc/ssh/sshd_config"
fi

on_chroot << EOF
systemctl disable hwclock.sh
systemctl disable nfs-common
Expand Down