Skip to content
Merged
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
115 changes: 81 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,42 @@
</a>
</p>

**HTTPS Wrench** is a Golang CLI program to make HTTPS requests based on a YAML configuration file.
**HTTPS Wrench** was born from the desire of a disposable Bash script to become a reliable tool
for mechanics of the World Wide Web.
`https-wrench` will, one day, take the place of `curl` in the hearts and the eyes of whoever is about
to migrate a DNS record from a webserver to a load balancer, reverse proxy, Ingress Gateway,
CloudFront distribution.
**HTTPS Wrench** is a CLI program to make Yaml defined HTTPS requests and to
inspect x.509 certificates and keys.\
**HTTPS Wrench** was born from the desire of a disposable Bash script to become
a reliable tool for mechanics of the World Wide Web.\
`https-wrench` will, one day, take the place of `curl` in the hearts and the
eyes of whoever is about to migrate a DNS record from a webserver to a load
balancer, reverse proxy, Ingress Gateway, CloudFront distribution.

## How to use

Check the help:

```bash
❯ https-wrench -h
HTTPS Wrench, a tool to make HTTPS requests based on a YAML configuration file

HTTPS Wrench is a tool to make HTTPS requests according to a Yaml configuration file and to inspect x.509 certificates and keys.

https-wrench has two subcommands: requests and certinfo.

requests is the subcommand that does HTTPS requests according to the configuration provided
by the --config flag.

certinfo is a subcommand that reads information from PEM encoded x.509 certificates and keys. The certificates
can be read from local files or TLS enabled endpoints.

certinfo can compare public keys extracted from certificates and private keys to check if they match.

HTTPS Wrench is distributed with an open source license and available at the following address:
https://github.com/xenOs76/https-wrench

Usage:
https-wrench [flags]
https-wrench [command]

Available Commands:
certinfo Show info about PEM certificates and keys
certinfo Shows information about x.509 certificates and keys
completion Generate the autocompletion script for the specified shell
help Help about any command
requests Make HTTPS requests defined in the YAML configuration file
Expand All @@ -45,8 +60,9 @@ Use "https-wrench [command] --help" for more information about a command.
```

Generate a sample config file:

```bash
https-wrench requests --show-sample-config > sample-wrench.yaml
https-wrench requests --show-sample-config > https-wrench-sample-config.yaml
```

<details>
Expand Down Expand Up @@ -99,53 +115,69 @@ requests:

</details>


Make the HTTPS requests defined in the YAML file:

```bash
https-wrench requests --config sample-wrench.yaml
https-wrench requests --config https-wrench-sample-config.yaml
```

<details>
<summary>Output of the commands</summary>

The output should look like this:
Sample output of the commands:

![HTTPS Wrench - sample output](./assets/img/https-wrench-demo-sample-conf.gif "HTTPS Wrench - sample config output")
<details>
<summary>HTTPS Wrench requests, (long) sample configuration output</summary>
![HTTPS Wrench requests - sample config output](/assets/img/https-wrench_requests_sample-config.png "HTTPS Wrench - sample config output")
</details>

Or like this, if you customize one of the files in the [examples](./assets/examples/https-wrench-k3s.yaml) folder:
<details>
<summary>HTTPS Wrench requests, sample requests against a K3s cluster</summary>
![HTTPS Wrench - k3s output](/assets/img/https-wrench_requests_k3s.png "HTTPS Wrench - K3s requests output")
</details>

![HTTPS Wrench - k3s output](./assets/img/https-wrench-demo-k3s-example.gif "HTTPS Wrench - K3s requests output")
<details>
<summary>HTTPS Wrench certinfo, certificate and key</summary>
![HTTPS Wrench certinfo - certificate and key](/assets/img/https-wrench_certinfo_cert_and_key.png "HTTPS Wrench certinfo - certificate and key")
</details>

<details>
<summary>HTTPS Wrench certinfo, TLS Endpoint</summary>
![HTTPS Wrench certinfo - TLS Endpoint](/assets/img/https-wrench_certinfo_tls_endpoint.png "HTTPS Wrench certinfo - TLS Endpoint")
</details>

## How to install

### Go install

HTTPS Wrench is "go gettable", so it can be installed with the following command when having a proper `go` setup:
HTTPS Wrench is "go gettable", so it can be installed with the following command
when having a proper `go` setup:

```bash
go install github.com/xenos76/https-wrench@latest
```

### Manual download

Release binaries and DEB, RPM, APK packages can be downloaded from the [repo's releases section](https://github.com/xenOs76/https-wrench/releases).
Binaries and packages are built for Linux and MacOS, `amd64` and `arm64`.
Release binaries and DEB, RPM, APK packages can be downloaded from the
[repo's releases section](https://github.com/xenOs76/https-wrench/releases).\
Binaries and packages are built for Linux and MacOS, `amd64` and `arm64`.
Comment on lines +159 to +161
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor: Use "macOS" instead of "MacOS".

Per Apple's official branding, the operating system name is styled as "macOS" (lowercase "m", capital "OS").

Suggested fix
 Release binaries and DEB, RPM, APK packages can be downloaded from the
 [repo's releases section](https://github.com/xenOs76/https-wrench/releases).\
-Binaries and packages are built for Linux and MacOS, `amd64` and `arm64`.
+Binaries and packages are built for Linux and macOS, `amd64` and `arm64`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Release binaries and DEB, RPM, APK packages can be downloaded from the
[repo's releases section](https://github.com/xenOs76/https-wrench/releases).\
Binaries and packages are built for Linux and MacOS, `amd64` and `arm64`.
Release binaries and DEB, RPM, APK packages can be downloaded from the
[repo's releases section](https://github.com/xenOs76/https-wrench/releases).\
Binaries and packages are built for Linux and macOS, `amd64` and `arm64`.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~161-~161: The operating system from Apple is written “macOS”.
Context: ...es and packages are built for Linux and MacOS, amd64 and arm64. ### APT Configu...

(MAC_OS)

🤖 Prompt for AI Agents
In @README.md around lines 159 - 161, Update the README sentence that currently
reads "Binaries and packages are built for Linux and MacOS, `amd64` and
`arm64`." to use Apple's official casing by replacing "MacOS" with "macOS" so it
reads "Binaries and packages are built for Linux and macOS, `amd64` and
`arm64`."


### APT

Configure the repo the following way:

```bash
echo "deb [trusted=yes] https://repo.os76.xyz/apt stable main" | sudo tee /etc/apt/sources.list.d/os76.list
```
then:

then:

```bash
sudo apt-get update && sudo apt-get install -y https-wrench
```

### YUM

Configure the repo the following way:

```bash
echo '[os76]
name=OS76 Yum Repo
Expand All @@ -154,54 +186,67 @@ enabled=1
gpgcheck=0
repo_gpgcheck=0' | sudo tee /etc/yum.repos.d/os76.repo
```
then:

then:

```bash
sudo yum install https-wrench
```

### Docker image

Generate the config:
Generate the config:

```bash
docker run --rm ghcr.io/xenos76/https-wrench:latest -h

docker run --rm ghcr.io/xenos76/https-wrench:latest --show-sample-config > sample-wrench.yaml
```

Run the `requests` command:
Run the `requests` command:

```bash
docker run -v $(pwd)/sample-wrench.yaml:/https-wrench.yaml --rm ghcr.io/xenos76/https-wrench:latest --config /https-wrench.yaml requests
Comment on lines +198 to 209
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent sample config filename in Docker instructions.

Line 65 uses https-wrench-sample-config.yaml as the new sample config filename, but line 203 still references sample-wrench.yaml. This inconsistency could confuse users following the documentation.

Suggested fix for consistency
 docker run --rm ghcr.io/xenos76/https-wrench:latest -h

-docker run --rm ghcr.io/xenos76/https-wrench:latest --show-sample-config > sample-wrench.yaml
+docker run --rm ghcr.io/xenos76/https-wrench:latest requests --show-sample-config > https-wrench-sample-config.yaml

Run the requests command:

-docker run  -v $(pwd)/sample-wrench.yaml:/https-wrench.yaml  --rm ghcr.io/xenos76/https-wrench:latest --config /https-wrench.yaml requests
+docker run -v $(pwd)/https-wrench-sample-config.yaml:/https-wrench.yaml --rm ghcr.io/xenos76/https-wrench:latest requests --config /https-wrench.yaml

Note: The --show-sample-config flag likely belongs to the requests subcommand based on line 65, and the requests subcommand should come before --config in the run command.

🤖 Prompt for AI Agents
In @README.md around lines 198 - 209, The Docker instructions use two different
sample config filenames (sample-wrench.yaml vs https-wrench-sample-config.yaml)
and place the --show-sample-config flag at the top-level; update the examples to
use a single filename (prefer https-wrench-sample-config.yaml everywhere), move
--show-sample-config to be invoked as part of the requests subcommand (e.g.,
docker run ... ghcr.io/xenos76/https-wrench:latest requests --show-sample-config
> https-wrench-sample-config.yaml), and adjust the run line to mount that same
https-wrench-sample-config.yaml and put the requests subcommand before --config
(e.g., docker run -v $(pwd)/https-wrench-sample-config.yaml:/https-wrench.yaml
--rm ghcr.io/xenos76/https-wrench:latest requests --config /https-wrench.yaml).

```

### Homebrew
### Homebrew

Add Os76 Homebrew repository:

Add Os76 Homebrew repository:
```bash
brew tap xenos76/tap
```

Install `https-wrench`:
Install `https-wrench`:

```bash
brew install --casks https-wrench
```
Comment on lines +220 to 224
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Homebrew brew install --cask vs --casks syntax documentation

💡 Result:

Short answer: use --cask (singular). The official brew manpage and Homebrew Cask docs show the flag as --cask (and the old brew cask subcommand was merged into brew); there is no documented --casks option. [1][2]

Sources:

  • brew manpage (install / --cask). [1]
  • Homebrew Cask / Cask Cookbook (installation examples use --cask). [2]

Incorrect Homebrew install syntax.

The --casks flag is not valid for brew install. Use --cask (singular) if installing a cask: brew install --cask https-wrench, or omit the flag entirely if it's a formula: brew install https-wrench.

Suggested fix (assuming it's a formula)
 Install `https-wrench`:

 ```bash
-brew install --casks https-wrench
+brew install https-wrench
🤖 Prompt for AI Agents
In @README.md around lines 220 - 224, The Homebrew install command in the README
uses the invalid flag `--casks`; update the install instruction for
`https-wrench` to use the correct syntax — either remove the flag (for a
formula) or use the singular `--cask` (for a cask). Replace the line containing
`brew install --casks https-wrench` with the appropriate `brew install
https-wrench` or `brew install --cask https-wrench` depending on whether
`https-wrench` is a formula or cask.


### Nix/NUR

Nix users can use the following Nur repository to access `https-wrench`: [https://github.com/xenOs76/nur-packages](https://github.com/xenOs76/nur-packages).
The repository is not listed yet in the general [Nix User Repository](https://github.com/nix-community/NUR) so the following methods can be used to install the package.
Nix users can use the following Nur repository to access `https-wrench`:
[https://github.com/xenOs76/nur-packages](https://github.com/xenOs76/nur-packages).\
The repository is not listed yet in the general
[Nix User Repository](https://github.com/nix-community/NUR) so the following
methods can be used to install the package.

Set a Nix channel:

Set a Nix channel:
```bash
nix-channel --add https://github.com/xenos76/nur-packages/archive/main.tar.gz nur-os76
nix-channel --update
```

and add the package to a Nix shell:
and add the package to a Nix shell:

```bash
nix-shell -p '(import <nur-os76> { pkgs = import <nixpkgs> {}; }).https-wrench'
```

Or use a `flake.nix` like the one from the [nix-shell](/assets/examples/nix-shell) example to achieve a similar result:
Or use a `flake.nix` like the one from the
[nix-shell](/assets/examples/nix-shell) example to achieve a similar result:

```nix
{
description = "Flake to fetch https-wrench from xenos76's NUR repo";
Expand Down Expand Up @@ -243,4 +288,6 @@ Or use a `flake.nix` like the one from the [nix-shell](/assets/examples/nix-shel
}
```

NixOS users could use a [flake like this](https://raw.githubusercontent.com/xenOs76/nixos-configs/refs/heads/main/flake.nix) to fetch the package.
NixOS users could use a
[flake like this](https://raw.githubusercontent.com/xenOs76/nixos-configs/refs/heads/main/flake.nix)
to fetch the package.
18 changes: 0 additions & 18 deletions assets/examples/vhs/https-wrench-demo-k3s-example.tape

This file was deleted.

21 changes: 0 additions & 21 deletions assets/examples/vhs/https-wrench-demo-sample-conf.tape

This file was deleted.

Binary file removed assets/img/https-wrench-demo-k3s-example.gif
Binary file not shown.
Binary file removed assets/img/https-wrench-demo-sample-conf.gif
Binary file not shown.
Binary file removed assets/img/https-wrench-logo.jpg
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/https-wrench_requests_k3s.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions cmd/certinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var (

var certinfoCmd = &cobra.Command{
Use: "certinfo",
Short: "Shows information about PEM certificates and keys",
Short: "Shows information about x.509 certificates and keys",
Long: `
HTTPS Wrench certinfo: shows information about PEM certificates and keys.
HTTPS Wrench certinfo: shows information about PEM encoded x.509 certificates and keys.

https-wrench certinfo can fetch certificates from a TLS endpoint, read from a PEM bundle file, and check if a
private key matches any of the certificates.
Expand Down
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ var (

var rootCmd = &cobra.Command{
Use: "https-wrench",
Short: "HTTPS Wrench, a tool to make HTTPS requests based on a YAML configuration file",
Short: "HTTPS Wrench, a tool to make Yaml defined HTTPS requests and inspect x.509 certificates and keys",
Long: `
HTTPS Wrench is mainly a tool to make HTTPS requests based on a YAML configuration file.
HTTPS Wrench is a tool to make HTTPS requests according to a Yaml configuration file and to inspect x.509 certificates and keys.

https-wrench has two subcommands: requests and certinfo.

requests is the subcommand that does HTTPS requests according to the configuration provided
by the --config flag.

certinfo is a subcommand that reads information from PEM certificates and keys. The certificates
certinfo is a subcommand that reads information from PEM encoded x.509 certificates and keys. The certificates
can be read from local files or TLS enabled endpoints.

certinfo can compare public keys extracted from certificates and private keys to check if they match.
Expand Down
Loading