Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

1160-openssh-server 1.0KB

8 lat temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. ## live-config(7) - System Configuration Components
  3. ## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
  4. ##
  5. ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
  6. ## This is free software, and you are welcome to redistribute it
  7. ## under certain conditions; see COPYING for details.
  8. #set -e
  9. Init ()
  10. {
  11. # Checking if package is installed or already configured
  12. if [ ! -e /var/lib/dpkg/info/openssh-server.list ] || \
  13. [ -e /var/lib/live/config/openssh-server ]
  14. then
  15. exit 0
  16. fi
  17. echo -n " openssh-server"
  18. }
  19. Config ()
  20. {
  21. for _PROTOCOL in dsa rsa ecdsa ed25519
  22. do
  23. if [ ! -e /etc/ssh/ssh_host_${_PROTOCOL}_key ] &&
  24. grep -qs ssh_host_${_PROTOCOL}_key /etc/ssh/sshd_config
  25. then
  26. ssh-keygen -q -f /etc/ssh/ssh_host_${_PROTOCOL}_key -N "" -t ${_PROTOCOL}
  27. _SSH="true"
  28. fi
  29. done
  30. sed -i -e 's|#\(PasswordAuthentication\) yes|\1 no|' /etc/ssh/sshd_config
  31. case "${_SSH}" in
  32. true)
  33. # Creating state file
  34. touch /var/lib/live/config/openssh-server
  35. ;;
  36. esac
  37. }
  38. Init
  39. Config