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

Wayne Werner's questions

Martin Hope
Wayne Werner
Asked: 2022-02-01 13:45:04 +0800 CST

为什么 Outlook 只连接到我的服务器而不发送任何电子邮件?

  • 0

我从 Gmail 或我注册的任何邮件列表接收电子邮件都没有任何问题,但由于某种原因 Outlook 拒绝向我的邮件服务器发送任何电子邮件。

_handle_client readline: b'EHLO NAM02-BN1-obe.outbound.protection.outlook.com\r\n'                                                                                                           │
('52.100.160.208', 55618) >> b'EHLO NAM02-BN1-obe.outbound.protection.outlook.com'                                                                                                           │
('52.100.160.208', 55618) << b'250-0.0.0.0'                                                                                                                                                  │
('52.100.160.208', 55618) << b'250-SIZE 33554432'                                                                                                                                            │
('52.100.160.208', 55618) << b'250-8BITMIME'                                                                                                                                                 │
EHLO from 'NAM02-BN1-obe.outbound.protection.outlook.com'                                                                                                                                    │
('52.100.160.208', 55618) << b'250-AUTH PLAIN\n250-MAIL\n250 HELP'   

最初我认为这可能是因为 Outlook 正在使用 TLS 进行某种恶作剧 - 但从响应中完全删除 STARTTLS 并没有帮助。不管有没有 STARTTLS,Outook 都会连接到我的邮件服务器,发出 EHLO,然后就……放弃了?我其实不知道。

但它确实告诉我一个谎言:

1/29/2022 4:39:30 PM - Server at BYAPR05MB6069.namprd05.prod.outlook.com returned '550 5.4.317 Message expired, cannot connect to remote server(451 4.4.0
Socket error SocketError)'
1/29/2022 4:27:02 PM - Server at waynewerner.com (104.236.246.170) returned '450 4.4.317 Cannot connect to remote server [Message=451 4.4.0 Socket error
SocketError] [LastAttemptedServerName=waynewerner.com] [LastAttemptedIP=104.236.246.170:25] [BN7NAM10FT066.eop-nam10.prod.protection.outlook.com](451 4.4.0
Socket error SocketError)'

我的服务器没有返回450 4.4.317我在日志中可以看到的任何内容。我什至在我的服务器源代码中都没有看到支持响应的任何地方。Outlook在故障邮件中提供https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/mail-flow-intelligence-in-office-365?view=o365-worldwide ,但以下信息:

Error code: 450 4.4.317 Cannot connect to remote server

Typically, this error means Microsoft 365 connected to the destination email server, but the server responded with an immediate error, or doesn't meet the connection requirements. The error details will explain the problem. For example:

    The destination email server responded with a "Service not available" error, which indicates the server is unable to maintain communication with Microsoft 365.
    The connector is configured to require TLS, but the destination email server doesn't support TLS.

也似乎 Outlook 做错了什么。将其与 Google 完全合理的方法进行比较:

_handle_client readline: b'EHLO mail-vk1-f175.google.com\r\n'
('209.85.221.175', 42948) >> b'EHLO mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-0.0.0.0'
('209.85.221.175', 42948) << b'250-SIZE 33554432'
('209.85.221.175', 42948) << b'250-8BITMIME'
('209.85.221.175', 42948) << b'250-STARTTLS'
EHLO from 'mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-AUTH PLAIN\n250-STARTTLS\n250 HELP'
_handle_client readline: b'STARTTLS\r\n'
('209.85.221.175', 42948) >> b'STARTTLS'
('209.85.221.175', 42948) << b'220 Ready to start TLS'
_handle_client readline: b'EHLO mail-vk1-f175.google.com\r\n'
('209.85.221.175', 42948) >> b'EHLO mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-0.0.0.0'
('209.85.221.175', 42948) << b'250-SIZE 33554432'
('209.85.221.175', 42948) << b'250-8BITMIME'
('209.85.221.175', 42948) << b'250-AUTH LOGIN PLAIN'
EHLO from 'mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-AUTH PLAIN\n250-STARTTLS\n250-MAIL\n250 HELP'
_handle_client readline: b'MAIL FROM:<[email protected]> SIZE=3159\r\n'

在这里,我们看到 Gmail:

  • EHLO
  • 获取响应,包括 STARTTLS
  • STARTTLS 的
  • 开始发送邮件

与 Outlook 相比:

  • EHLO
  • 没有其他的

我什至仔细检查过,看起来 Outlook 之后甚至没有再发送一个字节的数据。

几分钟后,连接看起来会超时,等待 Outlook 发送数据:

[2022-01-31 18:04:54,355][mail.log][INFO] ('40.107.93.71', 64992) >> b'EHLO NAM10-DM6-obe.outbound.protection.outlook.com'
[2022-01-31 18:04:54,356][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-0.0.0.0'
[2022-01-31 18:04:54,356][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-SIZE 33554432'
[2022-01-31 18:04:54,357][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-8BITMIME'
[2022-01-31 18:04:54,358][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-STARTTLS'
[2022-01-31 18:04:54,359][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-AUTH PLAIN\n250-MAIL\n250 HELP'
[2022-01-31 18:04:54,359][mail.log][DEBUG] ('40.107.93.71', 64992) reading data...
[2022-01-31 18:04:54,360][mail.log][DEBUG] ('40.107.93.71', 64992) peeking
[2022-01-31 18:09:54,356][mail.log][INFO] ('40.107.93.71', 64992) connection timeout
[2022-01-31 18:09:54,358][mail.log][INFO] ('40.107.93.71', 64992) connection lost

任何线索我没有提供的 Outlook 可能在这里寻找什么?

email smtp outlook
  • 1 个回答
  • 318 Views
Martin Hope
Wayne Werner
Asked: 2019-08-24 07:34:16 +0800 CST

带有透明端口/代理的 Nginx 映射(?)

  • 1

我不完全确定我在这里寻找的是什么,所以我无法有效地搜索我的答案。

我正在为 LetsEncrypt 的 TLS-ALPN 挑战使用脱水。我正在使用 nginx 托管服务

stream {
    map $ssl_preread_alpn_protocols $tls_port {
        ~\bacme-tls/1\b 10443;
        default 3443;
    }

    server {
        listen 443;
        listen [::]:443;
        proxy_pass 127.0.0.1:$tls_port;
        ssl_preread on;
    }
}

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
}

server {
    listen 3443 ssl;
    listen [::]:3443 ssl;

    server_name wanderingwerners.com www.wanderingwerners.com;

    ssl_certificate /path/to/my/fullchain.pem;
    ssl_certificate_key /path/to/my/privkey.pem;

    index index.html;
    root /var/www/wanderingwerners.com/;
}

这非常有效——我可以获得零停机时间的新证书,并且我的网站可以访问。但是,当我访问我的页面时,它工作正常。当我将鼠标悬停在链接上时,它会显示我https://www.wanderingwerners.com/a-beginning/

但是,单击该链接会将我带到https://www.wanderingwerners.com:3443/a-beginning/

这是不可取的-我希望它显示为普通的' https://www.wanderingwerners.com/a-beginning/

我假设我在 nginx 中设置的东西是造成混乱的原因,但我并不肯定。

有没有办法可以更新我的 nginx 配置以仍然允许脱水服务器工作,但也告诉浏览器这:3443不是他们应该连接的真正内容?(或者至少不要在地址栏中显示)

更新

当我这样做curl https://www.wanderingwerners.com/a-beginning时,它会给我一个 301 重定向。我的 nginx 配置在这里肯定发生了一些事情。

另一个更新

当我这样做时curl https://www.wanderingwernerx.com/a-beginning/,它工作得很好,所以看起来它正在用尾随做某事/

nginx
  • 2 个回答
  • 426 Views
Martin Hope
Wayne Werner
Asked: 2019-03-19 09:15:48 +0800 CST

如何获得 ssl_preread_alpn_protocols 用于使用 nginx 1.14 的 acme-tls 请求?

  • 1

我正在尝试配置 Nginx 以支持 Let's Encrypt with TLS-ALPN-01 using dehydrad。在他们的文档中,他们有以下内容告诉 Nginx 负载平衡将请求定向到可以提供 TLS-ALPN-01 挑战的服务器。这是 Nginx 配置:

stream {
  server {
    map $ssl_preread_alpn_protocols $tls_port {
      ~\bacme-tls/1\b 10443;
      default 443;
    }

    server {
      listen 443;
      listen [::]:443;
      proxy_pass 10.13.37.42:$tls_port;
      ssl_preread on;
    }
  }
}

当我把它放在我的/etc/nginx/nginx.conf它抱怨流指令时。我发现一些信息说要将此行添加到我的配置顶部:

load_module /usr/lib/nginx/modules/ngx_stream_module.so;

这摆脱了那个抱怨,但是有了这个配置:

load_module /usr/lib/nginx/modules/ngx_stream_module.so;
user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

stream {
  server {
    map $ssl_preread_alpn_protocols $tls_port {
      ~\bacme-tls/1\b 10443;
      default 443;
    }

    server {
      listen 443;
      listen [::]:443;
      proxy_pass 10.13.37.42:$tls_port;
      ssl_preread on;
    }
  }
}

我收到这个错误

nginx: [emerg] "map" directive is not allowed here in /etc/nginx/nginx.conf:13
nginx: configuration file /etc/nginx/nginx.conf test failed

那么我需要做什么才能正确地让它map工作呢?我必须加载另一个模块吗?

nginx
  • 2 个回答
  • 1843 Views
Martin Hope
Wayne Werner
Asked: 2018-11-16 21:38:12 +0800 CST

为什么我的码头工人实际上没有记录任何东西?

  • 4

我有以下python文件:

 import time
 from datetime import datetime


 while True:
     time.sleep(1)
     print(datetime.now())

我已将其添加到 Dockerfile:

FROM python:3.7


WORKDIR /test
COPY test.py /test/
CMD ["python", "test.py"]

如果我构建它并运行

sudo docker run -it --name test myimage

一切都很棒。每隔一秒左右,它就会打印当前时间。

另一方面,如果我运行它:

sudo docker run -d --name test myimage

它跑到后台,但如果我这样做......

sudo docker logs test

我什么都得不到!不是什么可恶的事情。

任何线索为什么会发生这种情况,或者我怎么能弄清楚?在我使用时而-d不是在运行时docker inspect它都给了我"Type": "json-file", "Config": {}

我在 Ubuntu 18.04 上运行 Docker 18.06.1-ce,构建 e68fc7a。

logging
  • 1 个回答
  • 12019 Views
Martin Hope
Wayne Werner
Asked: 2017-10-12 13:30:28 +0800 CST

如何使用 nginx 使用自己的证书设置多个子域?

  • 10

除非我读过的每个答案都是完全错误的,否则 SNI 应该可以做我想做的事,但每个指南都告诉我做我正在做的事。

然而 nginx 提供了错误的证书,所以我显然做错了什么。

❯ sudo nginx -V | grep SNI                                                                                                                                                                                                                                                            %1
nginx version: nginx/1.10.3
built with OpenSSL 1.1.0f  25 May 2017
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-qJwWoo/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/ngi
nx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fa
stcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_reques
t_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --wit
h-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-qJwWoo/nginx-1.10.3/debian/modules/nginx-auth-pam --add-dynamic-module=/build/nginx-qJwWoo/nginx-1.10.3/debian/modules/nginx-dav-
ext-module --add-dynamic-module=/build/nginx-qJwWoo/nginx-1.10.3/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-qJwWoo/nginx-1.10.3/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-qJwWoo/nginx-1.10.3/debian/modules/ngx_http_substitutions_filter_m
odule

这是我的配置的样子:

server {
  listen 443 ssl default_server;
  listen [::]:443 ssl;

  server_name one.example.com;

  ssl on;
  ssl_certificate       /etc/letsencrypt/live/one.example.com/fullchain.pem;
  ssl_certificate_key   /etc/letsencrypt/live/one.example.com/privkey.pem;

  index index.html;
  root /var/www/one.example.com/site;
}

server {
  #listen 443 ssl default_server;
  listen [::]:443 ssl;

  server_name two.example.com;

  ssl on;
  ssl_certificate       /etc/letsencrypt/live/two.example.com/fullchain.pem;
  ssl_certificate_key   /etc/letsencrypt/live/two.example.com/privkey.pem;

  index index.html;
  root /var/www/two.example.com/site;
}

如果我listen 443 ssl default_server;在任一服务器中都有该指令,它将为两个域返回该服务器的 SSL 证书。如果我从两个域中删除它,那么我什么也得不到——两个服务器域都拒绝连接。

我在这里出了什么问题?我只是不明白 SNI 是如何工作的吗?我的 nginx 是在启用 SNI 支持的情况下构建的。然而......我只获得了为一个子域提供的 ssl 证书。

nginx
  • 2 个回答
  • 2419 Views
Martin Hope
Wayne Werner
Asked: 2016-12-29 09:05:51 +0800 CST

如何获得 postfix 以将传入的电子邮件中继到特定的主机并将传出的邮件中继到所需的任何主机?

  • 3

我有一个这样的后缀设置:

     __________                     +-----+     |F|        +-----+
  __(          )____               /     /|     |I|       /     /|
 (___  (         ___)             /     / |     |R|      /     / |
    _(  Internet )     <=====>   +-----+  |  <==|E|==>  +-----+  |
   (___,     )   _)              |  M  |  |     |W|     |  H  |  |
       (_________)               |  A  |  +     |A|     |  O  |  +
                                 |  I  | /      |L|     |  S  | /
                                 |  L  |/       |L|     |  T  |/
                                 +--+--+        | |     +-----+

我现在已经配置好将电子邮件从 中继mail到host。这是postconf -non的输出mail:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
message_size_limit = 41943040
mydestination =
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 203.0.113.190
readme_directory = no
recipient_delimiter = +
relay_domains = host.example.com, example.com, example.org,
relayhost = [host.example.com]:587
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_loglevel = 1
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination,
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination,
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous, noplaintext,
smtpd_sasl_tls_security_options = noanonymous,
smtpd_sasl_type = cyrus
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5,
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3,
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
tls_preempt_cipherlist = yes

这非常有效 - 我可以从 gmail 和其他提供商发送邮件,并且它们正确地在我的邮箱中结束host。

但是,当我尝试从 发送电子邮件时,我host很确定它正在尝试将电子邮件从. 我在日志中看到了这一点:mailhosthost

Dec 28 16:44:28 host postfix/submission/smtpd[29743]: warning: hostname mail2.example.com does not resolve to address 203.0.113.14: Name or service not known
Dec 28 16:44:28 host postfix/submission/smtpd[29743]: connect from unknown[203.0.113.14]
Dec 28 16:44:28 host postfix/submission/smtpd[29743]: Anonymous TLS connection established from unknown[203.0.113.14]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Dec 28 16:44:28 host postfix/submission/smtpd[29743]: NOQUEUE: reject: RCPT from unknown[203.0.113.14]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<example.com>
Dec 28 16:44:28 host postfix/submission/smtpd[29743]: disconnect from unknown[203.0.113.14]

然后mail我得到这些日志:

Dec 28 16:54:27 mail postfix/smtp[17899]: Untrusted TLS connection established to host.example.com[203.0.113.190]:587: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Dec 28 16:54:28 mail postfix/smtp[17899]: 7B6A620FFB: to=<[email protected]>, relay=host.example.com[203.0.113.190]:587, delay=1064, delays=1063/0.01/0.71/0.08, dsn=4.7.1, status=deferred (host host.example.com[203.0.113.190] said: 454 4.7.1 <[email protected]>: Relay access denied (in reply to RCPT TO command))

上host,这是我的postconf -n输出:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
message_size_limit = 41943040
mydestination = host, host.example.com, example.com
myhostname = host.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relay_domains = $mydestination
relayhost = example.com:587
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_loglevel = 1
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination,
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination,
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous, noplaintext,
smtpd_sasl_tls_security_options = noanonymous,
smtpd_sasl_type = cyrus
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5,
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3,
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
tls_preempt_cipherlist = yes
postconf: warning: /etc/postfix/main.cf: unused parameter: compatibility_level=2

基本上我想要的:

开host或mail:

  • 如果电子邮件发送到wayne@host, wayne@mail, [email protected], [email protected],[email protected]我希望将其发送给 `host.
  • 如果电子邮件被发送到其他任何地方- [email protected]、[email protected]或[email protected]它碰巧在的任何地方 - 我想host通过 中继mail,并且我想mail将电子邮件发送到它应该发送到的任何服务器。

如何配置后缀以正确执行此操作?

email proxy postfix
  • 1 个回答
  • 3449 Views
Martin Hope
Wayne Werner
Asked: 2016-09-23 11:44:04 +0800 CST

如何使用 Namecheap 正确设置 Letsencrypt 的 TXT 记录?

  • 2

我正在尝试使用手册应用程序向Letsencrypt注册我的域,但我遇到了这个问题:

urn:acme:error:connection

这是我运行它的方式:

⚘ manuale authorize home.waynewerner.com waynewerner.com
Requesting challenge for home.waynewerner.com.
Requesting challenge for waynewerner.com.
DNS verification required. Make sure these TXT records are in place:
  _acme-challenge.waynewerner.com.  IN TXT  "<Some key>"
  _acme-challenge.home.waynewerner.com.  IN TXT  "<some other key>"

所以我登录了我的 namecheap 仪表板,并在我的主机记录中添加了两个新的 TXT 记录。在主机领域,我尝试了两种方式,使用@andhome和 with _acme-challenge.waynewerner.comand _acme-challenge.home.waynewerner.com。然后值字段包含<Some key>和<some other key>(不带引号)。

但我仍然得到:

home.waynewerner.com: waiting for verification. Checking in 5 seconds.
home.waynewerner.com: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.home.waynewerner.com (urn:acme:error:connection)
waynewerner.com: waiting for verification. Checking in 5 seconds.
waynewerner.com: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.waynewerner.com (urn:acme:error:connection)
0 domain(s) authorized, 2 failed.
Authorized: N/A
Failed: home.waynewerner.com waynewerner.com

我在这里做错了什么?我已经验证如果我使用@andhome主机然后

dig -t txt home.waynewerner.com
dig -t txt waynewerner.com

两者都提供了我在 DNS 中设置的密钥。

domain-name-system lets-encrypt
  • 1 个回答
  • 11138 Views
Martin Hope
Wayne Werner
Asked: 2016-01-29 09:43:41 +0800 CST

在 Centos7 上生成 /etc/audit/audit.rules 的正确方法是什么?

  • 4

/etc/audit/audit.rules在Centos7的顶部,它告诉我:

## This file is automatically generated from /etc/audit/rules.d

好的,所以我去看看,发现/etc/audit/rules.d/audit.rules。它有以下行

# Feel free to add below this line. See auditctl man page

我做了,发现看起来可能是选项:

 -R file
        Read rules from a file. The rules must be 1 per line and in the order that they are to be executed in. The rule file must  be
        owned  by  root  and not readable by other users or it will be rejected. The rule file may have comments embedded by starting
        the line with a '#' character. Rules that are read from a file are identical to what you would type on a command line  except
        they  are  not preceded by auditctl (since auditctl is the one executing the file) and you would not use shell escaping since
        auditctl is reading the file instead of bash.

但是我跑了auditctl -R /etc/audit/rules.d/audit.rules这似乎工作,但它没有做任何事情/etc/audit/audit.rules。

重新生成该文件的正确方法是什么?

configuration
  • 2 个回答
  • 20765 Views
Martin Hope
Wayne Werner
Asked: 2016-01-05 15:09:16 +0800 CST

rsyslog 是否可以创建目录?

  • 2

设置

我有这个/etc/rsyslog.conf:

$template local1DynFile,"/path/to/my/log/%programname%.log.%NOW%
$template local1LogFormat,"%msg:2:$:%\n"

*,*;auth,authpriv,local0,local1.none          ~/var/log/syslog

local1.*                                      ?local1DynFile;local1LogFormat

然后我有以下 Python 脚本 ( test.py):

import logging
import logging.handlers

logger = logging.getLogger('pxet.foo')
logger.addHandler(logging.handlers.SysLogHandler(address='/run/systemd/journal/syslog', facility='local1'))
logger.handlers[0].setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)

logger.debug('test cockroach is a bug')

问题

如果我执行以下操作:

rm -rf /path/to/my/log
systemctl restart rsyslog
python test.py

我没有收到日志消息。然而:

mkdir -p /path/to/my/log
python test.py

这一切都有效。

问题

如果目录不存在,我是否可以rsyslog创建目录,还是我必须自己创建?

rsyslog
  • 1 个回答
  • 8044 Views
Martin Hope
Wayne Werner
Asked: 2016-01-05 09:05:11 +0800 CST

为什么我的 SELinux 没有记录任何内容?

  • 3

我有一个偷偷摸摸的怀疑,这与我在我的 rsyslog.conf 中胡闹有关,但我对此不是 100% 确定的。

我正在运行 Centos 7,SELinux 一直在正常工作。但是,我尝试按照这些说明进行操作,SELinux 没有否认。

我做了以下事情:

useradd fnord
echo "fnord:user_u:s0-s0:c0.c1023" >> /etc/selinux/targeted/seusers
setsebool user_exec_content off
sudo su - fnord
cp /bin/ls /tmp
/tmp/ls

该/tmp/ls命令工作得很好。我尝试了使用和不使用-P标志,但这没有任何区别。

我正在尝试触发一些 SELinux 日志消息,因为/var/audit/audit.log无论我做什么都是空的。我知道 SELinux 正在强制执行,因为 rsyslog 设置为将某些日志发送到/company/var/log/,但这些日志不会被写入。如果我将 SELinux 更改为许可而不是强制执行,它们确实会被写入。但是没有任何东西可以写/var/audit/audit.log了。它肯定曾经 - 我有audit.log.1和其他翻转的文件。

我最初认为它可能是/etc/rsyslog.d/listen.conf,我已经将内容从更改为$SystemLogSocketName /run/systemd/journal/syslog,$SystemLogSocketName /dev/log但我已经将其更改回来并重新启动了 rsyslog。仍然没有出现在audit.log.

我怎样才能发现为什么这不能正确记录?

logging
  • 1 个回答
  • 4138 Views
Martin Hope
Wayne Werner
Asked: 2015-12-02 12:09:23 +0800 CST

如果命令打印零行,我如何运行盐状态?

  • 0

我在 CentOS7 上运行了 Salt 和 SELinux。

我想跑步restorecon -Rv /path/to/something,但只有在必要时。我知道 Salt 有onlyifandunless命令,但我有一段时间在谷歌上搜索我想要的东西。我想为此写一些东西:

Fix SELinux Permissions:
  cmd.run:
    - name: restorecon -Rv /path/to/something
    - onlyif: restorecon -Rv -n /path/to/something produces any lines

我已经尝试过返回码,但它始终为 0。我实际上并不想在每次运行状态时都运行此命令 - 只是在 dir 实际需要更改时。否则 salt 会报告它运行了命令并且即使没有真正的变化也会发生变化。

我怎样才能让它以我想要的方式工作?

selinux
  • 1 个回答
  • 511 Views
Martin Hope
Wayne Werner
Asked: 2015-11-21 14:02:26 +0800 CST

在 CentOS7 上哪里可以得到 libcgroup 和 policycoreutils-python?

  • 2

我有一个从 Vagrant 创建的 VM centos/7。

我正在尝试安装 docker,但它不起作用。我尝试使用 SaltStack minion和just vagrant sshand sudo yum install. 但它告诉我它找不到这些依赖项:

--> Finished Dependency Resolution
Error: Package: docker-engine-1.9.1-1.el7.centos.x86_64 (docker_repo)
           Requires: libcgroup
Error: Package: docker-engine-selinux-1.9.1-1.el7.centos.noarch (docker_repo)
           Requires: policycoreutils-python
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我认为任何一个建议的解决方案都不能满足我的需要。我已经用谷歌搜索了,但我得到的只是 rpmfind 或 rpmbone 的链接,当然,它们可能提供我可以下载的 rpm,但我很确定这些应该在某个存储库中。

yum repolist给了我这个:

repo id                                                                  repo name                                                                                             status
docker_repo                                                              Docker Repository                                                                                        14
*epel/x86_64                                                             Extra Packages for Enterprise Linux 7 - x86_64                                                        8,842
extras/7/x86_64                                                          CentOS-7 - Extras                                                                                       278
repo-saltstack-el7                                                       SaltStack EL7 Repo                                                                                       92
updates/7/x86_64                                                         CentOS-7 - Updates                                                                                    1,726
repolist: 10,952
centos
  • 1 个回答
  • 4729 Views
Martin Hope
Wayne Werner
Asked: 2014-12-23 13:02:08 +0800 CST

如何通知 HAProxy 我的服务器已备份?

  • 2

我是一个 HAProxy 新手——我有 3 个 docker 容器,一个运行 HAProxy,配置如下:

global                                                                             
  log 127.0.0.1 local0                                                             
  log 127.0.0.1 local1 notice                                                      
  chroot /var/lib/haproxy                                                          
  user haproxy                                                                     
  group haproxy                                                                    
  stats socket /var/run/haproxy.sock mode 600 level admin                          
  # daemon                                                                         

defaults                                                                           
  log global                                                                       
  mode http                                                                        
  option httplog                                                                   
  option dontlognull                                                               
  timeout connect 5000ms                                                           
  timeout client 50000ms                                                           
  timeout server 50000ms                                                           
  balance source                                                                   

listen stats :80                                                                   
  stats enable                                                                     
  stats uri /haproxy?stats                                                         
  stats realm Strictly\ Private                                                    
  stats auth test:test1234                                                         
  balance roundrobin                                                               
  #option forwardfor                                                               
  default_backend myserv-legacy                                                    

backend myserv-legacy                                                              
  cookie SERVERID insert indirect preserve                                         
  server myserv-A ${MYSERVA_PORT_8080_TCP_ADDR}:8080 cookie A check               
  server myserv-B ${MYSERVB_PORT_8080_TCP_ADDR}:8080 cookie B check  

其他两台服务器正在使用 Tomcat 运行 webapp。

我用 关闭了我的两台服务器sudo docker stop myservA myservB,虽然我已经启动了它们并且可以通过它们暴露的端口连接到它们,但它们在 HAProxy 中都显示为L4TOUT在 2000 毫秒内关闭。

任何线索为什么他们不会显示为可用?

编辑:

如果我跑

$ sudo docker stop haprox && sudo docker start haprox

(haprox 是我的 HAProxy 容器的名称)然后我的服务器再次可用......

haproxy
  • 1 个回答
  • 1526 Views
Martin Hope
Wayne Werner
Asked: 2014-04-08 09:45:10 +0800 CST

postfix 默认会尝试所有的 MX 记录吗?

  • 1

防止垃圾邮件发送者占用您的 SMTP 服务器的一种技术是将您的最低 MX 记录设置为假的。

我遇到了 Postfix 无法连接到有意义的使用传输测试工具的问题。

来自 mail.log:

4 月 7 日 12:03:11 myserver postfix/smtp[36868]: 1F119B60AEC: to=, relay=none, delay=265111, delays=265110/0.06/0/0, dsn=4.4.1, status=deferred (connect to transport-testing.dnsops.gov[129.6.24.80]:25:连接被拒绝)

我可以从 Outlook 或 Gmail 向 TTT 发送电子邮件,所以我知道这很有效。如果连接被拒绝,Postfix 是否会尝试访问其他 MX 记录?

postfix
  • 1 个回答
  • 1098 Views
Martin Hope
Wayne Werner
Asked: 2012-12-28 13:07:07 +0800 CST

如何让 Nginx 作为反向代理将身份验证传递给 IIS?

  • 3

我的 Nginx(Windows 7 上为 1.2.6)conf 文件中有以下设置:

location ~ ^/FOO/(.*)$ {
    proxy_pass    http://server_two:8888/FOO/$1;
}

在server_two我的 IIS7 上运行使用基本身份验证的 WCF 服务。当我访问时,http://server_two:8888/FOO/Service.svc?wsdl我得到了正确的端点。

当我访问时,http://myhost/FOO/Service.svc?wsdl我会弹出一个用户/通行证框。我可以输入我的凭据,直到奶牛回家,但仍然一无所获。我还尝试了以下内容:

location ~ ^/FOO/(.*)$ {
    proxy_pass    http://server_two:8888/FOO/$1;
    proxy_set_header Host $host;
    proxy_set_header X-Accel-Expires 0;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

和其他几个变体,但到目前为止我还无法使登录过程正常工作。Nginx 可以吗?我错过了什么?

更新:

我忘了说,IIS 设置为对 Windows 身份验证进行 HTTP 401 质询

nginx
  • 2 个回答
  • 10071 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