Skip to content

Commit

Permalink
add tls connection check
Browse files Browse the repository at this point in the history
  • Loading branch information
smithclay committed Feb 29, 2024
1 parent 38fe65d commit 755df6b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
15 changes: 14 additions & 1 deletion collector/scripts/install/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SERVICE_NAME="com.servicenow.collector"
DOWNLOAD_BASE="https://github.com/lightstep/sn-collector/releases/download"

# Script Constants
PREREQS="printf sed uname tr find grep"
PREREQS="printf sed uname tr find grep curl"
TMP_DIR="${TMPDIR:-"/tmp/"}sn-collector" # Allow this to be overriden by cannonical TMPDIR env var
INSTALL_DIR="/opt/sn-collector"
SCRIPT_NAME="$0"
Expand Down Expand Up @@ -284,6 +284,18 @@ dependencies_check()
succeeded
}

check_tls_connection()
{
ingest_endpoint="ingest.lightstep.com"
banner "Checking TLS connection to $ingest_endpoint"
if echo | openssl s_client -connect $ingest_endpoint:443 > /dev/null; then
succeeded
else
failed
error_exit "$LINENO" "Could not establish a TLS connection to $ingest_endpoint"
fi
}

# This will set all installation variables
# at the beginning of the script.
setup_installation()
Expand Down Expand Up @@ -577,6 +589,7 @@ main()

setup_installation
install_package
check_tls_connection
display_results
}

Expand Down
12 changes: 12 additions & 0 deletions collector/scripts/install/install-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ failed()
error "Failed!"
}

check_tls_connection()
{
ingest_endpoint="ingest.lightstep.com"
banner "Checking TLS connection to $ingest_endpoint"
if echo | openssl s_client -connect $ingest_endpoint:443 > /dev/null; then
succeeded
else
failed
error_exit "$LINENO" "Could not establish a TLS connection to $ingest_endpoint"
fi
}

# This will set all installation variables
# at the beginning of the script.
setup_installation()
Expand Down
2 changes: 1 addition & 1 deletion collector/service/com.servicenow.collector.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
<key>StandardOutPath</key>
<string>/opt/sn-collector/collector.log</string>
<key>StandardErrorPath</key>
<string>/var/log/sn_collector.err</string>
<string>/opt/sn-collector/collector.log</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion docs/monitor-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This install approach automatically downloads dependencies and installs the coll

### Manual install for macOS

1. On the [Releases](https://github.com/lightstep/sn-collector/releases) page, download the appropriate collector `*.tar.gz` for `darwin` and your processor type. Apple Silicon processors use the `amd` binary.
1. On the [Releases](https://github.com/lightstep/sn-collector/releases) page, download the appropriate collector `*.tar.gz` for `darwin` and your processor type. Apple Silicon processors use the `arm` binary.

2. Extract the `*.tar.gz` archive.

Expand Down

0 comments on commit 755df6b

Please sign in to comment.