From eb33c777395e1bf2815f3289f8b08dee1fc2366e Mon Sep 17 00:00:00 2001 From: Pierre Prinetti Date: Fri, 6 Sep 2024 09:41:57 +0200 Subject: [PATCH] Rename to openstack-proxy --- .gitignore | 6 +++--- Makefile | 4 ++-- README.md | 24 +++++++++++------------ cmd/{osp-mitm => openstack-proxy}/main.go | 12 ++++++------ go.mod | 4 ++-- go.sum | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) rename cmd/{osp-mitm => openstack-proxy}/main.go (80%) diff --git a/.gitignore b/.gitignore index 43f3547..7a813a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -cert.pem -key.pem -osp-mitm +/cert.pem +/key.pem +/openstack-proxy diff --git a/Makefile b/Makefile index 3863cf5..94de90d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -osp-mitm: cmd/osp-mitm pkg/proxy - go build ./cmd/osp-mitm +openstack-proxy: cmd/openstack-proxy pkg/proxy + go build ./cmd/openstack-proxy test: test-unit test-integration .PHONY: test diff --git a/README.md b/README.md index cdd3a26..6eae3ea 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ -# openstack-mitm +# openstack-proxy -Proxies calls to the OpenStack API, exposing http or https with a provided certificate. +`openstack-proxy` proxies calls to OpenStack, exposing the OpenStack API locally over http or https with a provided certificate. All URLs in the OpenStack catalog are rewritten to point to the proxy itself, which will properly reverse-proxy them to the original URL. ## Use locally -Build with `go build ./cmd/osp-mitm`. +Build with `go build ./cmd/openstack-proxy`. -`osp-mitm` will parse a `clouds.yaml` file at the known locations, similar to what python-openstackclient does. +`openstack-proxy` will parse a `clouds.yaml` file at the known locations, similar to what python-openstackclient does. By default the server will listen on localhost on port 13000. **Configuration:** -* `--url `: URL osp-mitm will be reachable at. Default: `http://locahost:13000` -* `--cert `: path of the local PEM-encoded HTTPS certificate file. Mandatory if the scheme of --url is HTTPS. -* `--key `: path of the local PEM-encoded HTTPS certificate key file. Mandatory if the scheme of --url is HTTPS. -* `-o `: Location where to write a new `clouds.yaml` that points to the osp-mitm instance. +* `--url `: the address this proxy will be reachable at. Default: `http://locahost:13000` +* `--cert `: path of the local PEM-encoded HTTPS certificate file. Mandatory if the scheme of --url is HTTPS +* `--key `: path of the local PEM-encoded HTTPS certificate key file. Mandatory if the scheme of --url is HTTPS +* `-o `: location where to write a new `clouds.yaml` that points to the openstack-proxy instance ## Examples @@ -24,19 +24,19 @@ By default the server will listen on localhost on port 13000. ```shell export OS_CLOUD=openstack -./osp-mitm -o mitm-clouds.yaml +./openstack-proxy -o proxied-clouds.yaml ``` ```shell -export OS_CLIENT_CONFIG_FILE=./mitm-clouds.yaml +export OS_CLIENT_CONFIG_FILE=./proxied-clouds.yaml openstack server list ``` ### On the network, with HTTPS ```shell -./osp-mitm \ +./openstack-proxy \ --url https://myserver.example.com:13000 \ --cert /var/run/osp-cert.pem \ --key /var/run/osp-key.pem' \ - -o mitm-clouds.yaml + -o proxied-clouds.yaml ``` diff --git a/cmd/osp-mitm/main.go b/cmd/openstack-proxy/main.go similarity index 80% rename from cmd/osp-mitm/main.go rename to cmd/openstack-proxy/main.go index e8aa720..850c5ba 100644 --- a/cmd/osp-mitm/main.go +++ b/cmd/openstack-proxy/main.go @@ -25,8 +25,8 @@ import ( "github.com/gophercloud/gophercloud/v2/openstack/config/clouds" - "github.com/pierreprinetti/openstack-mitm/pkg/cloudout" - "github.com/pierreprinetti/openstack-mitm/pkg/proxy" + "github.com/pierreprinetti/openstack-proxy/pkg/cloudout" + "github.com/pierreprinetti/openstack-proxy/pkg/proxy" ) var ( @@ -44,10 +44,10 @@ func init() { outputCloudPath string ) - flag.StringVar(&mitmURLstring, "url", "http://localhost:13000", "The address this MITM proxy will be reachable at") - flag.StringVar(&tlsCertPath, "cert", "", "Path to the PEM-encoded TLS certificate") - flag.StringVar(&tlsKeyPath, "key", "", "Path to the PEM-encoded TLS certificate private key") - flag.StringVar(&outputCloudPath, "o", "", "Path of the clouds.yaml file that points to this MITM proxy (optional)") + flag.StringVar(&mitmURLstring, "url", "http://localhost:13000", "The address this proxy will be reachable at") + flag.StringVar(&tlsCertPath, "cert", "", "Path of the local PEM-encoded HTTPS certificate file. Mandatory if the scheme of --url is HTTPS") + flag.StringVar(&tlsKeyPath, "key", "", "Path of the local PEM-encoded HTTPS certificate key file. Mandatory if the scheme of --url is HTTPS") + flag.StringVar(&outputCloudPath, "o", "", "Location where to write a new cloud credentials file that points to the openstack-proxy instance (optional)") flag.Parse() var err error diff --git a/go.mod b/go.mod index 7cc17d9..e1bff80 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ -module github.com/pierreprinetti/openstack-mitm +module github.com/pierreprinetti/openstack-proxy go 1.22 require ( - github.com/gofrs/uuid/v5 v5.2.0 + github.com/gofrs/uuid/v5 v5.3.0 github.com/gophercloud/gophercloud/v2 v2.1.0 ) diff --git a/go.sum b/go.sum index a5d71b6..c15fe2b 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM= -github.com/gofrs/uuid/v5 v5.2.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= +github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= +github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gophercloud/gophercloud/v2 v2.1.0 h1:91p6c+uMckXyx39nSIYjDirDBnPVFQq0q1njLNPX+NY= github.com/gophercloud/gophercloud/v2 v2.1.0/go.mod h1:f2hMRC7Kakbv5vM7wSGHrIPZh6JZR60GVHryJlF/K44= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=