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

Maestro223's questions

Martin Hope
Maestro223
Asked: 2022-01-30 22:08:09 +0800 CST

通过 /etc/fstab 强化 /home 目录

  • -2

我在 Ubunto 20.04 服务器上使用单个分区 / 用于所有目录,因为我正在运行 Web 和邮件服务器。我强化了tmp, /var/tmp, &/run/shm使用:

none /tmp       tmpfs nodev,noexec,nosuid 0 0
none /var/tmp   tmpfs nodev,noexec,nosuid 0 0
none /run/shm   tmpfs noexec,nosuid,nodev 0 0

我想在nodev不创建全新分区的情况下将选项添加到我的 /home 目录。我已经添加:
none /home ext4 nodev 0 0到/etc/fstab

但是,当我运行mount -a配置以使其生效时,我收到以下消息: mount: /home: special device none does not exist.

这是给定我的配置的预期输出还是做了一些致命的错误?如果有人可以分享正确的方法 to nodev,/home我将不胜感激。

谢谢

目标
我想防止 /home 目录被用于定义字符和块特殊设备。因此,我想设置 nodev 选项,使用户无法创建这些类型的文件。

linux
  • 0 个回答
  • 389 Views
Martin Hope
Maestro223
Asked: 2022-01-19 19:58:10 +0800 CST

启用主机来宾域解析

  • 1

情况:
我在 Vbox6.1 内有 Ubuntu 20.04 服务器和一个 Ubuntu 20.04 桌面主机。Host-Guest 通信使用 vboxnet0 适配器正确配置。我可以很容易地从主机的命令行 ping 来宾的静态 IP。

问题:
我最近在客户机上安装了一个服务器控制面板,奇怪的是,我只能从主机的 Web 浏览器访问服务器控制,仅使用 IP 地址,而不是其域名。例如:

https://192.168.62.87:3080 正确显示控制面板,而
https://example.com:3080 Firefox 的“嗯。我们找不到那个站点”。错误信息。

我尝试过的解决方案:

1.) 首先,我尝试了显而易见的方法。我编辑我的/etc/hosts文件
192.168.62.87 example.com 没有工作

2.) 接下来,我尝试在来宾服务器上安装 avahi-daemon,如下所示:
sudo apt-get install avahi-daemon& 重新启动来宾 <-没有工作

有谁知道我怎样才能让我的主机看到我的 vbox 域名?谢谢

更新 @Gaétan RYCKEBOER 下面的建议,揭示了一些有用的东西。

当我运行dig example.com它时,它显示我的主机正在尝试使用我的 PROD 服务器的名称服务器解析 example.com,这意味着控制面板当然不会加载,因为**test**.example.comy prod 服务器上不存在。

似乎192.168.62.87 example.com 在我的/etc/hosts文件中被忽略了。

这是我需要纠正的。
注意:我的 ubuntu 测试服务器确实安装了 bind9 并且运行正常。

internal-dns
  • 3 个回答
  • 60 Views
Martin Hope
Maestro223
Asked: 2021-12-31 22:21:11 +0800 CST

Logrotate 失败且没有错误

  • 0

好的,我做了一个嘘声。我认为

问题: Logrotate 失败(或者我错误地认为它已经死了)并且没有提供任何错误消息来解释原因:

● logrotate.service - Rotate log files
   Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
   Active: inactive (dead) since Fri 2021-12-31 13:05:25 CST; 42min ago
     Docs: man:logrotate(8)
           man:logrotate.conf(5)
  Process: 27844 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
 Main PID: 27844 (code=exited, status=0/SUCCESS)

Dec 31 13:05:25 server1.example.com systemd[1]: Starting Rotate log files...
Dec 31 13:05:25 server1.example.com systemd[1]: logrotate.service: Succeeded.
Dec 31 13:05:25 server1.example.com systemd[1]: Started Rotate log files.

我想使用 systemd 自动重新启动 logrotate,因为有时它会在重新启动后失败。因此在我的/usr/lib/systemd/system/logrotate.service文件中我添加了:

Restart=always

上面添加了kill logrotate服务。从那里我决定撤消我的肮脏工作并删除Restart=always和systemctl daemon-reload && systemctl start logrotate

没运气。

然后我决定调查系统日志,看看是否能找到任何线索,使用:
#grep "logrotate" /var/log/syslog。这产生了一个线索:

Dec 31 00:00:03 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 00:36:16 server1 clamd[3544]: Fri Dec 31 00:36:16 2021 -> ^File path check failure on: /var/tmp/systemd-private-2f8e6be5a16040adb29706b9e31ae841-logrotate.service-DbrlAK
Dec 31 00:37:31 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 12:51:17 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 13:00:58 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 13:05:25 server1 systemd[1]: logrotate.service: Succeeded.

注意:您看到“成功”的所有时间都是我手动尝试启动 logrotate。

我在这篇关于服务器故障的帖子中读到,这可能是由于 logrotate 试图访问var/log/目录之外的日志而引起的。/var/log而且我虽然这可能是我的问题,但是除了上面的系统日志错误之外,我找不到任何外部日志的指示:

重申:

Dec 31 00:36:16 server1 clamd[3544]: Fri Dec 31 00:36:16 2021 -> ^File path check failure on: /var/tmp/systemd-private-2f8e6be5a16040adb29706b9e31ae841-logrotate.service-DbrlAK

从我调查蛤蜊,但是

#grep "log" /etc/clamav/clamd.conf 
LogSyslog false
LogFile /var/log/clamav/clamav.log

收益,什么都没有。有谁知道为什么 logrotate 不会启动?

logrotate
  • 1 个回答
  • 187 Views
Martin Hope
Maestro223
Asked: 2021-09-12 15:23:07 +0800 CST

从 Debian 10 更新到 Debian 11 出错了

  • 0

我只是使用这些说明从 Debian 10 升级到 Debian 11 。一切似乎都很顺利,除了 maldet 失败了。

这是错误:

maldet[2117]: maldet(2117): {mon} kernel does not support inotify(), aborting
systemd[1]: maldet.service: Can't open PID file /usr/local/maldetect/tmp/inotifywait.pid (yet?) after start: Operation not permitted 
systemd[1]: maldet.service: Failed with result 'protocol'.
systemd[1]: Failed to start Linux Malware Detect monitoring - maldet.

我的 /usr/lib/systemd/system/maldet.service 文件包含:

[Unit]
Description=Linux Malware Detect monitoring - maldet
After=network.target

[Service]
EnvironmentFile=/usr/local/maldetect/conf.maldet
ExecStart=/usr/local/maldetect/maldet --monitor USERS
ExecStop=/usr/local/maldetect/maldet --kill-monitor
Type=forking
PIDFile=/usr/local/maldetect/tmp/inotifywait.pid
[Install]
WantedBy=multi-user.target

在我更新之前,我验证了所有服务都正常工作,并且在更新期间选择了“N”否,拒绝替换我的自定义配置文件......所以应该没有任何改变。

另外,我使用的是 Linux 5.10.0-8-amd64 & maldet 1.6.4

有人可以帮我解决这个问题吗?谢谢

malware debian
  • 1 个回答
  • 582 Views
Martin Hope
Maestro223
Asked: 2021-06-09 01:35:01 +0800 CST

Logrotate 服务失败

  • 1

我的 logrotate 服务失败。它抱怨 modsecurity 的重复条目。

 ● logrotate.service - Rotate log files
       Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
       Active: failed (Result: exit-code) since Tue 2021-06-08 14:22:07 CST; 2h 54min ago
         Docs: man:logrotate(8)
               man:logrotate.conf(5)
     Main PID: 15370 (code=exited, status=1/FAILURE)
    
    Jun 08 14:22:07 server1.example.com systemd[1]: Starting Rotate log files...
    Jun 08 14:22:07 server1.example.com logrotate[15370]: error: modsecurity:1 duplicate log entry for /var/log/apache2/modsec_audit.log
    Jun 08 14:22:07 server1.example.com logrotate[15370]: error: found error in file modsecurity, skipping
    Jun 08 14:22:07 server1.example.com systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
    Jun 08 14:22:07 server1.example.com systemd[1]: logrotate.service: Failed with result 'exit-code'.
    Jun 08 14:22:07 server1.example.com systemd[1]: Failed to start Rotate log files.

但是,/etc/logrotate.d/modsecurity 不包含任何重复项:

/var/log/apache2/modsec_audit.log
{
        rotate 14
        daily
        missingok
        compress
        delaycompress
        notifempty
}

任何想法?

更新:

#grep -r 'modsec_audit.log' /etc/

/etc/logrotate.d/modsecurity:/var/log/apache2/modsec_audit.log
/etc/modsecurity/modsecurity.conf:SecAuditLog /var/log/apache2/modsec_audit.log
/etc/modsecurity/modsecurity.conf-recommended:SecAuditLog /var/log/apache2/modsec_audit.log

所以我经历了:

/etc/modsecurity/modsecurity.conf:SecAuditLog /var/log/apache2/modsec_audit.log
/etc/modsecurity/modsecurity.conf-recommended:SecAuditLog /var/log/apache2/modsec_audit.log

并散列出 modsec_audit.log 值,如下所示

#SecAuditLogType Serial
#SecAuditLog /var/log/apache2/modsec_audit.log

然后跑:
systemctl restart logrotate

同样的错误

更新 2:

遵循@Nikita Kipriyanov 的建议,我完成并完全散列了 /etc/logrotate.d/modsecurity ,现在 logrotate 成功执行(所有 mdosec 日志都散列了):

#systemctl status logrotate
● logrotate.service - Rotate log files
       Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
       Active: inactive (dead) since Thu 2021-06-10 09:36:53 CST; 52s ago
         Docs: man:logrotate(8)
               man:logrotate.conf(5)
      Process: 20308 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
     Main PID: 20308 (code=exited, status=0/SUCCESS)

        Jun 10 09:36:52 tester1.example.com systemd[1]: Starting Rotate log files...
        Jun 10 09:36:53 tester1.example.com systemd[1]: logrotate.service: Succeeded.
        Jun 10 09:36:53 tester1.example.com systemd[1]: Started Rotate log files.

所以我启用了位于的原始 modsec_audit.log/etc/modsecurity/modsecuirty.conf以查看会发生什么。再次,事情似乎正常工作

# systemctl status logrotate
● logrotate.service - Rotate log files
       Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
       Active: inactive (dead) since Thu 2021-06-10 09:54:05 CST; 4s ago
         Docs: man:logrotate(8)
               man:logrotate.conf(5)
      Process: 21452 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
     Main PID: 21452 (code=exited, status=0/SUCCESS)

    Jun 10 09:54:05 tester1.example.com systemd[1]: Starting Rotate log files...
    Jun 10 09:54:05 tester1.example.com systemd[1]: logrotate.service: Succeeded.
    Jun 10 09:54:05 tester1.example.com systemd[1]: Started Rotate log files.

同样的故事/etc/modsecurity/modsecurity-recommended,这意味着 logrotate 服务仅在我使用时失败,
/etc/logrotate.d/modsecuirty并且碰撞必须是@Nikita Kipriyanov 建议的通配符

linux logrotate
  • 2 个回答
  • 2729 Views
Martin Hope
Maestro223
Asked: 2021-05-26 01:47:35 +0800 CST

VPS 解析和静态 IP

  • 0

我有一个由国际知名托管服务提供商托管的 vps 服务器,奇怪的是,他们似乎无法对自己的系统进行故障排除,令人不安。

有两个具体问题,可能相关也可能不相关。

目前,我有一个 debian 10.5 vps 实例,它有 dhcp ip,(公共/私有 ips 尽管 dhcp 状态永远不会改变

问题:

我需要从 dhcp 切换到静态 ip 才能在我的主机上运行某些包。使用托管服务提供商提供的说明,我将/etc/network/interfaces文件配置如下:

#The loopback network interface
auto lo
iface lo inet loopback

#The primary network interface
auto eth0
iface eth0 inet static
   address XXX.XX.XX.XXX
   netmask 255.255.255.0
   gateway XXX.XX.XX.XXX 

但是,重新启动后ip a仍然显示我的主网络接口 eth0,配置为“动态”而不是静态:

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:xx:xx:01:XX:9d brd ff:ff:ff:ff:ff:ff
    inet xxx.xx.xx.xxx/18 brd xxx.xx.xx.xx scope global dynamic eth0   <---shows dynamic
       valid_lft xxxxxxxsec preferred_lft xxxxx4sec

另外我的内容/etc/resolv.conf丢失了:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
options timeout:2 attempts:3 rotate single-request-reopen

有没有人知道出了什么问题?谢谢

注意:除了这些问题之外,其他一切似乎都运行良好。

resolv.conf debian-buster static-ip
  • 1 个回答
  • 86 Views
Martin Hope
Maestro223
Asked: 2021-01-08 19:04:26 +0800 CST

Ubuntu 20.04 LAMP 和 WP 多站点的 OpenSSL 配置

  • 0

问题: 如何将 1 个 OpenSSL 证书应用于 html 目录中的所有网站? 问题:访问时https://localhost.site1.com或https://localhost.site2.com只显示index.html位于/var/www/html/index.html因为default-ssl.conf文档根目录是/var/www/html/

我有 2 个 wordpress 多站点(和其他站点)位于/var/www/html/:

/var/www/html/site1.com

和

/var/www/html/site2.com

在我的default-ssl.conf我有:

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
    ServerAdmin [email protected]
    ServerName localhost
    ServerAlias localhost

    DocumentRoot /var/www/html/
    
    ErrorLog ${APACHE_LOG_DIR}/localhost.error.log
    CustomLog ${APACHE_LOG_DIR}/localhost.access.log combined

            SSLEngine on
    SSLCertificateFile  /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    
    #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
            DirectoryIndex index.php
            AllowOverride All
            Order allow,deny
            Allow from all
            Require all granted
    </Directory>

    #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
    #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
    #   "force-response-1.0" for this.
      BrowserMatch "MSIE [2-6]" \
            nokeepalive ssl-unclean-shutdown \
            downgrade-1.0 force-response-1.0

</VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

在我的/etc/hosts文件中,我有:

127.0.1.1   excalibur
127.0.0.1   localhost 
127.0.0.1   localhost.site1.com *.localhost.site1.com   # mainsite url
127.0.0.1   subsite-a.localhost.site1.com   
127.0.0.1   subsite-b.localhost.site1.com
127.0.0.1   subsite-c.localhost.site1.com

127.0.0.1   localhost.site2.com *.localhost.site2.com   # mainsite url

site1.com 的虚拟主机包含:

    <VirtualHost *:80>

    ServerName localhost.site1.com 
    ServerAlias www.localhost.site1.com
    
    # If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.

    ServerAdmin [email protected]

    ErrorLog ${APACHE_LOG_DIR}/localhost.site1.com.error.log
    CustomLog ${APACHE_LOG_DIR}/localhost.site1.com.access.log combined

    DocumentRoot /var/www/html/site1.com
    
    <Directory /var/www/html/site1.com>
        Options None FollowSymLinks
        # Enable .htaccess Overrides:
        AllowOverride All
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /var/www/html/site1.com/wp-content>
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
    
    
   SSLEngine on
   SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
   SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

</VirtualHost>

site2.com 的虚拟主机包含:

    <VirtualHost *:80>

    ServerName localhost.site2.com
    ServerAlias www.localhost.site2.com
    
    # If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.

    ServerAdmin [email protected]

    ErrorLog ${APACHE_LOG_DIR}/localhost.site2.com.error.log
    CustomLog ${APACHE_LOG_DIR}/localhost.site2.com.access.log combined

    DocumentRoot /var/www/html/site2.com
    
    <Directory /var/www/html/site2.com>
        Options None FollowSymLinks
        # Enable .htaccess Overrides:
        AllowOverride All
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /var/www/html/site2.com/wp-content>
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
    
   SSLEngine on
   SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
   SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
   
</VirtualHost>

有小费吗?

openssl wordpress-mu
  • 1 个回答
  • 84 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