v-delete-sys-ssh-jail 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # info: delete system ssh jail
  3. # options: NONE
  4. #
  5. # example: v-delete-sys-ssh-jail
  6. #
  7. # This function disables ssh jailed environment
  8. #----------------------------------------------------------#
  9. # Variables & Functions #
  10. #----------------------------------------------------------#
  11. # Includes
  12. # shellcheck source=/etc/hestiacp/hestia.conf
  13. source /etc/hestiacp/hestia.conf
  14. # shellcheck source=/usr/local/hestia/func/main.sh
  15. source $HESTIA/func/main.sh
  16. # load config file
  17. source_conf "$HESTIA/conf/hestia.conf"
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. # Perform verification if read-only mode is enabled
  22. check_hestia_demo_mode
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Unregister /usr/sbin/jailbash
  27. sed -i "/\/usr\/sbin\/jailbash/d" /etc/shells
  28. # Remove jailbash from /usr/sbin
  29. if [ -x /usr/sbin/jailbash ]; then
  30. rm -f /usr/sbin/jailbash
  31. rm -f /etc/apparmor.d/bwrap-userns-restrict
  32. service apparmor reload > /dev/null 2>&1
  33. fi
  34. #----------------------------------------------------------#
  35. # Hestia #
  36. #----------------------------------------------------------#
  37. # Logging
  38. $BIN/v-log-action "system" "Warning" "Plugins" "SSH Chroot Jail disabled."
  39. log_event "$OK" "$ARGUMENTS"
  40. exit