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

Jaap Joris Vens's questions

Martin Hope
Jaap Joris Vens
Asked: 2020-11-25 01:18:32 +0800 CST

为什么 dig、host 和 nslookup 返回不同的结果?

  • 7

似乎我的默认(路由器)DNS 服务器根据用于查询它的工具返回不同的结果。

  1. 使用dig:

    $ dig @192.168.1.2 test.example.com
    
    ; <<>> DiG 9.16.8-Debian <<>> @192.168.1.2 test.example.com
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 58608
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 512
    ;; QUESTION SECTION:
    ;test.example.com.    IN  A
    
    ;; ANSWER SECTION:
    test.example.com.  41  IN  CNAME  123.123.12.123.
    
    ;; AUTHORITY SECTION:
    .      3357  IN  SOA  a.root-servers.net. nstld.verisign-grs.com. 2020112400 1800 900 604800 86400
    
    ;; Query time: 0 msec
    ;; SERVER: 192.168.1.2#53(192.168.1.2)
    ;; WHEN: Tue Nov 24 10:12:40 CET 2020
    ;; MSG SIZE  rcvd: 148
    
    

如您所见,它成功找到了 的 IP 地址test.example.com,即123.123.12.123。但是,以下两个工具没有。

  1. 使用host:

    $ host test.example.com 192.168.1.2
    Using domain server:
    Name: 192.168.1.2
    Address: 192.168.1.2#53
    Aliases: 
    
    Host test.example.com not found: 3(NXDOMAIN)
    
  2. 使用nslookup:

    $ nslookup test.example.com 192.168.1.2
    Server:    192.168.1.2
    Address:  192.168.1.2#53
    
    ** server can't find test.example.com: NXDOMAIN
    

这里发生了什么?dig为什么,host和的结果之间存在差异nslookup?他们不是都在后台执行相同的 DNS 查询吗?

编辑:正如接受的答案指出的那样,我错误地使用了 aCNAME而不是A记录。我已经更新了 DNS 条目,现在域名解析正确。

Edit2:域和 IP 是假的

domain-name-system host nslookup dig
  • 1 个回答
  • 7886 Views
Martin Hope
Jaap Joris Vens
Asked: 2020-09-15 07:41:54 +0800 CST

为什么我使用“return 444”时nginx总是关闭连接,即使有匹配的位置块?

  • 0

根据我对nginx 如何处理请求的理解,以下 nginx 配置应该会导致所有与前缀 location 匹配的请求/,从而提供HTTP/1.1 301 Moved Permanently重定向到站点 https 版本的响应。

  server {
    listen 80 default_server;

      location / {
        return 301 https://$host$request_uri;
      }
    
    return 444;
  }

然而,事实并非如此:

$ curl localhost
curl: (52) Empty reply from server

nginx 似乎更倾向于返回 444 (关闭连接)以上响应预期的重定向。

显然这个具体的例子很容易通过删除return 444语句来解决,但是我的现实生活中的配置文件是用零个或多个位置块动态生成的,我更喜欢最后的“catch-all”return 444来防止 nginx 为其内置提供服务欢迎页面。为什么这不起作用?

configuration nginx
  • 1 个回答
  • 711 Views
Martin Hope
Jaap Joris Vens
Asked: 2014-10-04 13:02:54 +0800 CST

同一个uwsgi Emperor下的不同Python版本?

  • 10

我正在运行一个带有各种 Vassal 的 uwsgi Emperor,每个 Vassal 都为来自不同 virtualenv 的特定 Python 应用程序提供服务。由于 uwsgi 是使用它自己的 Python 2.7 解释器编译的,因此尝试在其中使用带有 Python 3 的 virtualenv 会在 vassal.log 中产生以下错误:

ImportError: No module named site

我相信这个错误的根源是 uwsgi 正在使用其内置的 Python 2.7 解释器,而它运行的 virtualenv 目录仅支持 Python 3 解释器。实际上,当我使用另一个 uwsgi(只需将其安装pip install uwsgi在同一个 virtualenv 中)时,错误就会消失。但是,我希望一个皇帝统治几个不同的虚拟环境,所以在每个虚拟环境中安装一个单独的 uwsgi 不是一种选择。

根据Stackoverflow 上的这个答案,解决这个问题的正确方法是使用不同的 Python 解释器编译 uwsgi 作为可加载模块。在我采用这种方法之前,我想知道如何将我的 Vassals 配置为每个使用另一个解释器插件。

现在我有一个从我的 /etc/rc.local 启动的 Emperor 并具有以下设置:

[uwsgi]
uid = www-data
gid = www-data
master = true
emperor = /etc/uwsgi/vassals
daemonize = /var/log/uwsgi/emperor.log

然后我有一堆带有这样的ini文件的Vassal:

[uwsgi]
master = false
single-interpreter = true
socket = /tmp/%n.sock
virtualenv = /home/user/.virtualenvs/djangoproject
chdir = /home/user/djangoproject
wsgi-file = project/wsgi.py
logto = /var/log/uwsgi/%n.log

我用几个解释器插件编译 uwsgi 的调整版本没有问题,但我想知道我必须在配置中更改什么才能实际使用这些单独的解释器。我可以说一个vassal.ini:

plugin = python3.4

在另一个:

plugin = python2.7

?

请帮我弄清楚如何在同一个 uwsgi Emperor 下结合 Python 2.7 和 Python 3 virtualenvs。

python
  • 3 个回答
  • 14858 Views
Martin Hope
Jaap Joris Vens
Asked: 2014-05-16 07:03:16 +0800 CST

Postfix 和 OpenSSL:“无法获取本地颁发者证书”

  • 3

我为我的邮件服务器购买了一个证书并在 Postfix 中配置它,如下所示:

smtpd_tls_security_level=may
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_cert_file = /somepath/chain.crt
smtpd_tls_key_file = /somepath/myserver.key

我通过连接我的证书和两个中间 CA 证书来创建chain.crt每个Postfix 指令。(准确地说,首先是我自己的证书,COMODORSADomainValidationSecureServerCA.crt然后COMODORSAAddTrustCA.crt是 )根据日志,与我的邮件服务器的大多数连接现在都已加密,因此一切似乎都正常。

但是,当我使用连接到服务器时,openssl s_client -connect mail.example.com:25 -starttls smtp我得到以下输出,这似乎表明有问题:

CONNECTED(00000003)
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Certification Authority
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/OU=Domain Control Validated/OU=PositiveSSL/CN=mail.example.com
   i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA
 1 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA
   i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
 2 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
---
Server certificate
-----BEGIN CERTIFICATE-----
8<
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/OU=PositiveSSL/CN=mail.example.com
issuer=/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA
---
No client certificate CA names sent
---
SSL handshake has read 5217 bytes and written 489 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: zlib compression
Expansion: zlib compression
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: B2736D2B1639153CB8379480ACDBC1F0B1DCC51DE7CC27DA59061740F0186EA1
    Session-ID-ctx: 
    Master-Key: 9EE658D6B1835F94D140E7BBF05A5A8960566584A8BC6FF40DD5D038C70127A63BAB580A41BC55DEEA3C031FCC7FA550
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 3600 (seconds)
    TLS session ticket:
    0000 - 09 8a 6d 68 70 0c 64 c0-23 2e fc f2 d4 21 ca bd   ..mhp.d.#....!..
    0010 - 0a 15 4f 36 06 a8 ea f9-e2 84 de 18 cf 31 af 77   ..O6.........1.w
    0020 - 2a a1 98 d5 f8 df 54 48-82 68 cb c3 91 9b 38 60   *.....TH.h....8`
    0030 - dc 2e 18 f4 b9 bd 43 3e-26 cf 80 49 48 bb a4 98   ......C>&..IH...
    0040 - bc 94 7d 1e 5f 51 7e 52-d6 ad 7f 8b e5 36 ee 55   ..}._Q~R.....6.U
    0050 - 7a bb 15 d3 c2 7f b2 f4-5a 85 a5 80 1b 9e 67 98   z.......Z.....g.
    0060 - 3a 2f 5c d1 34 d5 bb 11-c7 8f fc 10 cb c3 b4 cb   :/\.4...........
    0070 - 49 61 41 ac aa b1 cb eb-6f 7a 22 e5 79 a2 c6 1f   IaA.....oz".y...
    0080 - 98 25 39 f0 f0 79 b4 ee-95 72 93 04 0f a2 f3 69   .%9..y...r.....i
    0090 - 8f 8a 86 c6 8f a5 38 ed-25 ba fc c8 db 6b 9a 8e   ......8.%....k..
    00a0 - 13 1e e5 c6 28 98 e4 17-ce 69 d5 c2 aa 1a de 4b   ....(....i.....K

    Compression: 1 (zlib compression)
    Start Time: 1400131328
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---

此外,在运行时,openssl verify chain.crt我收到相同的错误消息:

chain.crt: OU = Domain Control Validated, OU = PositiveSSL, CN = mail.example.com
error 20 at 0 depth lookup:unable to get local issuer certificate

我尝试添加AddTrustExternalCARoot.crt到末尾chain.crt,使错误消息更改为verify error:num=19:self signed certificate in certificate chain. 此外,我连接的机器已经安装了这个证书,所以应该不需要它。

所以我的问题是:我的邮件服务器有问题还是我只是openssl错误地使用了命令?我是否应该在链中包含根证书?

postfix
  • 1 个回答
  • 17423 Views
Martin Hope
Jaap Joris Vens
Asked: 2014-04-28 15:10:09 +0800 CST

什么域名应该出现在 DKIM 签名中?

  • 6

我按照这些说明使用 Postfix 设置 OpenDKIM,它的工作原理与宣传的一样。我的外发邮件添加了 DKIM-Signature 标头,例如:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=example.com; s=mail;
t=1398638300; bh=mk/7yYUxFCWz+ZHB0opJIA/S3J5ELoPZPfAO0KQdVg4=;
h=Date:From:To:Subject:From;
b=fPPfUliJUgA0re38nkJ2R18TeFgbamOv1U8nDb9958eTeAT6Mp7oq4WGrHPiPmc+b
mrLu9RuW0/S4d0ipkilNZDxgecwl7qttrDbTEkWxdhwwTSe5FL3OBaUoUxJFrMGjmY
RdBjY5ZWtvk29+gXZ+af5Of9OrY7COLlqGkFXRXw=

我的问题是关于d=上面的参数。如果一个邮件服务器处理多个虚拟域的外发邮件,d= 是否应该包含发送邮件的邮件服务器?还是应该是 From: 地址中出现的域?

我试图阅读关于这个主题的RFC 6376,但我发现的唯一相关位是:

  d= The SDID claiming responsibility for an introduction of a message
  into the mail stream [...]  The conventions and semantics used by a Signer to
  create and use a specific SDID are outside the scope of this specification

我希望这里有人知道在实践中如何使用 d= 参数。

postfix
  • 5 个回答
  • 5280 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