# Using Elastic Defend with VPN

**URL:** <https://discuss.elastic.co/t/using-elastic-defend-with-vpn/347174>\
**Category:** Elastic Agent\
**Tags:** elastic-stack-security\
**Created:** [November 14, 2023, 11:24pm UTC](https://discuss.elastic.co/t/using-elastic-defend-with-vpn/347174 "2023-11-14T23:24:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![totobarbar](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@totobarbar](https://discuss.elastic.co/u/totobarbar)\
**Post date:** [November 14, 2023, 11:24pm UTC](https://discuss.elastic.co/t/using-elastic-defend-with-vpn/347174/1 "2023-11-14T23:24:52Z")

</div>

Hello,  
I use Elastic-Agent with Wireguard like this:

 ![archi_elk](https://us1.discourse-cdn.com/elastic/original/3X/e/f/ef13629136c66c3c0c149e990a78c16bb50ef67b.png)

I use a vpn because I don't want to expose my elasticsearch cluster on the internet

I configured the Wireguard client to run on a custom network namespace where I run the elastic agent (by modifying the elastic-agent.service file).  
This works very well with the elastic agent with simple integration like the system one.

Recently, I wanted to add Elastic Defend integration. The problem is that with this integration, another program is running (elastic-endpoint) and not in my custom network namespace. So I got this error:  
`{"@timestamp":"2023-11-14T23:15:07.507674172Z","agent":{"id":"","type":"endpoint"},"ecs":{"version":"1.11.0"},"log":{"level":"info","origin":{"file":{"line":90,"name":"AgentConnectionInfo.cpp"}}},"message":"AgentConnectionInfo.cpp:90 Failed to find connection to validate. Is Agent listening on 127.0.0.1:6788?","process":{"pid":873,"thread":{"id":1114}}}`

It seems that my way of using a vpn for the elastic agent is not compatible with this integration, is there another way to use a vpn connection or another way to expose an elasticsearch cluster without a vpn?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 12, 2023, 11:25pm UTC](https://discuss.elastic.co/t/using-elastic-defend-with-vpn/347174/2 "2023-12-12T23:25:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
