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
    • 最新
    • 标签
主页 / server / 问题 / 865398
Accepted
embedded
embedded
Asked: 2017-07-27 22:42:47 +0800 CST2017-07-27 22:42:47 +0800 CST 2017-07-27 22:42:47 +0800 CST

rdomain 中的 OpenBSD sshd

  • 772

我正在尝试使用 rtables 设置具有路由分离的冗余 CARP 集群。一切正常,但我如何告诉 sshd仅在 rdomain 2 中启动?我知道我可以手动启动它

# route -T4 exec /usr/sbin/sshd

但是 sshd 配置中似乎没有集成 rdomains。

ssh
  • 2 2 个回答
  • 1120 Views

2 个回答

  • Voted
  1. minish
    2017-07-27T23:38:34+08:002017-07-27T23:38:34+08:00

    您可以使用 rc.d(8)、rcctl(8)、rc.subr(8) 编写自定义(通过调用route -T4)ssh 守护程序。

    在 /etc/rc.conf 中禁用原始 sshd 并放入 /etc/rc.d/rdomainsshd。

    /etc/rc.d/rdomainssshd 的模板脚本是:

    /usr/ports/infrastructure/templates/rc.template

    以下是 OpenBSD 手册页:

    • https://man.openbsd.org/rc.d
    • https://man.openbsd.org/rc.subr.8
    • https://man.openbsd.org/rcctl.8
    • 0
  2. Best Answer
    Jiri B
    2019-02-01T09:57:47+08:002019-02-01T09:57:47+08:00

    sshd_config(5)显示:

     ListenAddress
             Specifies the local addresses sshd(8) should listen on.  The
             following forms may be used:
    
                   ListenAddress hostname|address [rdomain domain]
                   ListenAddress hostname:port [rdomain domain]
                   ListenAddress IPv4_address:port [rdomain domain]
                   ListenAddress [hostname|address]:port [rdomain domain]
    
             The optional rdomain qualifier requests sshd(8) listen in an
             explicit routing domain.  If port is not specified, sshd will
             listen on the address and all Port options specified.  The
             default is to listen on all local addresses on the current
             default routing domain.  Multiple ListenAddress options are
             permitted.  For more information on routing domains, see
             rdomain(4).
    

    因此,请确保您的 sshd 配置具有例如。ListenAddress 0.0.0.0 rdomain 1. 要创建 sshd 的实例,只需执行以下操作:

    # ln -s sshd /etc/rc.d/sshd_rdomainX
    # rcctl enable sshd_rdomainX
    # rcctl set sshd_rdomainX flags -f /etc/ssh/sshd_config-rdomainX
    

    要对其进行测试,请尝试:

    mx1#  /usr/sbin/sshd -T -f /tmp/sshd_config  | grep listenaddress
    listenaddress 0.0.0.0:22 rdomain 1
    mx1# /usr/sbin/sshd -D -d -f /tmp/sshd_config                     
    ...
    debug1: rexec_argv[0]='/usr/sbin/sshd'
    debug1: rexec_argv[1]='-D'
    debug1: rexec_argv[2]='-d'
    debug1: rexec_argv[3]='-f'
    debug1: rexec_argv[4]='/tmp/sshd_config'
    debug1: Bind to port 22 on 0.0.0.0.
    Server listening on 0.0.0.0 port 22 rdomain 1.
    ...
    
    • 0

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

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