Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prometheus-node-exporter-lua: Added TLS support for the custom uhttpd server #25560

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
config prometheus-node-exporter-lua 'main'
option listen_interface 'loopback'
option listen_port '9100'
option cert_path 'none'
option key_path 'none'
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,55 @@ start_service() {
[ $keepalive -gt 0 ] && procd_append_param command -k $keepalive

if [ "$interface" = "*" ]; then
procd_append_param command -p $port
if [ "$cert_path" = "none" ] && [ "$key_path" = "none" ]; then
procd_append_param command -p $port
elif [ "$cert_path" = "none" ] && [ "$key_path" != "none" ]; then
procd_append_param command -p $port
elif [ "$cert_path" != "none" ] && [ "$key_path" = "none" ]; then
procd_append_param command -p $port
elif [ "$cert_path" != "none" ] && [ "$key_path" != "none" ]; then
if [ -f "$cert_path" ] && [ -f "$key_path" ]; then
procd_append_param command -C $cert_path -K $key_path -s $port
elif [ ! -f "$cert_path" ]; then
_log "No cert file found under path: $cert_path"
return 0
elif [ ! -f "$key_path" ]; then
_log "No key file found under path: $key_path"
return 0
else
_log "Error setting up TLS"
return 0
fi
else
procd_append_param command -p $port
fi
else
[ -n "$bind4" ] && procd_append_param command -p $bind4:$port
[ -n "$bind6" ] && procd_append_param command -p [$bind6]:$port
if [ "$cert_path" = "none" ] && [ "$key_path" = "none" ]; then
procd_append_param command -p $bind4:$port
procd_append_param command -p [$bind6]:$port
elif [ "$cert_path" = "none" ] && [ "$key_path" != "none" ]; then
procd_append_param command -p $bind4:$port
procd_append_param command -p [$bind6]:$port
elif [ "$cert_path" != "none" ] && [ "$key_path" = "none" ]; then
procd_append_param command -p $bind4:$port
procd_append_param command -p [$bind6]:$port
elif [ "$cert_path" != "none" ] && [ "$key_path" != "none" ]; then
if [ -f "$cert_path" ] && [ -f "$key_path" ]; then
procd_append_param command -C $cert_path -K $key_path -s $bind4:$port
procd_append_param command -C $cert_path -K $key_path -s [$bind6]:$port
elif [ ! -f "$cert_path" ]; then
_log "No cert file found under path: $cert_path"
return 0
elif [ ! -f "$key_path" ]; then
_log "No key file found under path: $key_path"
return 0
else
_log "Error setting up TLS"
return 0
fi
else
procd_append_param command -p $port
fi
fi

procd_set_param stdout 1
Expand Down
Loading