Skip to content

Commit

Permalink
Rename to openstack-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreprinetti committed Sep 6, 2024
1 parent cb9539a commit eb33c77
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cert.pem
key.pem
osp-mitm
/cert.pem
/key.pem
/openstack-proxy
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# 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>`: URL osp-mitm will be reachable at. Default: `http://locahost:13000`
* `--cert <path>`: path of the local PEM-encoded HTTPS certificate file. Mandatory if the scheme of --url is HTTPS.
* `--key <path>`: path of the local PEM-encoded HTTPS certificate key file. Mandatory if the scheme of --url is HTTPS.
* `-o <path>`: Location where to write a new `clouds.yaml` that points to the osp-mitm instance.
* `--url <url>`: the address this proxy will be reachable at. Default: `http://locahost:13000`
* `--cert <path>`: path of the local PEM-encoded HTTPS certificate file. Mandatory if the scheme of --url is HTTPS
* `--key <path>`: path of the local PEM-encoded HTTPS certificate key file. Mandatory if the scheme of --url is HTTPS
* `-o <path>`: location where to write a new `clouds.yaml` that points to the openstack-proxy instance

## Examples

### Local server

```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
```
12 changes: 6 additions & 6 deletions cmd/osp-mitm/main.go → cmd/openstack-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down

0 comments on commit eb33c77

Please sign in to comment.