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

Neel's questions

Martin Hope
Neel
Asked: 2019-09-09 23:00:58 +0800 CST

将 300GB 数据从 Linux 服务器迁移到 S3 存储桶

  • 3

我有一个 linux 专用服务器,它有 300GB 的上传文件,我需要将这些文件传输到 AWS Storage S3,因为我现在将上传内容更改为保存在 S3 存储桶而不是本地磁盘中。我读到我可以使用 aws cli 命令将目录复制到 S3 存储桶进行传输。我的问题是:

  1. 当我cp从 aws cli 执行命令时,专用服务器将 300GB 数据传输到 S3 存储桶大约需要多长时间?S3 和服务器都在同一个区域。

这些是我的服务器规格:

RAID Policy Raid 1
Operating System    Cloud Linux
HDD Bay 1   480GB SSD
HDD Bay 2   480GB SSD
Network Bandwidth   10TB
CPU 6 Core E5-2620v2 - 2.00Ghz x2
RAM 64 GB

我完全理解有很多变量,但是想从将数据从 linux 服务器迁移到 S3 存储的人那里得到一个粗略的估计。

  1. 当我使用 aws clicp命令时,它会显示那段时间内的进度吗?如果我在命令仍在运行时与 SSH 断开连接会发生什么?

  2. cp使用命令运行 aws cli 命令对我来说更安全screen吗?

  3. 在传输过程中,服务器性能会受到影响吗?该服务器有几个网站正在运行,所以在数据传输期间我是否需要使网站脱机,或者即使网站处于活动状态,我也可以安全地运行传输?

linux
  • 2 个回答
  • 651 Views
Martin Hope
Neel
Asked: 2016-01-07 00:58:40 +0800 CST

Postfix 发送到 FQDN 主机名而不是域名

  • 6

我已经安装了只发送后缀。当我向完整的电子邮件地址发送邮件时,Postfix 有效。但是,如果要向用户发送邮件,它会将 FQDN 名称添加为扩展名,而不仅仅是我在安装过程中设置的域名。

例如,当我像这样从 ssh 发送邮件时:

echo "This will go into the body of the mail." | mail -s "Hello world" root

我想要邮件去[email protected]。但是电子邮件被发送到[email protected].

我已经查看了我的主机设置、邮件名设置、后缀设置,但我不知道为什么它不断向其中添加完整的主机名,这显然会被退回。这是我的配置文件:

后缀 main.cf:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = host.example.com.au
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only

virtual_alias_maps = hash:/etc/postfix/virtual

别名:

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root

/etc/postfix/虚拟:

root            [email protected]

/etc/邮件名:

example.com.au

/etc/主机:

127.0.0.1       localhost
11x.0.0.xxx   host.example.com.au    host

/etc/主机名

host

我已经审查了所有内容,但我不知道为什么邮件发送到@host.example.com.au. 有人可以帮我吗?

我在Debian 8上。

编辑: 刚才,我尝试在 main.cf 文件中再添加一个设置:masquerade_domains = $mydomain. 添加这个似乎可以修复from地址以显示我的域名而不是主机名,但to地址仍然具有 FQDN 名称。我在我的电子邮件地址上收到退回的电子邮件“邮件传递系统”通知,因为原始电子邮件现在在添加之后masquerade_domains,但我仍然无法理解为什么用户电子邮件不尊重相同并且to地址仍然被寻址为[email protected]而不是[email protected].

myhostname = host.example.com.au
mydomain = example.com.au
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
masquerade_domains = $mydomain
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
debian
  • 3 个回答
  • 12690 Views
Martin Hope
Neel
Asked: 2015-01-24 05:30:31 +0800 CST

存在 Txt 记录时 SPF Softfail

  • 0

我收到了 SPF 和 Sender-ID 的软故障,我通过向[email protected].

我的设置:

  • 1 个 VPS 托管 1 个网站

  • 仅发送电子邮件的后缀

  • 没有收到的电子邮件。收件由 Gmail 处理

我在 DNS 中的 Txt 记录是(只有 1 个 txt 记录):

"v=spf1 a include:_spf.google.com ~all"

我的 A 记录是:

域名:example.com.au

VPS机器名称:主机

@       123.12.12.123     <----- My VPS IP Address
host    123.12.12.123   

直到 2 天前,它还在工作,我还没有做任何改变。但是现在我收到以下消息的软故障。

认证报告

    ----------------------------------------------------------
SPF check details:
----------------------------------------------------------
Result:         softfail (SPF-Result: SoftFail)
ID(s) verified: [email protected]
DNS record(s):
    example.com.au. SPF (no records)
    example.com.au. 600 IN TXT "v=spf1 a include:_spf.google.com ~all"
    example.com.au. 600 IN TXT "google-site-verification=TyBn81xyFF2Qt3icqC8tD-EyZxwhKS1ce5AV6StaxHs"
    example.com.au. AAAA (no records)
    _spf.google.com. SPF (no records)
    _spf.google.com. 300 IN TXT "v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all"
    _netblocks.google.com. SPF (no records)
    _netblocks.google.com. 3600 IN TXT "v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.208.0/20 ip4:216.239.32.0/19 ~all"
    _netblocks2.google.com. SPF (no records)
    _netblocks2.google.com. 3600 IN TXT "v=spf1 ip6:2001:4860:4000::/36 ip6:2404:6800:4000::/36 ip6:2607:f8b0:4000::/36 ip6:2800:3f0:4000::/36 ip6:2a00:1450:4000::/36 ip6:2c0f:fb50:4000::/36 ~all"
    _netblocks3.google.com. SPF (no records)
    _netblocks3.google.com. 3600 IN TXT "v=spf1 ~all"

这是为什么?我是否通过添加错误的 Txt 记录a?我还需要像这样添加a我ip address的vps:

 "v=spf1 a ip4:123,12,12,123 include:_spf.google.com ~all"
domain-name-system
  • 1 个回答
  • 1053 Views
Martin Hope
Neel
Asked: 2015-01-22 11:13:34 +0800 CST

Nginx Rewite - 匹配的结束网址不起作用

  • 0

尝试重定向如下网址:

http://example.com/vehicles/cars/author/xyz
http://example.com/plane/author/xyz

对这些:

http://example.com/profile/xyz

我尝试了这个 Nginx Rewrite,但它没有选择匹配并重定向:

rewrite ^/author/(.*)$     http://example.com/profile/$1 last;

我在这里做错了什么?

nginx
  • 1 个回答
  • 269 Views
Martin Hope
Neel
Asked: 2015-01-10 05:47:49 +0800 CST

Nginx 将旧的 PHP url 视为文件

  • 2

很难弄清楚这一点。我已将我的网站从另一个平台更改为 Joomla,现在 Nginx 无法处理旧网址。

我的旧网址是这样的:

example.com/home.php
example.com/contact-us.php

我的新 Joomla SEF 网址是这样的:

example.com/home
example.com/contact-us

根据 Joomla 指南,我有以下 Nginx 配置:

 location / {             
              try_files     $uri $uri/ /index.php?$args;
        }

 # Process PHP
 location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
 }

我希望 Nginx 将这些旧网址传递给 Joomla 来处理它。现在,正在发生的事情是,Nginx 将这些旧网址视为 php 文件,然后向我显示此No input file specified.错误。然后我将 php 块中的 try_files 更改为,try_files $uri /index.php?$args;因此我的 Nginx 配置如下所示:

 location / {             
              try_files     $uri $uri/ /index.php?$args;
        }

 # Process PHP
 location ~ \.php$ {
            try_files       $uri /index.php?$args;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
 }

这是有效的吗?在某些情况下,这会导致无限循环问题吗?这是正确的方法吗?我没有找到任何类似的解决方案。有人可以指导我吗?

nginx
  • 1 个回答
  • 505 Views
Martin Hope
Neel
Asked: 2015-01-07 13:44:08 +0800 CST

如何在 Nginx 服务器块中创建多个停放域

  • 0

我为我的网站购买了多个域名。现在,我像这样重定向这些停放的域(指向我的 nginx ipaddress 的域):

server {
    server_name  example.com www.example;
    rewrite ^(.*) http://example.co.uk$1 permanent;
}

现在,我有超过 5 或 6 个停放的域都指向这个 IP 地址(1 个站点)。因此,如果我为同一个站点有多个停放域,我唯一的选择是写一个非常长的 server_name 吗?

server {
    server_name  example.com www.example example.org www.example.org example.net www.example.net examples.com www.examples.com examples.org www.examples.org examples.net www.examples.net;
    rewrite ^(.*) http://example.co.uk$1 permanent;
}

以上对我来说看起来不正确。但我的问题是,这是怎么做到的?我的意思是,如果我有很多停放的域,我只是在我的 Nginx 配置的服务器块中不断添加我的冗长行,这应该没有问题吗?

有人可以为我澄清一下吗...

nginx
  • 1 个回答
  • 1607 Views
Martin Hope
Neel
Asked: 2015-01-03 07:19:56 +0800 CST

我需要在 SPF 设置中设置 PTR 记录吗?

  • 5

我已经从我的托管服务提供商处设置了 RDNS,以便将 IP 地址解析为“maximus.example.com”。之后,我是否还需要像这样将 PTR 记录添加到我的 DNS 区域文件中的 SPF 文本详细信息中?

v=spf1 include:_spf.google.com ip4:111.11.11.111 ptr:maximus.example.com ~all

我的问题:上述将 PTR 详细信息添加到 SPF 记录是必要的,还是在主机已经为我的 IP 地址设置 RDNS 时不需要?

我打算将记录添加到我的 SPF 中,然后我在某个地方读到了这个强烈建议不要这样做的地方。

注意: RFC 7208 强烈反对 ptr 发件人机制,甚至建议出于性能原因立即删除它,因为它在 IN-ADDR.ARPA (IPv4) 或 IP6.ARPA 反向映射域上施加了负载通常容量低于 gTLD 和 ccTLD 域。

参考:http ://www.zytrax.com/books/dns/ch9/spf.html#ptr

我不确定我是否误解了它的意思。所以有人可以为我澄清一下,因为我不确定是否需要将 PTR 添加到我的区域文件中。

domain-name-system
  • 2 个回答
  • 15597 Views
Martin Hope
Neel
Asked: 2014-12-10 12:03:52 +0800 CST

Cron 守护进程 Wget 被阻止

  • 3

我在没有 cpanel的Debian 7上安装了nginx 。

我正在像这样设置我的 Crontab:

*/45 * * * * wget "http://example.com/cron-url.php" >/dev/null 2>&1

上面的 cron 被 403 禁止:

--2014-12-10 05:40:01--  http://example.com/cron-url.php
Connecting to xyz.xx.xx.xxx:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2014-12-10 05:40:01 ERROR 403: Forbidden.

在这里搜索和谷歌搜索后,我知道我的服务器可能阻止了 wget。我查看了我的 nginx 配置文件,我认为这应该是由于:

if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
    return 403;
}

对于 cron 命令,我必须使用它的 url,并且脚本路径的绝对链接不起作用。现在,如果我需要让 cron 工作而不被阻塞,我该怎么办?我在想也许我需要允许来自我自己的服务器的 wget,但不知道如何用 nginx 做到这一点。有人可以帮我解决这个 cron 问题吗?

nginx
  • 1 个回答
  • 1292 Views
Martin Hope
Neel
Asked: 2014-11-15 01:07:49 +0800 CST

对 alias_maps 和 virtual_alias_maps 感到困惑

  • 32

我已经重新阅读了关于这个的文档以及这里的其他帖子,这对我来说仍然很不清楚。我一直在测试各种东西以了解和之间的区别alias_maps,virtual_alias_maps我没有看到在 postfix 中使用这两个单独的设置。这是我到目前为止发现的(注意 - 我在与我的 Web 服务器相同的服务器中使用 postfix 作为空客户端仅发送电子邮件):

1) /etc/aliases 文件:

root: [email protected]

当我将上述内容添加到alias_maps. 但是,我也注意到一些其他服务(如mail命令)不尊重这一点,并尝试将电子邮件直接发送到不存在的 [email protected](我认为它myorigin是添加 @mydomain.com 的后缀设置) . 为了解决这个问题,我添加了virtual_alias_maps

2) /etc/postfix/虚拟

root     [email protected]

添加上述内容后,所有服务都使用此虚拟别名电子邮件。我还注意到,一旦我添加了上述内容,即使是 fail2ban 也开始忽略我在/etc/aliases/文件中的初始设置,并开始遵循虚拟文件中给出的电子邮件地址。

现在这让我更加困惑 -

  1. /etc/aliases/当虚拟别名映射中的电子邮件似乎覆盖它时,为什么我们需要它?

  2. 拥有这两个单独的别名映射的目的是什么?我们何时决定何时使用什么?

  3. 为什么fail2ban(配置为发送电子邮件至root@localhost)首先遵循alias_maps(/etc/aliases/)中给出的电子邮件地址,然后决定忽略该电子邮件地址virtual_alias_maps?

  4. 为什么不是所有服务都读取 /etc/aliases 中提到的电子邮件别名,并且它们仅在将电子邮件别名添加到虚拟别名映射中时才起作用?

从昨天开始,我已经花了几个小时,但仍然不确定。有人可以帮我解决我的困惑吗?

编辑:mail root这是使用命令 将电子邮件发送到 root 时的邮件日志。/etc/aliases/ 中提到了 root 的别名电子邮件。但是直到我将此根别名电子邮件从移动aliases_maps到virtual_aliases_maps

在以下内容中提到根电子邮件别名时记录/etc/aliases/:

Nov 14 16:39:27 Debian postfix/pickup[4339]: 0F12643432: uid=0 from=<root>

Nov 14 16:39:27 Debian postfix/cleanup[4495]: 0F12643432: message-id=<[email protected]>

Nov 14 16:39:27 Debian postfix/qmgr[4338]: 0F12643432: from=<[email protected]>, size=517, nrcpt=1 (queue active)

Nov 14 16:39:27 Debian postfix/error[4496]: 0F12643432: to=<[email protected]>, orig_to=<root>, relay=none, delay=0.04, delays=0.03/0/0/0.01, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to domainname.com[128.199.147.136]:25: Connection refused)

这是将 root 的电子邮件别名从更改后电子邮件传递成功的位置移动后的/etc/aliases/日志/etc/postfix/virtual:

Nov 14 16:44:58 Debian postfix/pickup[4545]: ADD9A43436: uid=0 from=<root>

Nov 14 16:44:58 Debian postfix/cleanup[4563]: ADD9A43436: message-id=<[email protected]>

Nov 14 16:44:58 Debian postfix/qmgr[4544]: ADD9A43436: from=<[email protected]>, size=453, nrcpt=1 (queue active)

Nov 14 16:45:00 Debian postfix/smtp[4551]: ADD9A43436: to=<[email protected]>, orig_to=<root>, relay=somesite.com[108.160.157.120]:25, delay=1.9, delays=0.03/0/0.97/0.88, dsn=2.0.0, status=sent (250 OK id=1XpEqC-0002ry-9s)

Nov 14 16:45:00 Debian postfix/qmgr[4544]: ADD9A43436: removed
debian
  • 2 个回答
  • 30619 Views
Martin Hope
Neel
Asked: 2014-11-11 11:49:31 +0800 CST

Joomla URL 重写在 Nginx 中自动工作

  • 1

这让我发疯,我不明白这是如何自动工作的。我有 nginx 作为我的网络服务器,我已经安装了具有 URL 重写的 Joomla,它index.php从 URL 中删除了。以前,当我使用 Apache 时,我必须启用 .htaccessRewriteEngine On才能使其正常工作。但是对于 Nginx,当我启用“使用 URL 重写”时,它会自动工作。我只使用将 php 文件传递​​给 php-fpm 的 Nginx。就这样。除了 Joomla 文档中给出的内容之外,我没有添加任何特殊的重写规则。我不明白“使用 URL 重写”是如何在我启用它时自动工作的,因为 Nginx 没有 .htaccess。

关于这个主题的Joomla 文档也没有帮助。在第二步它说

启用使用 Apache mod_rewrite/URL 重写选项并保存:此选项使用 Apache mod_rewrite 函数来消除 URL 的“index.php”部分。

......

如果此选项导致错误,请参阅如何检查您的服务器上是否启用了 mod rewrite。如果它未启用并且您可以访问文件 apache/conf/httpd.conf,请打开该文件并检查 LoadModule rewrite_module modules/mod_rewrite.so 行是否未注释。如有必要,取消注释该行并重新启动 Apache Web 服务器。

不知道为什么在 Nginx 配置中添加它,因为 Nginx 中没有 mod_rewrite。Joomla 后端的 URL 重写是这样说的:

使用 URL 重写 选择使用服务器的重写引擎来捕获满足特定条件的 URL 并按照指示重写它们。适用于 IIS 7 和 Apache。仅限 Apache 用户!激活前将 htaccess.txt 重命名为 .htaccess。将 web.config.txt 重命名为 web.config 并在激活前安装 IIS URL Rewrite Module。

它没有说明 Nginx,但它仍然有效。我在这里挠头。有人可以告诉我 Joomla 的 index.php 是如何在 Nginx 中如此轻松地删除的吗?这是我的 Nginx Vhost 配置:

server {

        listen 80;
        server_name example.com;
        root /var/www/example/public_html;
        index  index.php index.html index.htm default.html default.htm;

        access_log /var/log/nginx/accn_access.log;
        error_log /var/log/nginx/accn_error.log;

        ##
        # JOOMLA SEF
        ##

        location / {
              try_files   $uri $uri/ /index.php?q=$request_uri;
        }

        ##
        # PHP scripts to FastCGI 
        ##
        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;

        }

}

看..它是一个非常简单的配置。魔法发生在哪里?

nginx
  • 1 个回答
  • 5400 Views
Martin Hope
Neel
Asked: 2014-10-31 11:44:53 +0800 CST

nginx uLimit 'worker_connections 超出打开文件资源限制:1024'

  • 17

我不断收到这个错误nginx/error.log,它让我发疯:

8096 worker_connections exceed open file resource limit: 1024

我已经尝试了我能想到的一切,但无法弄清楚这里限制 nginx 的原因。你能告诉我我错过了什么吗?

nginx.conf有这个:

worker_processes 4;
events {
        worker_connections 8096;
        multi_accept on;
        use epoll;
}

我security/limits.conf像这样更改了系统的 Ulimit:

# This is added for Open File Limit Increase
*               hard    nofile          199680
*               soft    nofile          65535

root            hard    nofile          65536
root            soft    nofile          32768

# This is added for Nginx User
nginx           hard    nofile          199680
nginx           soft    nofile          65535

它仍然显示错误。所以我也尝试编辑/etc/default/nginx并添加了这一行:

ULIMIT="-n 65535"

它仍然显示相同的错误。无法弄清楚是什么将 nginx 工作程序连接限制为仅 1024。你能指出我吗?

我有 Debian 7 + nginx

linux
  • 2 个回答
  • 45842 Views
Martin Hope
Neel
Asked: 2014-10-31 05:39:32 +0800 CST

如何使用 Fail2Ban 禁止 Syn Flood 攻击?

  • 5

在我的日志中,我经常看到像这样丢弃的 ip:

> Oct 30 17:32:24 IPTables Dropped: IN=eth0 OUT=
> MAC=04:01:2b:bd:b0:01:4c:96:14:ff:df:f0:08:00 SRC=62.210.94.116
> DST=128.199.xxx.xxx LEN=40 TOS=0x00 PREC=0x00 TTL=244 ID=45212
> PROTO=TCP SPT=51266 DPT=5900 WINDOW=1024 RES=0x00 SYN URGP=0
> 
> Oct 30 17:29:57 Debian kernel: [231590.140175] IPTables Dropped:
> IN=eth0 OUT= MAC=04:01:2b:bd:b0:01:4c:96:14:ff:ff:f0:08:00
> SRC=69.30.240.90 DST=128.199.xxx.xxx LEN=40 TOS=0x00 PREC=0x00 TTL=245
> ID=12842 DF PROTO=TCP SPT=18534 DPT=8061 WINDOW=512 RES=0x00 SYN
> URGP=0

从上面,我假设这些是我的 IpTables 规则正在丢弃的 Syn Flood。这就是我在 iptables for Syn 中的内容(尽管不确定这些规则中的哪一个正在删除上面的规则):

# Drop bogus TCP packets
iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP

# --- Common Attacks: Null packets, XMAS Packets and Syn-Flood Attack ---
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP

在 Fail2ban 中,我没有在filter.d文件夹中看到任何针对 Syn 攻击的特定过滤器。我的问题是:

1)我是否只是忽略上述日志而不担心为这些日志设置 Fail2Ban 过滤器,因为它的互联网并且总是会有脚本小子在做这些吗?

2) 由于 Fail2ban 工作基于 iptables 日志,有没有办法在我的服务器上禁止上述 Syn 尝试?

这是我对过滤器的蹩脚尝试,但它不起作用。不确定它是否有效:

[Definition]
failregex = ^<HOST> -.*IPTables Dropped:.*SYN URGP=0
ignoreregex =

我正在使用 Debian + Nginx

debian
  • 3 个回答
  • 10268 Views
Martin Hope
Neel
Asked: 2014-10-31 00:28:29 +0800 CST

关闭 25 端口会导致邮件被标记为垃圾邮件吗?

  • 3

我有一个 Web 服务器,我在其中安装了 Postfix,仅用于发送电子邮件。所有收到的邮件都将由谷歌应用程序而不是我的网络服务器处理。使用 iptables 规则,我已经阻止了所有传入端口(包括端口 25)并且只打开了 ssh 和 http 端口。所有出站流量均已打开。从测试中我可以看到即使端口 25 被阻止,postfix 也能够发送电子邮件,所以这不是问题。我的理解是仅当我在该服务器上接收电子邮件时才需要打开端口 25。但我在编码恐怖网站上读到这个让我有点困惑:

Port25 提供了一个非常棒的公共服务——您可以发送电子邮件至 [email protected],它会回复 from: 地址并提供广泛的诊断信息!

所以我的问题是,当 Postfix 向他们发送电子邮件时,某些邮件服务器是否会 ping 我的端口 25 以检查我的服务器来源的真实性?如果 Postfix 仅用于发送电子邮件,我是否还需要打开 25 端口以便其他邮件服务器可以验证我的服务器信息?我担心我是否阻塞了端口 25,这是否是某些电子邮件客户端将我的电子邮件标记为垃圾邮件的另一个原因,因为他们无法通过 ping 到端口 25 来获取我服务器上的信息?我找不到这方面的信息。如果有人能澄清这一点,我将不胜感激......

iptables
  • 1 个回答
  • 873 Views
Martin Hope
Neel
Asked: 2014-10-28 12:17:05 +0800 CST

Fail2ban MTA=监狱配置中的后缀设置给出错误

  • 1

在/etc/fail2ban/jail.local中,当我将 MTA 设置为 Postfix 时,Fail2Ban 显示错误并且无法启动。

[DEFAULT]

ignoreip = 127.0.0.1/8
bantime  = 1800                         
maxretry =  4                           
destemail = [email protected]   
mta = postfix                           
action = %(action_mwl)s 

错误:

WARNING 'findtime' not defined in 'ssh'. Using default value
ERROR  /etc/fail2ban/action.d/postfix-whois-lines.conf and /etc/fail2ban/action.d/postfix-whois-lines.local do not exist
ERROR  Error in action definition postfix-whois-lines[name=ssh, dest="[email protected]", logpath=/var/log/auth.log, chain="INPUT"]
ERROR  Errors in jail 'ssh'. Skipping...
['set', 'loglevel', 3]
['set', 'logtarget', '/var/log/fail2ban.log']

错误指向其他地方,但是当我注释掉它时mta=postfix它有效。

我已将 Postfix 安装为我的 MTA(在 Debian 7 中),我认为我应该将此设置更改为默认sendmail值postfix。我错了吗?

iptables
  • 2 个回答
  • 12905 Views
Martin Hope
Neel
Asked: 2014-10-28 02:49:58 +0800 CST

Fail2ban jail.local vs jail.conf

  • 31

jail.local 文件是替代jail.conf 还是替代jail.conf?

当我从教程中了解Fail2Ban时,他们中的大多数人通常说要么将 jail.conf 复制到 jail.local 并在那里进行编辑,其中一些人说要创建一个新的 jail.local 文件并提供一堆要复制的设置并粘贴。但他们没有解决的是 jail.local 如何与 jail.conf 一起工作。这是2个场景:

  1. 覆盖:如果 jail.local 充当 jail.conf 文件的覆盖,那么我需要做的只是将我想要覆盖的必要配置添加到 jail.conf 中给出的默认值。在这种情况下,我不需要添加 SSH 配置等。因为它已经包含在 jail.conf 中。

  2. 替换:如果在 jail.local 存在时 jail.conf 变得无效,那么我需要在 jail.local 中添加所有规则,然后编辑我想要修改的那些。

你能确认当 jail.local 存在时 jail.conf 会发生什么?如果 jail.local 就像是在 jail.conf 文件之上的一个覆盖,那么我更容易只拥有我想要添加到它的那几行规则,这也使得它易于维护和可读性。对此最好的方法是什么?

iptables
  • 1 个回答
  • 20425 Views
Martin Hope
Neel
Asked: 2014-10-27 00:11:11 +0800 CST

同时安装和启用 Memcache 和 Memcached

  • 1

我可以在同一台服务器上同时使用Memcache和Memcached php 扩展吗?为了清楚起见,您不会误解我的意思,这是我的情况:我的网站同时拥有 Joomla 和 phpbb。Joomla 提供对 memcached 和 memcache 的支持,而 phpbb 仅提供对 memcache 的支持。所以我打算这样做:

1)安装memcached服务器:apt-get install memcached

2) 安装 php-memcache 以用于 phpbb:apt-get install php5-memcache

3) 安装 php-memcached 以用于 Joomla:apt-get install php5-memcached

我的问题是:

  1. 是否可以同时安装和启用 memcache 和 memcached 扩展,其中每个扩展都由不同的 php 应用程序同时使用?这会以任何方式发生冲突吗?

  2. 当我将 memcached 服务器的内存限制设置为 512M in 时 /etc/memcached.conf,是否意味着此内存限制将在两个扩展memcache之间共享?memcached如果说 memcache 使用比 memcached 更多的内存,这应该不是问题,反之亦然?他们两个玩得很好吗?

  3. 在这样的场景中,我是否应该尝试只优先使用 1 个 php 扩展(比如我的情况下的任何一个 memcache),以保持事情简单而不会在两者之间发生冲突,否则这无关紧要。我的意思是,如果您说两者都可以使用(对于 Q1),那么出于专业实践,即使两者可以同时使用,我是否仍然尝试对 Joomla 和使用相同的 php 扩展phpbb 是否可以尽量减少头痛?这会有什么不同吗?

memcached
  • 1 个回答
  • 1160 Views
Martin Hope
Neel
Asked: 2014-10-26 06:18:50 +0800 CST

Postfix + Php Mail() VS Postfix + SMTP

  • 3

大多数 CMS(例如 Joomla)都是php mail()默认提供的,SMTP如果我们愿意,可以选择将其更改为。我将在 Debian 7 上的同一个 VPS 中设置网络服务器和邮件服务器(Postfix)。我想了解的是:

  1. 交付信誉:使用 php mail() 与 SMTP 对交付率有何影响?据我了解,Postfix 在发送电子邮件时与 Internet 上的其他服务器通信时将使用 SMTP 协议,因此可以安全地假设电子邮件是通过 php mail 发送到 postfix 还是从 localhost 发送到 smpt 无关紧要? 这两种方法中的任何一种是否会影响电子邮件声誉,即使是很小的方式?

  2. 性能负载:发送电子邮件时,php 邮件和 SMTP 之间是否存在性能差异?比如说,如果我要发送 10,000 封电子邮件,哪种方法会占用最多的资源(或时间)?我的假设是两者都可能需要一些时间,例如:用于编译带有标题等的电子邮件的 php mail 和用于每次建立连接的 SMTP。哪一个消耗的服务器资源最多?

  3. 安全问题:当我搜索两者之间的区别时,许多网站都提到了 php 邮件的安全问题,因为黑客可以上传 php 脚本来发送垃圾邮件。但我也可以看到 SMTP 的另一个安全问题,因为 SMTP 用户名和密码以文本形式存储在配置文件中,这也不安全。既然这两种方法都存在安全问题,那么一种方法在任何方面都比另一种更重要吗?

  4. 偏好:如果我能够在我的服务器上设置 phpmail 和 SMTP,我是否应该出于任何原因优先使用其中一个?我的意思是,如果我可以在我的服务器中使用 SMTP,那么由于上述几点涵盖的各种原因,我是否应该尝试使用 SMTP 而不是 phpmail?

背景:我的机器将是一个简单的网络服务器,它使用 postfix 来发送来自 Joomla 的电子邮件、时事通讯和来自各种服务的根电子邮件。

postfix
  • 3 个回答
  • 2878 Views
Martin Hope
Neel
Asked: 2014-10-26 00:33:24 +0800 CST

对 Linux 主机名、DNS 主机名和 FQDN 主机名感到困惑

  • 2

这对你们中的一些人来说可能听起来很愚蠢和基本,但即使在阅读了网络上的大量资源之后,我仍然对此感到困惑。我仍然不清楚的问题是:

  1. 机器中的主机名(例如hostname在 debian OS ssh 中键入时)是否与您在 DNS 服务器A记录中键入的主机名不同?

  2. 将我的 Debian 机器主机名设置为maximus并将 DNS A 记录主机名设置为是否正常mail?

  3. 这两个是否相同,以至于我将它们视为独立的而感到困惑,或者它们通常以可互换的术语使用而导致混淆?

  4. 对于 FQDN,host它是使用机器的主机名还是 DNS A 记录中给出的主机名?

我的设置: 1 个 Debian 7 VPS 与 web 服务器和邮件服务器都在同一个盒子上。

domain-name-system
  • 2 个回答
  • 1489 Views
Martin Hope
Neel
Asked: 2014-10-14 12:28:50 +0800 CST

在 Nginx 自定义构建 Centos 7 中未创建 Pid 和 Lock 文件

  • -1

我正在尝试从源代码安装 nginx。之后make install,我查看了/var/run/文件夹,但在那里找不到nginx.pid文件和nginx.lock文件。这是我的配置:

sudo ./configure --add-module=/opt/nginx-compile/modules/ngx_pagespeed-release-1.9.32.1-beta \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-http_spdy_module \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--user=nginx \
--group=nginx

sudo make
sudo make install

在上面的命令之后,不应该有一个新的nginx.pid和nginx.lock文件创建在/var/run/?我在那里看不到他们。

这是我之后看到的确认make install:

make -f objs/Makefile install
make[1]: Entering directory `/opt/nginx-compile/nginx-1.6.1'
test -d '/etc/nginx' || mkdir -p '/etc/nginx'
test -d '/usr/sbin'             || mkdir -p '/usr/sbin'
test ! -f '/usr/sbin/nginx'             || mv '/usr/sbin/nginx'                         '/usr/sbin/nginx.old'
cp objs/nginx '/usr/sbin/nginx'
test -d '/etc/nginx'            || mkdir -p '/etc/nginx'
cp conf/koi-win '/etc/nginx'
cp conf/koi-utf '/etc/nginx'
cp conf/win-utf '/etc/nginx'
test -f '/etc/nginx/mime.types'                 || cp conf/mime.types '/etc/nginx'
cp conf/mime.types '/etc/nginx/mime.types.default'
test -f '/etc/nginx/fastcgi_params'             || cp conf/fastcgi_params '/etc/nginx'
cp conf/fastcgi_params          '/etc/nginx/fastcgi_params.default'
test -f '/etc/nginx/fastcgi.conf'               || cp conf/fastcgi.conf '/etc/nginx'
cp conf/fastcgi.conf '/etc/nginx/fastcgi.conf.default'
test -f '/etc/nginx/uwsgi_params'               || cp conf/uwsgi_params '/etc/nginx'
cp conf/uwsgi_params            '/etc/nginx/uwsgi_params.default'
test -f '/etc/nginx/scgi_params'                || cp conf/scgi_params '/etc/nginx'
cp conf/scgi_params             '/etc/nginx/scgi_params.default'
test -f '/etc/nginx/nginx.conf'                 || cp conf/nginx.conf '/etc/nginx/nginx.conf'
cp conf/nginx.conf '/etc/nginx/nginx.conf.default'
test -d '/var/run'              || mkdir -p '/var/run'
test -d '/var/log/nginx' ||             mkdir -p '/var/log/nginx'
test -d '/etc/nginx/html'               || cp -R html '/etc/nginx'
test -d '/var/log/nginx' ||             mkdir -p '/var/log/nginx'
make[1]: Leaving directory `/opt/nginx-compile/nginx-1.6.1'
centos
  • 1 个回答
  • 2077 Views
Martin Hope
Neel
Asked: 2014-10-14 00:46:11 +0800 CST

在 CentOS 7 上使用 Pagespeed 编译 Nginx 时出错

  • 1

我正在尝试使用 Pagespeed 从源代码编译 Nginx,并且我很难解决not found添加配置设置时看到的错误。这是我的配置设置:

我正在使用 CentOS 7 - 64 位

配置设置:

sudo ./configure --add-module=/nginx-compile/modules/ngx_pagespeed-release-1.9.32.1-beta \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-http_spdy_module \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector \ 
--param=ssp-buffer-size=4 -m64 -mtune=generic' \
--user=nginx \
--group=nginx

当我在 ssh 中添加上述内容时,我收到以下not found错误和no supported file AIO was found错误。这是我得到的清单:

执行配置后的错误:

checking for OS
 + Linux 3.10.0-123.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... not found
checking for C99 variadic macros ... not found
checking for gcc variadic macros ... not found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... not found
checking for O_PATH ... not found
checking for sendfile() ... not found
checking for sendfile64() ... not found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... not found
checking for sched_setaffinity() ... not found
checking for crypt_r() ... not found
checking for sys/vfs.h ... found
checking for poll() ... not found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... not found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... not found
checking for O_DIRECT ... not found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... not found
checking for statvfs() ... not found
checking for dlopen() ... not found
checking for dlopen() in libdl ... not found
checking for sched_yield() ... not found
checking for sched_yield() in librt ... not found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... not found
checking for TCP_KEEPIDLE ... not found
checking for TCP_FASTOPEN ... not found
checking for TCP_INFO ... not found
checking for accept4() ... not found
checking for kqueue AIO support ... not found
checking for Linux AIO support ... not found

./configure: no supported file AIO was found
Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only

在添加配置设置之前,我还安装了以下依赖项:

sudo yum install gcc gcc-c++ pcre-devel zlib-devel make unzip openssl-devel

我使用的配置类似于我使用 centos 内置 repo 安装 Nginx 时的配置设置,只是它添加了 pagespeed 模块。


更新:

实际问题是我在将--params配置调用传递给不正确并导致错误时拆分线路的方式。感谢@XavierLucas下面的回答,一旦我添加--with-cc-opt并--params在 1 行中,错误就解决了。

扩展:

虽然以上是导致错误的原因,但我还了解到,为了让 Nginx 充分利用其核心功能并安装 pagespeed 模块,安装以下库也很好:

gcc 
gcc-c++ 
pcre-devel 
zlib-devel 
make 
unzip 
openssl-devel 
libaio-devel
glibc 
glibc-devel 
glibc-headers
libevent
linux-vdso.so.1
libpthread.so.0
libcrypt.so.1
libstdc++.so.6
librt.so.1
libm.so.6
libpcre.so.0
libssl.so.10
libcrypto.so.10
libdl.so.2
libz.so.1
libgcc_s.so.1
libc.so.6
/lib64/ld-linux-x86-64.so.2
libfreebl3.so
libgssapi_krb5.so.2
libkrb5.so.3
libcom_err.so.2
libk5crypto.so.3
libkrb5support.so.0
libkeyutils.so.1
libresolv.so.2
libselinux.so.1

和

yum groupinstall 'Development Tools'
centos
  • 4 个回答
  • 8900 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