Skip to content

Commit 94c43eb

Browse files
committed
improved readme and output
1 parent 79be2f4 commit 94c43eb

3 files changed

Lines changed: 34 additions & 21 deletions

File tree

README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,47 +39,56 @@ iap_support_email = "[email protected]"
3939
## deploying the IAP proxy
4040
To deploy the IAP proxy for GKE, type:
4141

42-
```
43-
$ git clone https://github.com/binxio/simple-iap-proxy.git
44-
$ cp .auto.tfvars simple-iap-proxy/terraform
45-
$ terraform init
46-
$ terraform apply
42+
```sh
43+
git clone https://github.com/binxio/simple-iap-proxy.git
44+
cp .auto.tfvars simple-iap-proxy/terraform
45+
terraform init
46+
terraform apply
4747
```
4848

4949
After the apply, the required IAP proxy command is printed:
5050
```
5151
iap_proxy_command = <<EOT
52-
simple-iap-proxy client \
52+
simple-iap-proxy gke-client \
5353
--target-url https://iap-proxy.google.binx.dev \
5454
--iap-audience 712731707077-j9onig1ofcgle7iogv8fceu04v8hriuv.apps.googleusercontent.com \
55-
--service-account iap-proxy-accessor@speeltuin-mvanholsteijn.iam.gserviceaccount.com
55+
--service-account iap-proxy-accessor@speeltuin-mvanholsteijn.iam.gserviceaccount.com \
56+
--key-file server.key \
57+
--certificate-file server.crt
5658
5759
EOT
5860
```
5961

6062
## start the IAP proxy
6163
To start the IAP proxy, you need a certificate. To generate a self-signed certificate, type:
6264

63-
```shell-terminal
64-
$ openssl genrsa -out server.key 2048
65-
$ openssl req -new -x509 -sha256 \
65+
```bash
66+
openssl genrsa -out server.key 2048
67+
openssl req -new -x509 -sha256 \
6668
-key server.key \
6769
-subj "/CN=localhost" \
6870
-addext "subjectAltName = DNS:localhost" \
6971
-days 3650 \
7072
-out server.crt
7173
```
7274

73-
To trust the proxy, type:
75+
To trust the proxy, you add the certificate to the trust store. On MacOs, type:
7476

75-
```
77+
```bash
7678
sudo security add-trusted-cert -d -p ssl -p basic -k /Library/Keychains/System.keychain ./server.crt
7779
```
7880

81+
On Linux, type:
82+
83+
```sh
84+
cp server.crt /etc/ssl/certs/
85+
c_rehash
86+
```
87+
7988

8089
Now you can start the proxy, by copying the outputted command:
8190

82-
```shell-terminal
91+
```sh
8392
$ go install github.com/binxio/[email protected]
8493
$ terraform output -raw iap_proxy_command | sh
8594
```
@@ -88,15 +97,15 @@ The reason for the self-signed certificate is that kubectl will not send the cre
8897
## get credentials for your cluster
8998
To get the credentials for your cluster, type:
9099

91-
```shell-terminal
100+
```sh
92101
$ gcloud container clusters \
93102
get-credentials cluster-1
94103
````
95104

96105
## configure kubectl access via IAP proxy
97106
To configure the kubectl access via the IAP proxy, type:
98107

99-
```$shell-terminal
108+
```sh
100109
gcloud container clusters \
101110
get-credentials cluster-1
102111
@@ -110,10 +119,12 @@ This points the context to the proxy and configure the self-signed certificate f
110119
## use kubectl over IAP
111120
Now you can use kubectl over IAP!
112121

113-
```shell-terminal
122+
```sh
114123
$ kubectl cluster-info dump
115124
```
116125

117-
## todo
118-
- upgrading to websockets is not supported (ie kubectl exec)
119-
- deploy across multiple regions
126+
## Caveats
127+
- The IAP protocol does not support websockets as Authorization header cannot be passed in. Commands which rely
128+
on websockets will fail (ie kubectl exec).
129+
- the --debug flag is not very verbose.
130+
- The proxy has not been tested yet in the field, so I am happy to hear your feedback!

terraform/iap-proxy.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=docker.service network-online.target
55

66

77
[Service]
8-
Environment="IMAGE=gcr.io/binx-io-public/simple-iap-proxy:0.3.1"
8+
Environment="IMAGE=gcr.io/binx-io-public/simple-iap-proxy:0.3.2"
99

1010
ExecStartPre=ctr images pull ${IMAGE}
1111

terraform/output.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ output "iap_proxy_command" {
33
simple-iap-proxy gke-client \
44
--target-url https://iap-proxy.${trimsuffix(data.google_dns_managed_zone.tld.dns_name, ".")} \
55
--iap-audience ${google_iap_client.iap_proxy.client_id} \
6-
--service-account ${google_service_account.iap_proxy_accessor.email}
6+
--service-account ${google_service_account.iap_proxy_accessor.email} \
7+
--key-file server.key \
8+
--certificate-file server.crt
79
EOF
810
}

0 commit comments

Comments
 (0)