making the language a bit clearer, adding the 'dmesg' command, and making the script executable

This commit is contained in:
Bill Cromie 2017-03-26 15:58:18 -04:00
parent 4abab9bbc4
commit ee2ef9978f
1 changed files with 27 additions and 6 deletions

33
tools/collect_debug_info.sh Normal file → Executable file
View File

@ -14,7 +14,11 @@ fi
echo "This script produces a diagnostic log to help the maintainers" echo "This script produces a diagnostic log to help the maintainers"
echo "figure out why your Mail-in-a-Box installation isn't working the" echo "figure out why your Mail-in-a-Box installation isn't working the"
echo "way you expected it to." echo "way you expected it to."
echo
echo "It gives you the option to post this log to a *Secret* github gist"
echo "and only those you send the link to will be able to view it."
echo "If you have a github account, and you log in with your github account"
echo "you will be able to delete the secret gist."
echo echo
echo "This log will contain sensitive information about your installation" echo "This log will contain sensitive information about your installation"
echo "including, but not limited to:" echo "including, but not limited to:"
@ -25,7 +29,7 @@ echo "server security configuration"
echo "etc." echo "etc."
echo echo
echo "=====================================================================" echo "====================================================================="
echo "Please do not post this file to the internet if you are not comfortable" echo "Do not post this file to the internet if you are not comfortable"
echo "exposing this information publicly to the world forever." echo "exposing this information publicly to the world forever."
echo "=====================================================================" echo "====================================================================="
echo echo
@ -33,6 +37,9 @@ echo "Once the log has been collected, you will be given the option to post"
echo "the log to https://gist.github.com/ so that others can help you diagnose" echo "the log to https://gist.github.com/ so that others can help you diagnose"
echo "the issues with your Mail-in-a-Box installation" echo "the issues with your Mail-in-a-Box installation"
echo echo
echo "Should you decide not to post the log to a gist, it will be saved"
echo "to disk and you can scrub it before sharing it."
echo
echo "You are solely responsible for the data you choose to publish" echo "You are solely responsible for the data you choose to publish"
source /etc/mailinabox.conf # load global vars source /etc/mailinabox.conf # load global vars
@ -56,6 +63,7 @@ declare -a commands=("git -C /root/mailinabox status"
"ufw status verbose" "ufw status verbose"
"ifconfig" "ifconfig"
"lsof -i" "lsof -i"
"dmesg"
"cat /etc/hosts" "cat /etc/hosts"
"cat /etc/resolv.conf" "cat /etc/resolv.conf"
"cat /var/log/syslog" "cat /var/log/syslog"
@ -90,7 +98,10 @@ function post_gist () {
} }
# double check that the user wants to post to github. # double check that the user wants to post to github.
echo "Do You want to post your debug log on https://gist.github.com publicly?" echo "Do You want to post your debug log on https://gist.github.com?"
echo
echo "It will create a *secret* gist that you can delete later"
echo
echo "Please type 'YES' below, anything else will cancel." echo "Please type 'YES' below, anything else will cancel."
echo -n "Type YES to publish:" echo -n "Type YES to publish:"
read answer read answer
@ -101,7 +112,7 @@ if echo "$answer" | grep -q "^YES" ;then
echo "be able to delete the debug log if you do not log in." echo "be able to delete the debug log if you do not log in."
gist-paste --login gist-paste --login
# ask again, just to be sure. # ask again, just to be sure.
echo "Are you sure you want to post your debug log on https://gist.github.com publicly?" echo "Are you sure you want to post your debug log on https://gist.github.com?"
echo "Please type 'YES' below, anything else will cancel." echo "Please type 'YES' below, anything else will cancel."
echo -n "Type YES to publish:" echo -n "Type YES to publish:"
read answer read answer
@ -109,11 +120,21 @@ if echo "$answer" | grep -q "^YES" ;then
post_gist post_gist
else else
# logged in to github, but said no on the second request # logged in to github, but said no on the second request
echo "Your debug log file is here: $TMP_FILE" echo "Nothing has been posted to gist.github.com"
echo "Your debug log file is here:"
echo "$TMP_FILE"
echo
echo "You can review and edit the file to remove private information and"
echo "manually post it to gist.github.com."
fi fi
else else
post_gist post_gist
fi fi
else # said no to initial request to post to gist.github.com else # said no to initial request to post to gist.github.com
echo "Your debug log file is here: $TMP_FILE" echo "Nothing has been posted to gist.github.com"
echo "Your debug log file is here:"
echo "$TMP_FILE"
echo
echo "You can review and edit the file to remove private information and"
echo "manually post it to gist.github.com."
fi fi