I want to use Raspberry Pis to communicate collected Data via Python (Modbus TCP and RTU) scripts to a Database. These scripts are constantly running on the Pi and are connected to the Products where the data is coming from.
Consequently, we have to ship the already set up Raspberry Pi to the Customer. Now the Problem occurs, that the Database Credentials are stored in the Python Scripts running on the Raspberry Pi.
Is there a possibility to overcome this Problem?
Naive solution: Store database credentials on your server (or somewhere on internet) so every time Raspberry Pi run the script, it connect to the server to get the credentials first.
My recommended solution: Create an API (may be web API) to communicate with database and Rasp Pi only work with this API. By this way, the client side doesn't know about database's credentials and some private things you want to hide also.
Hide Database Credentials in Python Code on Raspberry Pi