Skip to content

Instana Agentとバックエンドの間における多段プロキシー設定

概要とメリット

社内ネットワークから Instana へ接続する際、通信をプロキシー経由に統制する運用は珍しくありません。Instana Agent においても、適切なプロキシー設定を施すことで、通信経路の標準化、接続先の明確化、監査性の向上を図ることができます。 本記事では、オープンソースの Squid をフォワードプロキシーとして用い、Instana と Instana Agent 間の通信をプロキシー経由にする構成例をご紹介します。

公式ドキュメントのリンク

設定例

構成図

1
2
3
4
|Instana BackEnd|    |Forward Proxy   |    |Instana Agent Server|
|               |----|Squid Cache 5.5 |----|                    |
|AgentPort 443  |    |Proxy Port 8080 |    |                    |
|xxxx.instana.io|    |proxy-ip-address|    |agent-ip-address    |

Instana Agentサーバーの設定

  • com.instana.agent.main.sender.Backend.cfgにおけるproxy.host,proxy.portを編集し、Instana Agentがプロキシー経由でInstanaバックエンドと通信するように設定をします。
    • 通常、com.instana.agent.main.sender.Backend.cfgは、*instanaAgentDir*/etc/instana/配下にあります。
1
2
3
4
5
6
7
8
host=xxxx.instana.io
port=443
protocol=HTTP/2
key=<key> # Instana Agentキー

proxy.host=<proxy-ip-address>
proxy.port=8080
proxy.type=http

Forward Porxyの設定

  • squid.confを編集し、Instana Agentからの通信許可およびInstanaバックエンドへの通信設定をします
# ==== Squidポートの定義 ====
http_port 8080

# ==== ACL定義 ====
# localhost(明示)
acl localhost src 127.0.0.1/32 ::1

# SSLポートとSafeポートの定義
acl SSL_ports port 443
acl Safe_ports port 443

# manager へのアクセスは localhost のみ許可
http_access allow localhost manager
http_access deny manager

# Squidへのアクセス元
acl client_net src <agent-ip-address>
acl CONNECT method CONNECT

# Instanaのバックエンド
acl instana_backend dstdomain .xxxx.instana.io
acl instana_backend_port port 443

# ==== アクセス制御 ====
# 443以外のCONNECTは禁止
http_access deny CONNECT !SSL_ports

# Safe_ports 以外は禁止
http_access deny !Safe_ports

# Instana(443)のみ許可
http_access allow client_net instana_backend instana_backend_port

# 最終禁止
http_access deny all

# ==== ログ ====
access_log daemon:/var/log/squid/access.log squid

接続成功時のログ表示抜粋

  • プロキシー設定確認コマンド(Instana AgentのインストールサーバーからInstanaバックエンド)実行後、下記ログが表示されれば問題ない状態となります
curl -x <proxy-ip-address>:8080 https://xxxx.instana.io
  • Instana Agentのログ(agent.log)
 | INFO  | xxxx.instana.io:443-8-1 | Backend          | com.instana.agent-backend - 1.0.7 | Connected using HTTP/2 to xxxx.instana.io:443 with id '02:00:43:ff:fe:5d:e6:54' and key '*** (redacted)'
  • Forward Proxyのログ(access.log)
 <proxy-ip-address> TCP_TUNNEL/200 9281 CONNECT xxxx.instana.io:443 - HIER_DIRECT/