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

Tim Altgeld's questions

Martin Hope
Tim Altgeld
Asked: 2020-02-06 11:01:26 +0800 CST

Apache2 通配符别名

  • 1

我有以下通配符 vHost:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName autodiscover.*.*
    ServerAlias autoconfig.*.*

    RewriteEngine On 
    RewriteCond %{HTTPS} !=on 
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
</VirtualHost>

但是我的 RewriteRule 是错误的。

例如:

autoconfig.testdomain.de被映射到https://autoconfig.testdomain.de

我想要的是:

  • autoconfig.*.*被映射到https://autoconfig.maindomain.de

  • autodiscover.*.*被映射到https://autodiscover.maindomain.de

我只想将子域部分解析%{HTTP_HOST}为subdomain.example.de,但前提是子域部分是autoconfig或者autodiscover

virtualhost mod-rewrite apache2 wildcard-subdomain
  • 1 个回答
  • 332 Views
Martin Hope
Tim Altgeld
Asked: 2020-01-25 19:03:16 +0800 CST

阿帕奇访问日志

  • 0

我使用 fail2ban 来检测对我的任何托管域的恶意请求,它运行良好,但有一个例外。

如果请求被发送到 IP 而不是 fqdn 或子域,它会被捕获并写入 other_vhosts_access.log,因为 ip 本身不是虚拟主机。

示例条目:

somedomain.de:80 20.37.96.167 - - [24/Jan/2020:15:47:04 +0100] "POST //4walls/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/ 1.1" 301 587 " https://www.google.com/ " "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, 像 Gecko) Chrome/79.0.3945.88 Safari/537.36"

看来,apache 对 IP 进行反向查找并首先记下主机名。

这会导致 fail2ban 自我禁止服务器 IP 而不是请求者 IP。

如何防止 somedomain.de:80 条目?

logging log-files apache-2.4
  • 1 个回答
  • 241 Views
Martin Hope
Tim Altgeld
Asked: 2020-01-13 12:30:33 +0800 CST

fail2ban 动作路由到另一个 ip

  • 0

我想创建一个 fail2ban 操作,将流量路由到另一个 IP 禁止操作,并删除取消禁止操作的路由。

文件:/etc/fail2ban/action.d/ 中的 iptables-route.conf

# Fail2Ban configuration file
#
#

[INCLUDES]

before = iptables-common.conf

[Definition]

# Option:  actionstart
# Notes.:  command executed once at the start of Fail2Ban.
# Values:  CMD
#
actionstart = <iptables> -N f2b-<name>
              <iptables> -A f2b-<name> -j <returntype>
              <iptables> -I <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
              <iptables> -A FORWARD -i ens3 -p tcp -m state --state NEW --dport 80 -j ACCEPT
              <iptables> -A FORWARD -i ens3 -p tcp -m state --state NEW --dport 443 -j ACCEPT

# Option:  actionstop
# Notes.:  command executed once at the end of Fail2Ban
# Values:  CMD
#
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
             <actionflush>
             <iptables> -X f2b-<name>
             <iptables> -D FORWARD -i ens3 -p tcp -m state --state NEW --dport 80 -j ACCEPT
             <iptables> -D FORWARD -i ens3 -p tcp -m state --state NEW --dport 443 -j ACCEPT

# Option:  actioncheck
# Notes.:  command executed once before each actionban command
# Values:  CMD
#
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'

# Option:  actionban
# Notes.:  command executed when banning an IP. Take care that the
#          command is executed with Fail2Ban user rights.
# Tags:    See jail.conf(5) man page
# Values:  CMD
#
actionban = <iptables> -I f2b-<name> 1 PREROUTING -s <ip> -j DNAT --to-destination 188.68.45.124

# Option:  actionunban
# Notes.:  command executed when unbanning an IP. Take care that the
#          command is executed with Fail2Ban user rights.
# Tags:    See jail.conf(5) man page
# Values:  CMD
#
actionunban = <iptables> -D f2b-<name> -s <ip> -j DNAT --to-destination 188.68.45.124

[Init]

/etc/fail2ban/jail.d/ 中的文件 apache-route.local:

[apache-route]
enabled     = true
filter      = apache-probe
port        = http,https
banaction   = iptables-route.conf
maxretry    = 3
findtime    = 1500
bantime     = 600

logpath     = /var/www/*/userdata/logs/*-access.log

我什至无法测试它,因为它给了我以下错误:

fail2ban-客户端重启

在 /etc/fail2ban 下找不到“action.d/iptables-route.conf”的可访问配置文件

无法读取操作“iptables-route.conf”

监狱“apache-route”中的错误。跳过...

我试图让它工作,但我不知道为什么它会给我这个错误

debian
  • 2 个回答
  • 1013 Views
Martin Hope
Tim Altgeld
Asked: 2019-07-20 15:27:12 +0800 CST

network.service 在 Debian buster 中失败

  • 1

network.service 无法启动 eth0:2 和 eth0:3,但我的配置似乎正确。

我尝试了几件事,还将网卡从 ens3 重命名为 eth0

/etc/网络/接口:

auto lo
iface lo inet loopback

allow-hotplug eth0

auto eth0
iface eth0 inet static
    address xx.xxx.xxx.xxx/22
    gateway xx.xxx.xxx.x

allow-hotplug eth0:1
auto eth0:1
iface eth0:1 inet6 static
    address 2a03:xxxx:x:xxxx::1000/64
    gateway fe80::1

allow-hotplug eth0:2
iface eth0:2 inet6 static
    address 2a03:xxxx:x:xxxx::2000/64
    gateway fe80::1

allow-hotplug eth0:3
iface eth0:3 inet6 static
    address 2a03:xxxx:x:xxxx::3000/64
    gateway fe80::1

预期的:

启动时,eth0 和 eth0:1 会自动启动。

ifup eth0:2 和 ifup eth0:3 调出其他网卡

实际的:

ifup eth0:2
RTNETLINK answers: File exists
ifup: failed to bring up eth0:2

ifup eth0:3
RTNETLINK answers: File exists
ifup: failed to bring up eth0:3

它给出了一个错误,但尽管有错误,但适配器已加载并且 IPv6 正在工作。

另外,如果我添加

自动 eth0:2

自动 eth0:3

network.service 在启动时失败:


● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-07-19 20:29:26 CEST; 1min 21s ago
     Docs: man:interfaces(5)
  Process: 409 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
 Main PID: 409 (code=exited, status=1/FAILURE)
Jul 19 20:29:24 root systemd[1]: Starting Raise network interfaces...
Jul 19 20:29:24 root ifup[409]: ifup: waiting for lock on /run/network/ifstate.eth0
Jul 19 20:29:26 root ifup[409]: Waiting for DAD... Done
Jul 19 20:29:26 root ifup[409]: RTNETLINK answers: File exists
Jul 19 20:29:26 root ifup[409]: ifup: failed to bring up eth0:2
Jul 19 20:29:26 root ifup[409]: RTNETLINK answers: File exists
Jul 19 20:29:26 root ifup[409]: ifup: failed to bring up eth0:3
Jul 19 20:29:26 root systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Jul 19 20:29:26 root systemd[1]: networking.service: Failed with result 'exit-code'.
Jul 19 20:29:26 root systemd[1]: Failed to start Raise network interfaces.

尽管networking.service 失败,但所有IPv6 都在工作。

我不知道有什么问题。

networking
  • 1 个回答
  • 2711 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