AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-292211

Jan Richter's questions

Martin Hope
Jan Richter
Asked: 2018-06-25 12:13:08 +0800 CST

Docker中的转发转发端口

  • 1

我LocalForward在通过 SSH 隧道将端口转发到容器时遇到了一些问题。

整个网络是这样的:

网络方案

这是我Dockerfile的GW Container:

FROM ubuntu:latest

RUN apt-get update \
  && apt-get install -y ssh \
  && apt-get clean

EXPOSE 80

COPY config /root/.ssh/config

ENTRYPOINT ["ssh", "app-server", "sleep infinity & wait"]

相关 sshconfig文件:

Host vpn-gateway
 StrictHostKeyChecking no
 UserKnownHostsFile=/dev/null
 Hostname 10.20.30.40
 User matrix

Host app-server
 StrictHostKeyChecking no
 UserKnownHostsFile=/dev/null
 Hostname 20.30.40.50
 User matrix
 ProxyCommand ssh vpn-gateway nc %h %p %r
 LocalForward 80 30.40.50.60:1080

现在,我使用docker-compose以下docker-compose.yml文件进行容器编排:

version: "3.2"
services:
  gateway:
      container_name: gateway
      image: gateway
      build: ./docker/gateway
      volumes:
          - ~/.ssh/id_rsa:/root/.ssh/id_rsa
          - ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub
      ports:
        - 8080:80

所以,我的想法是,如果我从 localhost 运行 wget: 我会从机器 ( ) 中wget http://127.0.0.1:8080/api/health得到响应。问题是我被重置了:API Server30.40.50.60:1080

--2018-06-25 07:19:26--  http://127.0.0.1:8080/api/health
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2018-06-25 07:19:27--  (try: 2)  http://127.0.0.1:8080/api/health
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

这可能是由于 Docker 没有看到任何使用端口 80 的应用程序,GW Container如下所述:https ://serverfault.com/a/769583/292211

如果我跑步,我exec会得到正确的回应。GW Containerwget http://127.0.0.1:80/api/health

有没有办法欺骗 docker 认为端口 80 可用,GW Container所以它允许我将端口转发到主机?或者可以以更好的方式处理这些事情中的任何一个吗?所有带有 SSH 隧道的 mumbo-jumbo 都是由于第三方安全限制。

谢谢!

networking
  • 1 个回答
  • 1308 Views
Martin Hope
Jan Richter
Asked: 2018-05-22 16:17:41 +0800 CST

随机无法访问的虚拟机

  • 0

我有一个在 Google Cloud Platform ( n1-standard-2in australia-southeast1-b) 中运行的计算引擎 VM。

该实例正在运行一个 Web 服务器,具有外部和内部静态 IP,使用default网络和子网,并分配​​有一个域。

在随机的一段时间后,机器变得无法访问。到目前为止,我要找到原因,但是当我尝试时tcptraceroute,结果如下:

健康

$ tcptraceroute my.domain.nz 443
Selected device wlp2s0, address 192.168.100.204, port 38543 for outgoing packets
Tracing the path to my.domain.nz (35.189.255.255) on TCP port 443 (https), 30 hops max
 1  192.168.100.1  2.982 ms  1.719 ms  1.884 ms
 2  192.168.1.254  2.540 ms  1.991 ms  2.091 ms
 3  * * *
 4  * * *
 5  ae8-10.akbr6.global-gateway.net.nz (122.56.116.5)  4.685 ms  3.459 ms  3.439 ms
 6  ae7-2.akbr7.global-gateway.net.nz (122.56.119.53)  3.908 ms  2.855 ms  2.693 ms
 7  xe5-0-4.sgbr3.global-gateway.net.nz (122.56.127.186)  29.059 ms  30.652 ms  28.932 ms
 8  ae2-10.sgbr4.global-gateway.net.nz (202.50.232.246)  27.784 ms  27.875 ms  35.276 ms
 9  google-gsw.sgbr4.global-gateway.net.nz (202.50.237.198)  30.394 ms  28.655 ms  28.791 ms
10  108.170.247.33  29.646 ms  29.712 ms  29.606 ms
11  209.85.242.142  29.048 ms  28.481 ms  28.239 ms
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  my.domain.nz (35.189.255.255) [open]  31.312 ms  29.198 ms  29.871 ms

不良

$ tcptraceroute my.domain.nz 443
Selected device wlp2s0, address 192.168.100.204, port 41597 for outgoing packets
Tracing the path to my.domain.nz (35.189.255.255) on TCP port 443 (https), 30 hops max
 1  192.168.100.1  4.428 ms  1.306 ms  1.813 ms
 2  192.168.1.254  2.654 ms  1.908 ms  2.545 ms
 3  * * *
 4  * * *
 5  ae8-10.akbr6.global-gateway.net.nz (122.56.116.5)  102.289 ms  3.407 ms  3.176 ms
 6  ae7-2.akbr7.global-gateway.net.nz (122.56.119.53)  4.630 ms  3.817 ms  3.299 ms
 7  xe5-0-2.sgbr3.global-gateway.net.nz (122.56.127.178)  119.213 ms  27.778 ms  144.073 ms
 8  ae2-10.sgbr4.global-gateway.net.nz (202.50.232.246)  28.512 ms  29.801 ms  144.985 ms
 9  google-gsw.sgbr4.global-gateway.net.nz (202.50.237.198)  29.008 ms  132.171 ms  29.510 ms
10  108.170.247.65  28.283 ms  28.180 ms  27.605 ms
11  209.85.242.190  27.815 ms  27.783 ms  27.681 ms
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
Destination not reached

我怀疑我们的本地网络有问题,但是如果我从 GCP 控制台重新启动 VM,我们可以再次访问它。

如果我尝试从我的移动网络访问该网站,它可以工作。来自任何远程服务器的 SSH 和 ping/curl 也可以。

不太确定如何进一步调试它,也不知道有什么问题。

有任何想法吗?

networking
  • 1 个回答
  • 534 Views
Martin Hope
Jan Richter
Asked: 2018-03-21 02:30:28 +0800 CST

自托管 gitlab 使用 Google 帐户注册

  • 1

我正在设置一个 GitLab EE 实例,我想仅使用 Google 帐户启用注册过程。我在这里遵循了文档:https ://docs.gitlab.com/ce/integration/google.html和这里:https ://docs.gitlab.com/ce/integration/omniauth.html 。

当我尝试将现有帐户绑定到 Google 时,与 Google 的集成工作正常,它完美无缺。

问题是当我尝试在没有现有帐户的情况下使用 Google 进行注册时,就会引发错误:

不允许在没有预先存在的 GitLab 帐户的情况下使用您的 Google 帐户登录。

我当前的/etc/gitlab/gitlab.rb配置如下:

### OmniAuth Settings
###! Docs: https://docs.gitlab.com/ce/integration/omniauth.html
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['google_oauth2']
gitlab_rails['omniauth_sync_email_from_provider'] = 'google_oauth2'
gitlab_rails['omniauth_sync_profile_from_provider'] = ['google_oauth2']
gitlab_rails['omniauth_sync_profile_attributes'] = ['email', 'name', 'location']
gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'google_oauth2'
gitlab_rails['omniauth_block_auto_created_users'] = false
# gitlab_rails['omniauth_auto_link_ldap_user'] = false
# gitlab_rails['omniauth_auto_link_saml_user'] = false
# gitlab_rails['omniauth_external_providers'] = ['google_oauth2']
gitlab_rails['omniauth_providers'] = [
   {
     "name" => "google_oauth2",
     "app_id" => "my-app-id",
     "app_secret" => "my-app-secret",
     "args" => { "access_type" => "offline", "approval_prompt" => "" }
   }
]

我究竟做错了什么?GitLab 甚至可以使用 Google 注册吗?

google
  • 2 个回答
  • 4106 Views
Martin Hope
Jan Richter
Asked: 2018-03-19 01:15:16 +0800 CST

谷歌云平台虚拟机上的 GitLab

  • 0

我正在尝试在 Google Cloud Platform 上运行 gitlab。我遵循了本教程:https ://docs.gitlab.com/ce/install/google_cloud_platform/index.html但现在我无法将提交推送到远程。

git@33.22.33.22: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

SSH 密钥已添加到 Google Cloud Platform VM 以及 Gitlab 帐户。我相信我必须以某种方式通过 ssh 启用 git,但不确定这些事情如何与 Google Cloud Platform 的安全性配合使用。

git
  • 1 个回答
  • 389 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve