File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,10 +38,20 @@ cp linux-edr.service /etc/systemd/system/
3838# Create default config directory if it doesn't exist
3939mkdir -p /etc/linux_edr
4040
41- # Copy default config if it doesn't exist
42- if [ ! -f /etc/linux_edr/config.ini ]; then
43- echo " Installing default configuration..."
44- cp linux_edr/config.ini /etc/linux_edr/
41+ # Copy default config and update with OpenAI API key
42+ echo " Installing configuration..."
43+ cp linux_edr/config.ini /etc/linux_edr/
44+
45+ # Prompt for OpenAI API key
46+ echo " "
47+ echo " Please enter your OpenAI API key (press Enter to skip):"
48+ read -r api_key
49+
50+ if [ ! -z " $api_key " ]; then
51+ # Update the config file with the API key
52+ echo " Setting OpenAI API key in config file..."
53+ sed -i " s/^api_key =.*/api_key = $api_key /" /etc/linux_edr/config.ini
54+ chmod 600 /etc/linux_edr/config.ini
4555fi
4656
4757# Reload systemd
@@ -54,4 +64,5 @@ echo ""
5464echo " To check status:"
5565echo " systemctl status linux-edr.service"
5666echo " "
57- echo " Configuration file is at /etc/linux_edr/config.ini"
67+ echo " Configuration file is at /etc/linux_edr/config.ini"
68+ echo " Note: The config file permissions are set to 600 to protect the API key"
You can’t perform that action at this time.
0 commit comments