您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

50 行
1.0KB

  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