Skip to content

Instantly share code, notes, and snippets.

@aasmith
Last active December 1, 2019 22:36
Show Gist options
  • Save aasmith/8d6a1539acdb4f99484b075b0816c11b to your computer and use it in GitHub Desktop.
Save aasmith/8d6a1539acdb4f99484b075b0816c11b to your computer and use it in GitHub Desktop.
Set custom sshd listen-address with ip:port on Vyatta / EdgeOS
# Replace /opt/vyatta/share/vyatta-cfg/templates/service/ssh/listen-address/node.def
multi:
type: txt
help: Local addresses SSH service should listen on
val_help: ipv4: IP address to listen for incoming connections
val_help: ipv6: IPv6 address to listen for incoming connections
val_help: any; IP address with port, ip:port
create: sudo sed -i -e '/^Port/a \
ListenAddress $VAR(@)' /etc/ssh/sshd_config
delete: sudo sed -i -e '/^ListenAddress $VAR(@)$/d' /etc/ssh/sshd_config
# By default, the node def doesn't allow a ListenAddress entry in
# sshd_config of the format ip:port. When trying to set that format,
# an error is given: "The specified configuration node is not valid".
# To fix this, Change the node def in the attached file (/opt/vyatta/share/vyatta-cfg/templates/service/ssh/listen-address/node.def),
# and then follow the configure steps here.
configure
# add new defs with ip:port
set service ssh listen-address 192.168.0.1:22
set service ssh listen-address 0.0.0.0:11122
# confirm settings
show service ssh
commit
# verify ssh is listening on the specified port:ip
netstat -ltn
# make permanent, and quit
save
exit
# probably reboot...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment