This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
The community reviewed whether to reopen this question 2 years ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
这并不能解决您的用例,因为这仅引导 Firefox 的流量,但您不需要 root。
TL;DR
在 Android 上安装 Termux 应用程序,编辑重要信息: Termux 不再在 Play 商店上接收更新。请从 F-Droid 安装应用程序和附加组件。
在termux中安装openssh
pkg i -y openssh
使用动态端口转发ssh到服务器
ssh user@server -D12345
安装Android 上的 Firefox Beta(目前,普通 Firefox 不支持配置
关于:配置
)打开 Firefox Beta,然后转到
about:config
搜索
proxy
查找并设置以下属性:
确保
network.proxy.socks_port
与上面 ssh 命令中的端口匹配完成!,您现在正在 Firefox 上的 ssh 服务器中导航
使用 ssh-keys 的完整说明
使用
ssh user@server -D12345
(或者只需按 Up+ 输入(如果您之前运行过此命令))安装
设置 Android
Termux
安装Termux
通过运行以下命令配置 ssh 客户端:
(可选)如果您可以通过 ssh 访问服务器,则运行:
如果没有,您需要手动将公钥添加到服务器。下面的设置服务器部分对此进行了解释
Firefox
安装 Firefox Beta - 如果您可以访问
about:config
,普通的 Firefox 可能会工作
打开 Firefox 并转到 url
about:config
,搜索proxy
并设置以下配置:< /p>确保
network.proxy.socks_port
与用法部分中ssh命令中使用的端口匹配设置服务器
如果您成功运行命令
ssh-copy-id
,则此处无需执行任何操作。但如果没有,则需要手动添加生成的公钥:
来源:https://github.com/madacol/blog/blob/master/content/Ssh%20poor-man's-vpn%20on%20android.md
This doesn't solve your use case because this only directs the traffic of firefox, but you don't need root.
TL;DR
Install Termux app on android, EDIT IMPORTANT: Termux does not receive updates on Play Store anymore. Install the application and add-ons from F-Droid instead.
In termux install openssh
pkg i -y openssh
ssh into server using dynamic port forwarding
ssh user@server -D12345
Install Firefox Beta on android (at this time, plain Firefox doesn't support configuring with
about:config
)Open Firefox Beta, and go to
about:config
Search
proxy
Look for and set the following properties:
make sure
network.proxy.socks_port
matches with the port in the ssh command aboveDone!, you are now navigating through the ssh server on Firefox
Full instructions using ssh-keys
Usage
ssh user@server -D12345
(or just press Up+Enter if you have run this command previously)Install
Setup Android
Termux
Install Termux
Configure ssh client by running the following commands:
(Optional) If you have access to the server with ssh, then run:
If not, you need to manually add the public key to the server. This is explained below in the Setup server section
Firefox
Install Firefox Beta - normal firefox might work if you can access to
about:config
Open Firefox and go to the url
about:config
, searchproxy
and set the following configurations:make sure
network.proxy.socks_port
matches with the port used in the ssh command in the Usage sectionSetup server
If you succesfully run the command
ssh-copy-id
there's nothing to do here.But if not, you need to manually add the public key generated:
Source: https://github.com/madacol/blog/blob/master/content/Ssh%20poor-man's-vpn%20on%20android.md
您是否尝试过使用 sshtunnel?仅靠 iptables 不足以做到这一点。
至于实际如何完成的概述:
localhost:3128
。这就是 iptables 的用武之地:iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to localhost:3128
如果您也想重定向其他协议,则可以使用 SOCKS 代理具有类似的设置。重定向 DNS、通过隧道重定向端口 53 等。
总而言之,要完全隐藏“所有流量”并不那么容易,所以只需使用该应用程序即可。如果您想修补 Cyanogenmod 来执行此操作,请查看源代码并修改启动脚本。
Have you tried using sshtunnel? Iptables alone is not enough to do this.
As for an overview of how it's actually done:
localhost:3128
will actually go to the remote machine (your home router).localhost:3128
. That's where iptables comes in:iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to localhost:3128
If you want to redirect other protocols too, you use a SOCKS proxy with a similar setup. To redirect DNS, redirect port 53 through the tunnel, etc.
All in all to complete conceal 'all traffic' is not that easy, so just use the app. If you want to patch Cyanogenmod to do this, look at the source and modify the startup scripts.