From 4c59aa22c03b7c3416605defeddda915eb3cd8b8 Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Wed, 15 Jan 2025 13:58:33 +0800 Subject: [PATCH] Add initial project setup for TLS Checker with Prettier integration - Created a new README.md file outlining the features, installation, and usage of the TLS Checker application. - Added package.json and package-lock.json to manage Prettier as a development dependency for code formatting. - Updated .gitignore to exclude node_modules and the new tls-checker directory. This commit establishes the foundational documentation and development environment for the TLS Checker application, enhancing code quality and usability. --- .gitignore | 2 ++ README.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 28 +++++++++++++++ package.json | 5 +++ 4 files changed, 126 insertions(+) create mode 100644 README.md create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 9193cf5..bd1cc2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.pem *.crt *.key +node_modules +tls-checker diff --git a/README.md b/README.md new file mode 100644 index 0000000..5891fa1 --- /dev/null +++ b/README.md @@ -0,0 +1,91 @@ +# TLS Checker + +A command-line tool for testing TLS connections with both HTTP and RabbitMQ servers. + +## Features + +- HTTP server with TLS support +- RabbitMQ server with TLS support (using Docker) +- HTTP client for testing TLS connections +- AMQP client for testing RabbitMQ TLS connections +- Configurable via command line flags or config file + +## Installation + +### Prerequisites + +- Go 1.19 or later +- Docker (for RabbitMQ server functionality) + +### Installing from source + +```bash +go install https://github.com/frgrisk/tls-checker@latest +``` + +## Usage + +### Running HTTP Server + +```bash +tls-checker server --cert cert.pem --key key.pem --addr localhost:8443 +``` + +### Running RabbitMQ Server + +```bash +tls-checker server --rabbitmq --cert cert.pem --key key.pem +``` + +### Testing HTTP Connection + +```bash +tls-checker client --ca rootCA.pem --addr localhost:8443 +``` + +### Testing RabbitMQ Connection + +```bash +tls-checker client --rabbitmq --ca rootCA.pem --addr localhost:5671 +``` + +## Configuration + +Configuration can be provided via command-line flags or a config file (`$HOME/.tlsapp.yaml`). + +### Command-line Flags + +- `--config`: Path to config file (default: `$HOME/.tlsapp.yaml`) +- `--cert`: Path to certificate file (default: `cert.pem`) +- `--key`: Path to private key file (default: `key.pem`) +- `--ca`: Path to root CA certificate (default: `rootCA.pem`) +- `--addr`: Address to serve on or connect to (default: `localhost:8443`) + +### Server-specific Flags + +- `--rabbitmq`: Run RabbitMQ server instead of HTTP server + +### Config File Format + +```yaml +cert: "cert.pem" +key: "key.pem" +ca: "rootCA.pem" +addr: "localhost:8443" +``` + +## RabbitMQ Server Details + +When running the RabbitMQ server: + +- AMQPS port: 5671 +- Management UI: + - HTTP: http://localhost:15672 + - HTTPS: https://localhost:15671 +- Default credentials: guest/guest + +## Security Notes + +- The tool uses TLS 1.2+ for secure communications +- Certificate verification is enabled by default +- RabbitMQ server is run in a Docker container with proper TLS configuration diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..deaf5fb --- /dev/null +++ b/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "tls-checker", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "prettier": "3.4.2" + } + }, + "node_modules/prettier": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6b95573 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "prettier": "3.4.2" + } +}