使用docker搭建socks5代理

news/2025/2/12 2:31:32/

我参考MuleSoft Help Center成功搭建了socks5代理服务器

文字内容如下(怕以后访问不了)

How to set up a testing SOCKS5 proxy (dante) for Anypoint monitoring in RTF (Runtime Fabric)

A demonstration to set up a SockS5 proxy with Dante and set up the proxy in RTF. This KB involves none standard MuleSoft offering product. Technical assistance for such products is limited to this article. Please use at your own risk.

Jul 23, 2019•Knowledge

Content

GOAL

Usually, RTF is running in a secured environment with proxies for communications between the Anypoint control plane. Most of the communications are HTTP/HTTPS and require an HTTP/HTTPS proxy. However, Anypoint Monitoring uses SOCKS5 proxies for sending metrics and logs out to the control plane. 

This KB demonstrates how to set up a Dante SOCKS5 server for Anypoint Monitoring in RTF. Please note Dante is not part of the MuleSoft product set. Technical assistance for such products is limited to this article. 

PROCEDURE

Set up a Dante proxy

We recommend using a docker-compose file to set up the Dante server, which is suggested here at https://hub.docker.com/r/vimagick/dante. 

Create a folder and change the working directory to the folder. create docker-compose.yml 

dante:image: vimagick/danteports:- "1080:1080"volumes:- ./sockd.conf:/etc/sockd.confrestart: always

Create sockd.conf. Update 172.19.0.0/16 to the CIDR of RTF cluster

debug: 0
logoutput: stderr
internal: 0.0.0.0 port = 1080
external: eth0
socksmethod: username none
clientmethod: none
user.privileged: root
user.unprivileged: nobodyclient pass {from: 0.0.0.0/0 port 1-65535 to: 0.0.0.0/0log: error
}socks pass {from: 172.19.0.0/16 to: 0.0.0.0/0socksmethod: usernamelog: error
}

Bring up the Dante server and set the credentials. Replace "user1" and "password" with your own username and password. 

$ docker-compose up -d
$ docker exec -it dante_dante_1 bash
>>> useradd user1
>>> echo user1:password | chpasswd
>>> exit

Set up a firewall rule to allow traffic from the RTF nodes to port 1080 on the proxy firewall

Test the proxy on your RTF cluster. Replace the 172.19.0.23 with the IP of the proxy server. "client certificate not found" shows no client certificate is sent but it means the connectivity via the proxy is good. 

curl -kx socks5h://user1:password@172.19.0.23:1080 https://dias-ingestor-nginx.prod.cloudhub.io:5044
curl: (52) NSS: client certificate not found (nickname not specified)

Update monitoring proxy on RTF 

Follow the instructions here to set up the proxy on RTF. 

> rtfctl apply monitoring-proxy "socks5://user1:password@172.19.0.23:1080"

Restart applications to pick up the proxy. In the anypoint-monitoring container log, it should show the connection established. 

2019-07-22T03:55:56.037Z	INFO	transport/proxy.go:70	
proxy host: '172.19.0.23:1080'
...
2019-07-22T03:56:17.241Z	INFO	pipeline/output.go:95	
Connecting to backoff(async(tcp://dias-ingestor-nginx.prod.cloudhub.io:5044))
2019-07-22T03:56:18.344Z	INFO	pipeline/output.go:105	
Connection to backoff(async(tcp://dias-ingestor-nginx.prod.cloudhub.io:5044)) established
...

 

Disclaimer: This article involves products and technologies which do not form part of the MuleSoft product set. Technical assistance for such products is limited to this article.

Attachments

而我不想有用户密码验证和ip地址限制,所以修改配置如下:

debug: 0
logoutput: stderr
internal: 0.0.0.0 port = 1080
external: eth0
socksmethod: username none
clientmethod: none
user.privileged: root
user.unprivileged: nobodyclient pass {from: 0.0.0.0/0 port 1-65535 to: 0.0.0.0/0log: error
}socks pass {from: 0.0.0.0/0 to: 0.0.0.0/0socksmethod: username nonelog: error
}

祝你好运,畅游网络


http://www.ppmy.cn/news/1233212.html

相关文章

科技的成就(五十三)

503、任天堂首次公开 Switch 2016 年 10 月 20 日,任天堂首次公开 Switch 正式名称及造型。Switch 是任天堂推出的混合型游戏机,可作为家用游戏机,也可作为便携式掌机。Switch 在开发过程中就以代号 NX 而闻名,成为当年的现象级产…

【iOS】知乎日报

文章目录 前言一、首页1.网络的异步请求2.避免同一网络请求执行多次3.下拉刷新与上拉加载的实现下拉刷新上拉加载 二、网页1.webView的实现2.webView的滑动加载3.网页与首页内容的同步更新 三、评论区Masonory实现行高自适应 四、收藏中心通过FMDB实现数据持久化1.创建或打开数…

priority_queue简单实现(优先级队列)(c++)

priority_queue priority_queue介绍逻辑实现框架调整算法adjust_up()adjust_down() 仿函数/比较函数仿函数特性 构造函数迭代器区间构造 完整优先级队列代码 priority_queue介绍 pri_que是一个容器适配器,它的底层是其他容器,并由这些容器再封装而来。类…

Java虚拟机(JVM)的调优技巧和实战

JVM是Java应用程序的运行环境,它负责管理Java应用程序的内存分配、垃圾收集等重要任务。然而,JVM的默认设置并不总是适合所有应用程序,因此需要根据应用程序的需求进行调优。通过对JVM进行调优,可以大大提高Java应用程序的性能和可…

LiteOS同步实验(实现生产者-消费者问题)

效果如下图: 给大家解释一下上述效果:在左侧(顶格)的是生产者(Producer);在右侧(空格)的是消费者(Consumer)。生产者有1个,代号为“0”…

如何在 ASP.NET Core 中使用 Quartz.NET

当我们在web开发中,常常会遇到这么一个需求,在后台执行某一项具体的任务,具体的说就是这些任务必须在后台定时执行。 Quartz.NET 是一个开源的 JAVA 移植版,它有着悠久的历史并且提供了强大的 Cron 表达式,这篇我们就…

【python学习】基础篇-常用模块-Base64:用64个字符表示任意二进制数据的方法,常用于在URL、Cookie、网页中传输少量二进制数据

Base64是一种用64个字符表示任意二进制数据的方法,常用于在URL、Cookie、网页中传输少量二进制数据。 Python中的base64模块提供了一些方法用于编码和解码Base64字符串。 以下是一些常用的base64用法: 1.编码:将二进制数据转换为Base64字符…

万字解析设计模式之 适配器模式

一、 适配器模式 1.1概述 将一个接口转换成客户希望的另一个接口,适配器模式使接口不兼容的那些类可以一起工作。 适配器模式分为类适配器模式和对象适配器模式,前者类之间的耦合度比后者高,且要求程序员了解现有组件库中的相关组件的内部结…