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-117583

mohrphium's questions

Martin Hope
mohrphium
Asked: 2015-01-28 03:51:25 +0800 CST

具有 SNI 和不同 SSL 设置的 HAProxy

  • 9

我的两个站点都有 HAProxy,其中一个是公共的,一个是私有的。

www.mysite.com private.mysite.com

Atm,我正在使用这样的 haproxy:

frontend mysite_https
  bind *.443 ssl crt /etc/mycert.pem ca-file /etc/myca.pem verify optional no-sslv3
  mode http
  acl domain_www     hdr_beg(host) -i www.
  acl domain_private hdr_beg(host) -i private.
  acl path_ghost     path_beg         /ghost/
  acl clientcert     ssl_c_used

  redirect location https://www.example.com if path_ghost !clientcert
  redirect location https://www.example.com if !domain_www !clientcert

  use_backend bknd_private if domain_private
  use_backend bknd_www     if domain_www

  default_backend bknd_www

这应该做的是要求客户证书(可选)并继续。如果域不是 www.example.com 且访问者无法提供正确的证书或路径为 /ghost/ 且访问者无法提供正确的证书,则应重定向到https://www.example.com

到目前为止,这工作正常。但是,Mac 用户使用 Safari 浏览我的网站时抱怨说,他们在浏览https://www.example.com/时不断被要求提供证书,而例如 Firefox 仅在浏览https://private.example时询问.com/或https://www.example.com/ghost/。

显然这就是 Safari 的工作方式,所以我无法解决这个问题。我的想法是使用 SNI 来划分不同的前端

frontend mysite_https
  bind *.443 ssl crt /etc/mycert.pem no-sslv3

frontend private_https
  bind *.443 ssl crt /etc/mycert.pem ca-file /etc/myca.pem verify optional no-sslv3

当然这不起作用,因为

一个。我不能让两个前端监听端口 443,而只有一个公共 IP b。我还没有找到一种方法来说“use_frontend if domain_www”或类似的东西。(仅 use_backend 或 use-server)

我也试过用三个 haproxy 服务器来做

frontend haproxy-sni
bind *:443 ssl crt /etc/mycert.pem no-sslv3
mode tcp

tcp-request inspect-delay 5s
tcp-request content accept if { req.ssl_hello_type 1 }

acl domain_www ssl_fc_sni_end -i www.example.com

use-server server1 haproxy-private.lan  if !domain_www
use-server server2 haproxy-public.lan   if domain_www

这行得通,但是这里的问题是 haproxy-private 请求客户端证书,但请求没有到达浏览器。不知何故,haproxy-sni 放弃了请求。

此外,我现在有三个不可取的 haproxy 服务器(尽管如果我找不到更好的解决方案,这是一个可能的选择)。

最好我想要这样的东西(编造..不知道真正的选择)

frontend mysite_https
  bind *.443 ssl crt /etc/mycert.pem no-sslv3
  mode http

  acl domain_www     hdr_beg(host) -i www.
  acl domain_private hdr_beg(host) -i private.
  acl path_ghost     path_beg         /ghost/

  ssl_options ca-file /etc/myca.pem verify optional if !www_domain          # made up!
  ssl_options ca-file /etc/myca.pem verify optional if !path_ghost          # made up!

  acl clientcert     ssl_c_used

  redirect location https://www.example.com if path_ghost !clientcert
  redirect location https://www.example.com if !domain_www !clientcert
  ...

我希望有人可以帮助我解决这个问题...

ssl
  • 2 个回答
  • 21069 Views
Martin Hope
mohrphium
Asked: 2014-09-12 04:20:49 +0800 CST

重新启动服务器后,通过 NSLCD 使用 LDAP 用户进行 SSH 登录可以工作

  • 1

我在许多服务器上运行了一个有效的 nslcd 设置。我将此配置分发到许多服务器,几乎所有这些服务器都可以正常工作。

但是我忘记在其中五个上安装 libnss-ldapd 和 libpam-ldapd。

这导致了以下 nslcd 调试日志

  nslcd: DEBUG: add_uri(ldaps://dc.example.com/)
  nslcd: DEBUG: ldap_set_option(LDAP_OPT_X_TLS_CACERTDIR,"/etc/ssl/certs")
  nslcd: DEBUG: ldap_set_option(LDAP_OPT_X_TLS_CACERTFILE,"/etc/ssl/certs/example.com.pem")
  nslcd: version 0.8.10 starting
  nslcd: DEBUG: unlink() of /var/run/nslcd/socket failed (ignored): No such file or directory
  nslcd: DEBUG: setgroups(0,NULL) done
  nslcd: DEBUG: setgid(108) done
  nslcd: DEBUG: setuid(107) done
  nslcd: accepting connections

  nslcd: [8b4567] DEBUG: connection from pid=6939 uid=0 gid=0
  nslcd: [8b4567] <authc="user"> DEBUG: nslcd_pam_authc("user","sshd","***")
  nslcd: [8b4567] <authc="user"> DEBUG: myldap_search(base="********", filter="(&(memberOf=********)(sAMAccountName=user))")
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_initialize(ldaps://dc.example.com/,)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_rebind_proc()
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_PROTOCOL_VERSION,3)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_DEREF,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_TIMELIMIT,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_TIMEOUT,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_NETWORK_TIMEOUT,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_REFERRALS,LDAP_OPT_ON)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_RESTART,LDAP_OPT_ON)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_X_TLS,LDAP_OPT_X_TLS_HARD)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_simple_bind_s("cn=********,dc=example,dc=com","***") (uri="ldaps://dc.example.com/,")
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_result(): CN=user,OU=********,DC=example,DC=com
  nslcd: [8b4567] <authc="user"> DEBUG: myldap_search(base="CN=user,OU=********,DC=example,DC=com", filter="(objectClass=*)")
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_initialize(ldaps://dc.example.com/,)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_rebind_proc()
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_PROTOCOL_VERSION,3)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_DEREF,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_TIMELIMIT,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_TIMEOUT,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_NETWORK_TIMEOUT,0)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_REFERRALS,LDAP_OPT_ON)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_RESTART,LDAP_OPT_ON)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_set_option(LDAP_OPT_X_TLS,LDAP_OPT_X_TLS_HARD)
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_simple_bind_s("CN=user,OU=********,DC=example,DC=com","***") (uri="ldaps://dc.example.com/,")
  nslcd: [8b4567] <authc="user"> DEBUG: failed to bind to LDAP server ldaps://dc.example.com/,: Invalid credentials: 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1
  nslcd: [8b4567] <authc="user"> DEBUG: ldap_unbind()

我知道配置正在运行,因为我没有更改任何内容并且它正在其他服务器上运行。

我设法通过重新启动服务器使 ldap 工作,所以似乎通过在推出后安装 libnss-ldapd 和 libpam-ldapd,某些模块被挂断了。

问题 我想知道这是哪个模块以及是否可以在不重新启动服务器的情况下重新加载它。

仅供参考:简单的“服务 nslcd 重启”并没有解决问题。但是,重新启动后,一切都按预期工作。

debian
  • 1 个回答
  • 3826 Views
Martin Hope
mohrphium
Asked: 2014-07-08 06:54:42 +0800 CST

SaltStack 以 * 为目标

  • 1

我在我的 linux 机器上使用 SaltStack 并想定义节点组。我知道复合匹配和仆从列表等。

这就是我所需要的,它以这种方式工作,但是使用大量服务器很难维护

nodegroups:
  group1: 'srv1,srv2,srv3,srv4,dev1,dev2,stage1,stage2'
  

为了简单起见,我试图以这种方式定义它们:

nodegroups:
  group1: 'srv*,dev*,stage*'

但我找不到正确的方法。有任何想法吗?

-=编辑=-

我尝试了Dan Garthwaite的解决方案,但没有奏效。我什至在安装了 Salt 版本 2014.1.4 的私人开发服务器上进行了尝试。这就是我得到的。

尝试正常列表(完整主机名)

fmohr@salt-master:~$ sudo salt -v -C 'L@dns01,apache' test.ping
Executing job with jid 20140708072832751715
-------------------------------------------

dns01:
    True
apache:
    True

带一个通配符

fmohr@salt-master:~$ sudo salt -v -C 'L@dns*,apache' test.ping
Executing job with jid 20140708072837257646
-------------------------------------------

apache:
    True

带有所有通配符

fmohr@salt-master:~$ sudo salt -v -C 'L@dns*' test.ping
No minions matched the target. No command was sent, no jid was assigned.

fmohr@salt-master:~$ sudo salt -v -C 'L@dns*,apach*' test.ping
No minions matched the target. No command was sent, no jid was assigned.

我认为您不能在列表中使用通配符,但我不知道如何将盐用于目标 dns* 和 apach*(例如)。

groups
  • 3 个回答
  • 3364 Views
Martin Hope
mohrphium
Asked: 2013-11-26 04:25:59 +0800 CST

Apache proxy_http 重定向到 ip 并设置主机名

  • 21

希望你们能帮助我解决我遇到的代理问题。

我已经拥有的

我已经设置了一个 apache http 反向代理,将来自 *.proxy.domain 的请求代理到 *.intern.domain。apache 是从外部网络访问我的内部 Web 应用程序的唯一方法。

例子:

app.proxy.domain -> app.intern.domain
mail.proxy.domain -> mail.intern.domain

这一切都很好,但我有以下问题。

问题
我想代理以下请求:

app.proxy.domain -> app.internal.domain
app-dev.proxy.domain -> app-dev.internal.domain

这没问题,但不幸的是,app-dev 服务器运行的是应用服务器 web 应用程序的精确副本,而这个 web 应用程序只响应它的主机名 (app.intern.domain)

所以我需要做的是代理以下

app.proxy.domain -> app.internal.domain (10.0.1.1)
app-dev.proxy.domain -> app.internal.domain (10.0.1.2)

我可以做第二件事,在 /etc/hosts 中添加“10.0.1.2 app.internal.domain”,但这也意味着 app.proxy.domain 将登陆开发服务器。

我正在寻找一个选项,仅在 app-dev.proxy.domain 的 vhost 配置文件中设置 /etc/hosts 条目,这样所有其他 vhost 配置将只对 app.intern.domain 使用 DNS。

想法...

有没有办法告诉 apache 配置,

ProxyPass / http://10.0.1.2/

但将 app.intern.domain 作为主机名发送?

编辑 dev-servers 网络应用程序以收听 app-dev 是没有选择的,因为它应该是一个精确的副本(不是我的决定......)

谢谢!

apache-2.2
  • 3 个回答
  • 58296 Views
Martin Hope
mohrphium
Asked: 2012-07-03 00:27:12 +0800 CST

针对 ActiveDirectory 和用户文件的 Radius 授权

  • 0

我的 freeradius 服务器配置有问题。我希望能够根据 Windows ActiveDirectory (2008 R2) 和用户文件对用户进行身份验证,因为我的一些同事未在 AD 中列出。

我们使用 freeradius 服务器来验证 WLAN 用户。(PEAP/MSCHAPv2)

AD 身份验证效果很好,但 /etc/freeradius/users 文件仍然存在问题

当我运行 freeradius -X -x 时,我得到以下信息:

Mon Jul  2 09:15:58 2012 : Info: ++++[chap] returns noop
Mon Jul  2 09:15:58 2012 : Info: ++++[mschap] returns noop
Mon Jul  2 09:15:58 2012 : Info: [suffix] No '@' in User-Name = "testtest", looking up realm NULL
Mon Jul  2 09:15:58 2012 : Info: [suffix] Found realm "NULL"
Mon Jul  2 09:15:58 2012 : Info: [suffix] Adding Stripped-User-Name = "testtest"
Mon Jul  2 09:15:58 2012 : Info: [suffix] Adding Realm = "NULL"
Mon Jul  2 09:15:58 2012 : Info: [suffix] Authentication realm is LOCAL.
Mon Jul  2 09:15:58 2012 : Info: ++++[suffix] returns ok
Mon Jul  2 09:15:58 2012 : Info: [eap] EAP packet type response id 1 length 13
Mon Jul  2 09:15:58 2012 : Info: [eap] No EAP Start, assuming it's an on-going EAP conversation
Mon Jul  2 09:15:58 2012 : Info: ++++[eap] returns updated
Mon Jul  2 09:15:58 2012 : Info: [files] users: Matched entry testtest at line 1
Mon Jul  2 09:15:58 2012 : Info: ++++[files] returns ok
Mon Jul  2 09:15:58 2012 : Info: ++++[expiration] returns noop
Mon Jul  2 09:15:58 2012 : Info: ++++[logintime] returns noop
Mon Jul  2 09:15:58 2012 : Info: [pap] WARNING: Auth-Type already set.  Not setting to PAP
Mon Jul  2 09:15:58 2012 : Info: ++++[pap] returns noop
Mon Jul  2 09:15:58 2012 : Info: +++- else else returns updated
Mon Jul  2 09:15:58 2012 : Info: ++- else else returns updated
Mon Jul  2 09:15:58 2012 : Info: Found Auth-Type = EAP
Mon Jul  2 09:15:58 2012 : Info: # Executing group from file /etc/freeradius/sites-enabled/default
Mon Jul  2 09:15:58 2012 : Info: +- entering group authenticate {...}
Mon Jul  2 09:15:58 2012 : Info: [eap] EAP Identity
Mon Jul  2 09:15:58 2012 : Info: [eap] processing type tls
Mon Jul  2 09:15:58 2012 : Info: [tls] Initiate
Mon Jul  2 09:15:58 2012 : Info: [tls] Start returned 1
Mon Jul  2 09:15:58 2012 : Info: ++[eap] returns handled
Sending Access-Challenge of id 199 to 192.168.61.11 port 3072
    EAP-Message = 0x010200061920
    Message-Authenticator = 0x00000000000000000000000000000000
    State = 0x85469e2a854487589fb1196910cb8ae3
Mon Jul  2 09:15:58 2012 : Info: Finished request 125.
Mon Jul  2 09:15:58 2012 : Debug: Going to the next request
Mon Jul  2 09:15:58 2012 : Debug: Waking up in 2.4 seconds.

之后它重复登录尝试,并在某个时候尝试使用 ntlm 对 ActiveDirectory 进行身份验证,这不起作用,因为用户仅存在于用户文件中。

有人可以帮我吗?

谢谢。

PS:希望这会有所帮助,freeradius 试图针对 AD 进行身份验证:

Mon Jul  2 09:15:58 2012 : Info: ++[chap] returns noop
Mon Jul  2 09:15:58 2012 : Info: ++[mschap] returns noop
Mon Jul  2 09:15:58 2012 : Info: [suffix] No '@' in User-Name = "testtest", looking up realm NULL
Mon Jul  2 09:15:58 2012 : Info: [suffix] Found realm "NULL"
Mon Jul  2 09:15:58 2012 : Info: [suffix] Adding Stripped-User-Name = "testtest"
Mon Jul  2 09:15:58 2012 : Info: [suffix] Adding Realm = "NULL"
Mon Jul  2 09:15:58 2012 : Info: [suffix] Authentication realm is LOCAL.
Mon Jul  2 09:15:58 2012 : Info: ++[suffix] returns ok
Mon Jul  2 09:15:58 2012 : Info: ++[control] returns ok
Mon Jul  2 09:15:58 2012 : Info: [eap] EAP packet type response id 7 length 67
Mon Jul  2 09:15:58 2012 : Info: [eap] No EAP Start, assuming it's an on-going EAP conversation
Mon Jul  2 09:15:58 2012 : Info: ++[eap] returns updated
Mon Jul  2 09:15:58 2012 : Info: [files] users: Matched entry testtest at line 1
Mon Jul  2 09:15:58 2012 : Info: ++[files] returns ok
Mon Jul  2 09:15:58 2012 : Info: ++[smbpasswd] returns notfound
Mon Jul  2 09:15:58 2012 : Info: ++[expiration] returns noop
Mon Jul  2 09:15:58 2012 : Info: ++[logintime] returns noop
Mon Jul  2 09:15:58 2012 : Info: [pap] WARNING: Auth-Type already set.  Not setting to PAP
Mon Jul  2 09:15:58 2012 : Info: ++[pap] returns noop
Mon Jul  2 09:15:58 2012 : Info: Found Auth-Type = EAP
Mon Jul  2 09:15:58 2012 : Info: # Executing group from file /etc/freeradius/sites-enabled/inner-tunnel
Mon Jul  2 09:15:58 2012 : Info: +- entering group authenticate {...}
Mon Jul  2 09:15:58 2012 : Info: [eap] Request found, released from the list
Mon Jul  2 09:15:58 2012 : Info: [eap] EAP/mschapv2
Mon Jul  2 09:15:58 2012 : Info: [eap] processing type mschapv2
Mon Jul  2 09:15:58 2012 : Info: [mschapv2] # Executing group from file /etc/freeradius/sites-enabled/inner-tunnel
Mon Jul  2 09:15:58 2012 : Info: [mschapv2] +- entering group MS-CHAP {...}
Mon Jul  2 09:15:58 2012 : Info: [mschap] Creating challenge hash with username: testtest
Mon Jul  2 09:15:58 2012 : Info: [mschap] Told to do MS-CHAPv2 for testtest with NT-Password
Mon Jul  2 09:15:58 2012 : Info: [mschap]   expand: --username=%{mschap:User-Name:-None} -> --username=testtest
Mon Jul  2 09:15:58 2012 : Info: [mschap] No NT-Domain was found in the User-Name.
Mon Jul  2 09:15:58 2012 : Info: [mschap]   expand: %{mschap:NT-Domain} -> 
Mon Jul  2 09:15:58 2012 : Info: [mschap]   ... expanding second conditional
Mon Jul  2 09:15:58 2012 : Info: [mschap]   expand: --domain=%{%{mschap:NT-Domain}:-DC.COMP.COM} -> --domain=DC.COMP.COM
Mon Jul  2 09:15:58 2012 : Info: [mschap]  mschap2: 82
Mon Jul  2 09:15:58 2012 : Info: [mschap] Creating challenge hash with username: testtest
Mon Jul  2 09:15:58 2012 : Info: [mschap]   expand: --challenge=%{mschap:Challenge:-00} -> --challenge=dd441972f987d68b
Mon Jul  2 09:15:58 2012 : Info: [mschap]   expand: --nt-response=%{mschap:NT-Response:-00} -> --nt-response=7e6c537cd5c26093789cf7831715d378e16ea3e6c5b1f579
Mon Jul  2 09:15:58 2012 : Debug: Exec-Program output: Logon failure (0xc000006d) 
Mon Jul  2 09:15:58 2012 : Debug: Exec-Program-Wait: plaintext: Logon failure (0xc000006d) 
Mon Jul  2 09:15:58 2012 : Debug: Exec-Program: returned: 1
Mon Jul  2 09:15:58 2012 : Info: [mschap] External script failed.
Mon Jul  2 09:15:58 2012 : Info: [mschap] FAILED: MS-CHAP2-Response is incorrect
Mon Jul  2 09:15:58 2012 : Info: ++[mschap] returns reject
Mon Jul  2 09:15:58 2012 : Info: [eap] Freeing handler
Mon Jul  2 09:15:58 2012 : Info: ++[eap] returns reject
Mon Jul  2 09:15:58 2012 : Info: Failed to authenticate the user.
Mon Jul  2 09:15:58 2012 : Auth: Login incorrect (mschap: External script says Logon failure (0xc000006d)): [testtest] (from client techap01 port 0 via TLS tunnel)

PPS:也许问题出在这里:在 /etc/freeradius/modules/ntlm_auth 中,我将 ntlm 设置为:

program = "/usr/bin/ntlm_auth --request-nt-key --domain=DC.COMP.COM --username=%{mschap:User-Name} --password=%{User-Password}"

我需要这个,这样用户就可以在不将 @DC.COMP.COM 添加到他们的用户名的情况下登录。但是我怎么能告诉 freeradius 尝试两个登录,[email protected](应该失败)testtest(针对用户文件 - 应该工作)

radius freeradius peap
  • 1 个回答
  • 4996 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