v_list_ssl_certificates 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # info: listing ssl certificates
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. format="${2-shell}"
  9. limit="${3-1000}"
  10. offset="${4-1}"
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_FUNC/shared_func.sh
  14. source $V_FUNC/cert_func.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking args
  19. check_args '1' "$#" 'user [format] [limit] [offset]'
  20. # Checking argument format
  21. format_validation 'user' 'limit' 'offset'
  22. # Checking user
  23. is_user_valid
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Listing domains
  28. case $format in
  29. json) cert_json_list ;;
  30. shell) cert_shell_list | column -t ;;
  31. *) check_args '1' "0" 'user [format] [limit] [offset]'
  32. esac
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_event 'system' "$V_EVENT"
  38. exit $OK