root user for db now is socket-only (one less thing for the user

to set)
This commit is contained in:
Patrick McGuire
2021-11-10 12:12:59 -05:00
parent 651c6107fe
commit 88b2d10214
5 changed files with 83 additions and 172 deletions
+64 -76
View File
@@ -87,15 +87,23 @@ The installation has finished. Press Enter to close this window."
install_birdnet_config() { install_birdnet_config() {
cat << EOF > ${my_dir}/birdnet.conf cat << EOF > ${my_dir}/birdnet.conf
################################################################################ ################################################################################
# Configuration settings for the BirdNET-Pi # # Configuration settings for BirdNET-Pi #
################################################################################ ################################################################################
#___________The four variables below are the only that are required.___________# ############ CHANGE THE LATITUDE AND LONGITUDE TO STATIC VALUES ################
## BIRDNET_USER should be the non-root user systemd should use to execute each
## service.
BIRDNET_USER=pi ## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at
## maps.google.com.
## Example: these coordinates would indicate the Eiffel Tower in Paris, France.
## LATITUDE=48.858
## LONGITUDE=2.294
## These are input as shell substitutions so that this will work out of the box.
## It guesses your latitude and longitude based off of your network information.
## THESE SHOULD BE CHANGED TO STATIC NUMBERS!!!!
LATITUDE=${LATITUDE}
LONGITUDE=${LONGITUDE}
## RECS_DIR is the location birdnet_analysis.service will look for the data-set ## RECS_DIR is the location birdnet_analysis.service will look for the data-set
## it needs to analyze. Be sure this directory is readable and writable for ## it needs to analyze. Be sure this directory is readable and writable for
@@ -103,47 +111,41 @@ BIRDNET_USER=pi
## still need to set this, as this will be where the remote directory gets ## still need to set this, as this will be where the remote directory gets
## mounted locally. ## mounted locally.
RECS_DIR=${HOME}/BirdSongs RECS_DIR=/home/pi/BirdSongs
## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at #----------------------- Web Interface User Password ------------------------#
## maps.google.com. Only go to the thousanths place for these variables #____________________The variable below sets the 'birdnet'_____________________#
## Example: these coordinates would indicate the Eiffel Tower in Paris, France. #___________________user password for the live audio stream,___________________#
## LATITUDE=48.858 #_________________web tools, system info, and processed files__________________#
## LONGITUDE=2.294
LATITUDE=${LATITUDE} ## CADDY_PWD is the plaintext password (that will be hashed) and used to access
LONGITUDE=${LONGITUDE} ## certain parts of the web interface
################################################################################ CADDY_PWD=changeme
#------------------------------ Extraction Service ---------------------------#
# Keep this EMPTY if you do not want this device to perform the extractions # #------------------------- MariaDB User Passwords ---------------------------#
#_____________The variable below sets the password for the_____________________#
#_______________________'birder' user on the MariaDB___________________________#
## DO_EXTRACTIONS is simply a setting for enabling the extraction.service. ## DB_PWD is for the 'birder' user
## Set this to Y or y to enable extractions. DB_PWD=changeme
DO_EXTRACTIONS=y #------------------------- Live Audio Stream --------------------------------#
#_____________The variable below configures/enables the live___________________#
#_____________________________audio stream.____________________________________#
################################################################################
#----------------------------- Recording Service ----------------------------#
#____________________The variable below can be set to enable __________________#
#________________________the birdnet_recording.service ________________________#
# Keep this EMPTY if you do not want this device to perform the recording. # ## ICE_PWD is the password that icecast2 will use to authenticate ffmpeg as a
## trusted source for the stream. You will never need to enter this manually
## anywhere other than here.
## DO_RECORDING is simply a setting for enabling the 24/7 ICE_PWD=changeme
## birdnet_recording.service.
## Set this to Y or y to enable recording.
DO_RECORDING=y
################################################################################
#----------------------- Web-hosting/Caddy File-server -----------------------# #----------------------- Web-hosting/Caddy File-server -----------------------#
#________The four variables below can be set to enable internet access_________# #________The four variables below can be set to enable internet access_________#
#____________to your data,(e.g., extractions, raw data, live___________________# #____________to your data,(e.g., extractions, raw data, live___________________#
#______________audio stream, BirdNET.selection.txt files)______________________# #______________audio stream, BirdNET.selection.txt files)______________________#
# Leave these EMPTY if you do not want to enable web access #
## BIRDNETPI_URL is the URL where the extractions, data-set, and live-stream ## BIRDNETPI_URL is the URL where the extractions, data-set, and live-stream
## will be web-hosted. If you do not own a domain, or would just prefer to keep ## will be web-hosted. If you do not own a domain, or would just prefer to keep
@@ -153,27 +155,7 @@ BIRDNETPI_URL=${BIRDNETPI_URL}
EXTRACTIONLOG_URL=${EXTRACTIONLOG_URL} EXTRACTIONLOG_URL=${EXTRACTIONLOG_URL}
BIRDNETLOG_URL=${BIRDNETLOG_URL} BIRDNETLOG_URL=${BIRDNETLOG_URL}
## CADDY_PWD is the plaintext password (that will be hashed) and used to access
## the "Processed" directory and live audio stream. This MUST be set if you
## choose to enable this feature.
CADDY_PWD=${CADDY_PWD}
################################################################################
#------------------------- Live Audio Stream --------------------------------#
#_____________The variable below configures/enables the live___________________#
#_____________________________audio stream.____________________________________#
# Keep this EMPTY if you do not wish to enable the live stream #
# or if this device is not doing the recording #
## ICE_PWD is the password that icecast2 will use to authenticate ffmpeg as a
## trusted source for the stream. You will never need to enter this manually
## anywhere other than here.
ICE_PWD=${ICE_PWD}
################################################################################
#------------------- Mobile Notifications via Pushed.co ---------------------# #------------------- Mobile Notifications via Pushed.co ---------------------#
#____________The two variables below enable mobile notifications_______________# #____________The two variables below enable mobile notifications_______________#
#_____________See https://pushed.co/quick-start-guide to get___________________# #_____________See https://pushed.co/quick-start-guide to get___________________#
@@ -187,6 +169,9 @@ PUSHED_APP_KEY=${PUSHED_APP_KEY}
PUSHED_APP_SECRET=${PUSHED_APP_SECRET} PUSHED_APP_SECRET=${PUSHED_APP_SECRET}
################################################################################ ################################################################################
#-------------------------------- Defaults ----------------------------------#
################################################################################
#------------------------------- NoMachine ----------------------------------# #------------------------------- NoMachine ----------------------------------#
#_____________The variable below can be set include NoMachine__________________# #_____________The variable below can be set include NoMachine__________________#
#_________________remote desktop software to be installed._____________________# #_________________remote desktop software to be installed._____________________#
@@ -201,10 +186,23 @@ PUSHED_APP_SECRET=${PUSHED_APP_SECRET}
INSTALL_NOMACHINE=y INSTALL_NOMACHINE=y
################################################################################ #
#-------------------------------- Defaults ----------------------------------# #------------------------------ Extraction Service ---------------------------#
#______The seven variables below are default settings that you (probably)______#
#__________________don't need to change at all, but can._______________________# ## DO_EXTRACTIONS is simply a setting for enabling the extraction.service.
## Set this to Y or y to enable extractions.
DO_EXTRACTIONS=y
#----------------------------- Recording Service ----------------------------#
#____________________The variable below can be set to enable __________________#
#________________________the birdnet_recording.service ________________________#
## DO_RECORDING is simply a setting for enabling the 24/7
## birdnet_recording.service.
## Set this to Y or y to enable recording.
DO_RECORDING=y
## REC_CARD is the sound card you would want the birdnet_recording.service to ## REC_CARD is the sound card you would want the birdnet_recording.service to
## use. This setting is irrelevant if you are not planning on doing data ## use. This setting is irrelevant if you are not planning on doing data
@@ -254,42 +252,32 @@ CONFIDENCE=0.7
SENSITIVITY=1.25 SENSITIVITY=1.25
################################################################################
#------------------------------ Auto-Generated ------------------------------#
#_____________________The variables below are auto-generated___________________#
#______________________________during installation_____________________________#
## CHANNELS holds the variabel that corresponds to the number of channels the ## CHANNELS holds the variabel that corresponds to the number of channels the
## sound card supports. ## sound card supports.
CHANNELS=2 CHANNELS=2
# Don't touch the variables below
## SYSTEMD_MOUNT is created from the RECS_DIR variable to comply with systemd
## mount naming requirements.
SYSTEMD_MOUNT=$(echo ${RECS_DIR#/} | tr / -).mount
## VENV is the virtual environment where the the BirdNET python build is found, ## VENV is the virtual environment where the the BirdNET python build is found,
## i.e, VENV is the virtual environment miniforge built for BirdNET. ## i.e, VENV is the virtual environment miniforge built for BirdNET.
VENV=${my_dir}/birdnet VENV=/home/pi/BirdNET-Pi/birdnet
################################################################################
#---------------------------------- Testing -----------------------------------#
#_____________These variables are for testing. Please do not touch_____________#
#_______________them if you are not testing these features.____________________#
## RECORDING_LENGTH sets the length of the recording that BirdNET-Lite will analyze.
RECORDING_LENGTH= RECORDING_LENGTH=
## EXTRACTION_LENGTH sets the length of the audio extractions that will be made
## from each BirdNET-Lite detection.
EXTRACTION_LENGTH= EXTRACTION_LENGTH=
## BIRDNET_USER should be the non-root user systemd should use to execute each
## service.
BIRDNET_USER=pi
## These are just for debugging
LAST_RUN= LAST_RUN=
THIS_RUN= THIS_RUN=
DB_PWD=${DB_PWD}
DB_ROOT_PWD=${DB_ROOT_PWD}
EOF EOF
[ -d /etc/birdnet ] || sudo mkdir /etc/birdnet [ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
sudo ln -sf ${my_dir}/birdnet.conf /etc/birdnet/birdnet.conf sudo ln -sf ${my_dir}/birdnet.conf /etc/birdnet/birdnet.conf
+2 -5
View File
@@ -31,13 +31,10 @@ LONGITUDE=
CADDY_PWD= CADDY_PWD=
ICE_PWD= ICE_PWD=
# 1. DB_PWD is the password that the system will use to access the database. Set this to # DB_PWD is the password that the system will use to access the database. Set this to
# anything you want. # anything you want.
# 2. DB_ROOT_PWD is the password that the system will use to secure the database's root
# account. Set this to anything you want.
DB_PWD= DB_PWD=
DB_ROOT_PWD=
# This section can be left alone. If you setup a Pushed.co # This section can be left alone. If you setup a Pushed.co
# mobile application, you can enter the App secret and secret # mobile application, you can enter the App secret and secret
+2 -4
View File
@@ -36,13 +36,11 @@ RECS_DIR=/home/pi/BirdSongs
CADDY_PWD=changeme CADDY_PWD=changeme
#------------------------- MariaDB User Passwords ---------------------------# #------------------------- MariaDB User Passwords ---------------------------#
#_____________The variables below set the 'birder' and 'root'__________________# #_____________The variable below sets the password for the_____________________#
#_______________________user passwords for the MariaDB_________________________# #_______________________'birder' user on the MariaDB___________________________#
## DB_PWD is for the 'birder' user ## DB_PWD is for the 'birder' user
DB_PWD=changeme DB_PWD=changeme
## DB_ROOT_PWD is for the 'root' user
DB_ROOT_PWD=changeme
#------------------------- Live Audio Stream --------------------------------# #------------------------- Live Audio Stream --------------------------------#
#_____________The variable below configures/enables the live___________________# #_____________The variable below configures/enables the live___________________#
+4 -76
View File
@@ -485,17 +485,6 @@ do_reget_birdnetpi_urls() {
fi fi
} }
do_reget_db_root_pwd() {
db_root_pwd=$(whiptail --inputbox "Please set the password the 'root' user will use to access the database." \
19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh
if [ $? -eq 0 ];then
return 0
ASK_TO_REBOOT=2
else
return 1
fi
}
do_reget_db_pwd() { do_reget_db_pwd() {
db_pwd=$(whiptail --inputbox "Please set the password the 'birder' user will use to access the database." \ db_pwd=$(whiptail --inputbox "Please set the password the 'birder' user will use to access the database." \
19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh
@@ -614,17 +603,6 @@ do_get_birdnetpi_url() {
fi fi
} }
do_get_db_root_pwd() {
db_root_pwd=$(whiptail --inputbox "Please set the password the 'root' user will use to access the database." \
19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh
if [ $? -eq 0 ];then
return 0
ASK_TO_REBOOT=2
else
return 1
fi
}
do_get_db_pwd() { do_get_db_pwd() {
db_pwd=$(whiptail --inputbox "Please set the password the 'birder' user will use to access the database." \ db_pwd=$(whiptail --inputbox "Please set the password the 'birder' user will use to access the database." \
19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh
@@ -759,56 +737,6 @@ do_advanced_reconfig_menu() {
done done
} }
do_reget_db_pwds() {
MENU=8
while [ $MENU -eq 8 ];do
if is_pi ; then
FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Reset Datbase Passwords" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"'birder' " "Set the database password for the 'birder' user" \
"'root' " "Set the database password for the 'root' user" \
3>&1 1>&2 2>&3)
else
exit
fi
RET=$?
if [ $RET -eq 1 ]; then
return 0
MENU=0
elif [ $RET -eq 0 ]; then
case "$FUN" in
*bird*) do_reget_db_pwd;;
*root*) do_reget_db_root_pwd;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
fi
done
}
do_get_db_pwds() {
MENU=7
while [ $MENU -eq 7 ];do
if is_pi ; then
FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Set Datbase Passwords" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"'birder' " "Set the database password for the 'birder' user" \
"'root' " "Set the database password for the 'root' user" \
3>&1 1>&2 2>&3)
else
exit
fi
RET=$?
if [ $RET -eq 1 ]; then
return 0
MENU=0
elif [ $RET -eq 0 ]; then
case "$FUN" in
*bird*) do_get_db_pwd;;
*root*) do_get_db_root_pwd;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
fi
done
}
do_interface_menu() { do_interface_menu() {
MENU=6 MENU=6
while [ $MENU -eq 6 ];do while [ $MENU -eq 6 ];do
@@ -911,7 +839,7 @@ do_reconfig_birdnet_menu() {
"Latitude " "Set the latitude your system should use" \ "Latitude " "Set the latitude your system should use" \
"Longitude" "Set the longitude your system should use" \ "Longitude" "Set the longitude your system should use" \
"Caddy Password" "Set the web interface password" \ "Caddy Password" "Set the web interface password" \
"Database Passwords" "Set the passwords the MariaDB will use" \ "Database Password" "Set the password BirdNET-Pi will use to access the DB" \
"Advanced Settings" "Sensitivity, Overlap, Confidence, URLs" \ "Advanced Settings" "Sensitivity, Overlap, Confidence, URLs" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
else else
@@ -926,7 +854,7 @@ do_reconfig_birdnet_menu() {
Lat*) do_reget_lat;; Lat*) do_reget_lat;;
Lon*) do_reget_lon;; Lon*) do_reget_lon;;
Cad*) do_reget_caddy_pwd;; Cad*) do_reget_caddy_pwd;;
Data*) do_reget_db_pwds;; Data*) do_reget_db_pwd;;
Advanced*) do_advanced_reconfig_menu;; Advanced*) do_advanced_reconfig_menu;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
@@ -943,7 +871,7 @@ do_config_birdnet_menu() {
"Longitude" "Set the longitude your system should use" \ "Longitude" "Set the longitude your system should use" \
"Caddy Password" "Set the web interface password" \ "Caddy Password" "Set the web interface password" \
"IceCast2 Password" "Set the IceCast2 password" \ "IceCast2 Password" "Set the IceCast2 password" \
"Database Passwords" "Set the passwords the MariaDB will use" \ "Database Password" "Set the password BirdNET-Pi will use to access the DB" \
"Set Custom URLS" "Designate custom URLs for the web services if you've set that up" \ "Set Custom URLS" "Designate custom URLs for the web services if you've set that up" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
else else
@@ -959,7 +887,7 @@ do_config_birdnet_menu() {
Lon*) do_get_lon;; Lon*) do_get_lon;;
Cad*) do_get_caddy_pwd;; Cad*) do_get_caddy_pwd;;
Ice*) do_get_ice_pwd;; Ice*) do_get_ice_pwd;;
Data*) do_get_db_pwds;; Data*) do_get_db_pwd;;
Set*) do_get_birdnetpi_url; do_get_birdnetlog_url; do_get_extractionlog_url;; Set*) do_get_birdnetpi_url; do_get_birdnetlog_url; do_get_extractionlog_url;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
+2 -2
View File
@@ -10,8 +10,8 @@ source /etc/birdnet/birdnet.conf
mysql_secure_installation << EOF mysql_secure_installation << EOF
y y
${DB_ROOT_PWD} n
${DB_ROOT_PWD} y
y y
y y
y y