'vagrant share' 可以在防火墙后面使用吗?它几乎可以阻止所有内容?

'vagrant share' 可以在防火墙后面使用吗?它几乎可以阻止所有内容?

我的配置:

  • 普通PC电脑
  • Debian 8 GNU/Linux 32 位作为操作系统(全新、库存安装,无需配置任何防火墙,如果已配置,则由安装程序完成)
  • 从 vaagrant 页面的 vagrant .deb 包安装最新的 vagrant
  • 从 Debian 的 contrib repo 安装的 virtualbox(方法:如上所述:https://wiki.debian.org/VirtualBox#Debian_8_.22Jessie.22
  • 从 repo 进行 rsync (因为 vagrant 需要它,而且我在注意到错误后必须安装它)

  • 几乎所有可以想象到的端口都被阻塞的网络

我想做的事

*creating box and installing stuff on it*
$ vagrant login
*logged in*
$ vagrant up
*box is up*
$ vagrant share
and here comes the problem

我的问题

$ vagrant share
==> default: Detecting network information for machine...
    default: Local machine address: 127.0.0.1
    default:  
    default: Note: With the local address (127.0.0.1), Vagrant Share can only
    default: share any ports you have forwarded. Assign an IP or address to your
    default: machine to expose all TCP ports. Consult the documentation
    default: for your provider ('virtualbox') for more information.
    default:  
    default: Local HTTP port: 8080
    default: Local HTTPS port: disabled
    default: Port: 2222
    default: Port: 8080
==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
    default: Share will be at: rambunctious-goat-2041

这里挂了几分钟,因此在此期间我在另一个控制台检查我打开了哪些端口

$ nmap localhost

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-30 21:56 CEST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00020s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 995 closed ports
PORT     STATE SERVICE
25/tcp   open  smtp
111/tcp  open  rpcbind
631/tcp  open  ipp
2222/tcp open  EtherNet/IP-1
8080/tcp open  http-proxy

好的,2222 和 8080 已打开,(在我运行“vagrant up”命令之前它们是关闭的)

几分钟后,vagrant 最终打印出错误消息并退出,因此 vagrant 输出如下所示:

$ vagrant share
==> default: Detecting network information for machine...
    default: Local machine address: 127.0.0.1
    default:  
    default: Note: With the local address (127.0.0.1), Vagrant Share can only
    default: share any ports you have forwarded. Assign an IP or address to your
    default: machine to expose all TCP ports. Consult the documentation
    default: for your provider ('virtualbox') for more information.
    default:  
    default: Local HTTP port: 8080
    default: Local HTTPS port: disabled
    default: Port: 2222
    default: Port: 8080
==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
    default: Share will be at: rambunctious-goat-2041
The sharing proxy exited with a non-zero exit status! This represents
an erroneous exit and likely a bug. Please report this issue.

以下是调试输出的最后几行

vagrant share --debug

我决定只把那些与最终错误消息最相关的内容放在这里,而且因为 --debug 标志生成的整个日志太长了。

(...  so many many many lines ommited ... )
==> default: Creating Vagrant Share session...
 INFO api: /api/v1/shares
DEBUG api: API payload: {"share":{"http_port":8080,"https_port":null,"ports":[2222,8080]}}
DEBUG api: Response: {"custom_domain":false,"expired":false,"has_private_key":false,"name":"wild-pronghorn-2195","http_port":8080,"https_port":null,"ssh_port":null,"ssh_username":null,"ports":[2222,8080],"expired_at":null,"created_at":"2016-08-30T18:17:28.755Z","private_key_password":true,"token":null,"use_key_once":true,"domain":"vagrantshare.com","full_domain":"wild-pronghorn-2195.vagrantshare.com","mux_insecure":false,"mux_client_addr":"register.vagrantshare.com:8001","mux_server_addr":"register.vagrantshare.com:8000"}
 INFO interface: detail: Share will be at: wild-pronghorn-2195
 INFO interface: detail:     default: Share will be at: wild-pronghorn-2195
    default: Share will be at: wild-pronghorn-2195
 INFO interface: Machine: share-name ["wild-pronghorn-2195", {:target=>:default}]
 INFO helper: Executing proxy: ["-share", "-name", "wild-pronghorn-2195", "-target", "127.0.0.1", "-server", "register.vagrantshare.com:8000", "-port", "8080", "-port", "2222", "-port", "8080"]
 INFO subprocess: Starting process: ["/opt/vagrant/embedded/gems/gems/vagrant-share-1.1.5/localbin/proxy_linux_386", "-share", "-name", "wild-pronghorn-2195", "-target", "127.0.0.1", "-server", "register.vagrantshare.com:8000", "-port", "8080", "-port", "2222", "-port", "8080"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: proxy:1472588546,log,[INFO] Restricting ports to: [8080 2222 8080]
proxy:1472588546,log,[DEBUG] proxy: Connecting to mux server at register.vagrantshare.com:8000
DEBUG helper: Proxy message: ["log", "[INFO] Restricting ports to: [8080 2222 8080]"]
DEBUG helper: Proxy message: ["log", "[DEBUG] proxy: Connecting to mux server at register.vagrantshare.com:8000"]
DEBUG subprocess: stdout: proxy:1472588694,log,[ERR] proxy: Failed to start sharing: Failed to connect to mux server: dial tcp 52.72.124.216:8000: connection timed out
DEBUG helper: Proxy message: ["log", "[ERR] proxy: Failed to start sharing: Failed to connect to mux server: dial tcp 52.72.124.216:8000: connection timed out"]
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31852
DEBUG subprocess: Exit status: 1
 INFO environment: Running hook: environment_unload
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: environment_unload #<Vagrant::Action::Builder:0x9a156cc>
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<VagrantPlugins::Share::Errors::ProxyExit: The sharing proxy exited with a non-zero exit status! This represents
an erroneous exit and likely a bug. Please report this issue.>
ERROR vagrant: The sharing proxy exited with a non-zero exit status! This represents
an erroneous exit and likely a bug. Please report this issue.
ERROR vagrant: /opt/vagrant/embedded/gems/gems/vagrant-share-1.1.5/lib/vagrant-share/activate.rb:1401:in `block in execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:235:in `block in with_target_vms'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:229:in `each'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:229:in `with_target_vms'
/opt/vagrant/embedded/gems/gems/vagrant-share-1.1.5/lib/vagrant-share/activate.rb:1178:in `execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/cli.rb:42:in `execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/environment.rb:302:in `cli'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/bin/vagrant:174:in `<main>'
 INFO interface: error: The sharing proxy exited with a non-zero exit status! This represents
an erroneous exit and likely a bug. Please report this issue.
The sharing proxy exited with a non-zero exit status! This represents
an erroneous exit and likely a bug. Please report this issue.
 INFO interface: Machine: error-exit ["VagrantPlugins::Share::Errors::ProxyExit", "The sharing proxy exited with a non-zero exit status! This represents\nan erroneous exit and likely a bug. Please report this issue."]

嗯,尤其是连接线,看起来很可疑

DEBUG helper: Proxy message: ["log", "[INFO] Restricting ports to: [8080 2222 8080]"]
DEBUG helper: Proxy message: ["log", "[DEBUG] proxy: Connecting to mux server at register.vagrantshare.com:8000"]
DEBUG subprocess: stdout: proxy:1472588694,log,[ERR] proxy: Failed to start sharing: Failed to connect to mux server: dial tcp 52.72.124.216:8000: connection timed out
DEBUG helper: Proxy message: ["log", "[ERR] proxy: Failed to start sharing: Failed to connect to mux server: dial tcp 52.72.124.216:8000: connection timed out"]
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31852
DEBUG subprocess: Exit status: 1

我的问题 我在 Google 上搜索了该错误消息,但我找到的内容并不清楚,因为它只提到“防火墙阻止了某些端口”。另一方面,我被告知尽管有防火墙,我仍应该能够成功执行 Vargant share。此外,Vagrant 页面 (https://www.hashicorp.com/blog/feature-preview-vagrant-1-5-share.html) 状态:

创建共享后,会输出一个相对模糊的 URL。此 URL 将直接路由到您的 Vagrant 环境;无论您或访问方是否位于防火墙或 NAT 后面,都没有关系

我的理解是,这意味着 vagrant share 应该在我的案例中起作用,防火墙阻止端口不应该成为问题。所以我很困惑到底发生了什么。

总结一下:是否可以在防火墙阻止“不常见”的端口(几乎所有可能不是 80、22、大多数“基本”端口)后执行“vargant share”?或者尽管提到了 vargant 页面状态,但仍然无法执行?

答案1

相关内容