GoogleCloudPlatform / GoogleCloudPlatform/cloud-sql-proxy

Authentication Issue When Connecting Through Bastion Host and IAP

オープン
#2,405 コメント 7 件 リアクション 0 件 担当者 1 名 @hessjcg が担当を希望しています GitHub で見る
priority: p2 type: feature request
主要言語
Go
スター
1.4k
フォーク
352
平均マージ
14時間 54分
マージ済み PR(30日)
5

説明

### Question

## Environment
- Google Cloud Platform (GCP)
- Cloud SQL PostgreSQL instance with private IP only
- Bastion host with private IP only
- Identity-Aware Proxy (IAP) for bastion host access
- DBeaver as SQL client

## Problem
I'm trying to connect to a PostgreSQL instance in Google Cloud SQL from my local machine. The database has only a private IP address, so I'm using a bastion host to access it.

Bastion has a systemd service that is using
```
/usr/local/bin/cloud-sql-proxy --auto-iam-authn --private-ip --address 0.0.0.0 --port 3307 [connection-string]
```

I've set up IAP TCP forwarding to the bastion host with this command:
```
gcloud compute start-iap-tunnel [bastion-name] 3307 --local-host-port=localhost:5432 --zone=[zone]
```

When I try to connect through DBeaver using:
- Host: localhost
- Port: 5432
- Database: db_name
- Username: myname@company.com
- Password: (empty)

I receive the following error:
```
FATAL: Cloud SQL IAM user authentication failed for user "myname@company.com"
```

This setup previously worked when I was using cloud-sql-proxy locally. However, now that cloud-sql-proxy is running on the bastion host, the authentication fails.

## What I've tried
I've confirmed that my user account has the necessary IAM permissions and has been added to Cloud SQL. The direct connection using cloud-sql-proxy from my local machine worked before, but I need to route through the bastion host now.

What might be causing this authentication failure, and how can I properly configure the connection to maintain IAM authentication while going through the bastion host?

### Code

```Go

```

### Additional Details

_No response_

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。