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

Leonard Challis's questions

Martin Hope
Leonard Challis
Asked: 2016-04-28 04:15:32 +0800 CST

为什么 apache 不允许使用 SELinux 进行符号链接?

  • 4

我有一个简单的场景:我想符号链接/home/leonard/apache/sandbox/markdown到/home/leonard/github/markdown-editor,以便markdown-editor可以从我的浏览器中查看。

我设置了链接,ln -s /home/leonard/github/markdown-editor /home/leonard/apache/sandbox/public/markdown它显示出来并且可以很好地导航。

但是,当我在浏览器中查看时,我得到403 Forbidden. 我audit.log的显示如下:

type=AVC msg=audit(1461759062.021:1232192): avc:  denied  { read } for  pid=30107 comm="httpd" name="markdown" dev=md2 ino=25300345 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=lnk_file
type=SYSCALL msg=audit(1461759062.021:1232192): arch=c000003e syscall=4 success=no exit=-13 a0=7f88e34cff28 a1=7ffc036e2dd0 a2=7ffc036e2dd0 a3=7f88dec032e0 items=0 ppid=36009 pid=30107 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=88286 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(1461759062.022:1232193): avc:  denied  { getattr } for  pid=30107 comm="httpd" path="/home/leonard/apache/sandbox/public/markdown" dev=md2 ino=25300345 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=lnk_file
type=SYSCALL msg=audit(1461759062.022:1232193): arch=c000003e syscall=6 success=no exit=-13 a0=7f88e34d0018 a1=7ffc036e2dd0 a2=7ffc036e2dd0 a3=1 items=0 ppid=36009 pid=30107 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=88286 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

我在这里看到了其他问题,询问如何设置符号链接的上下文,但我不确定它们是否相关,因为链接与其他(在浏览器中完全可以查看)相邻目录相同:

[leonard@ombrelle public]$ ls -alZ
drwxr-xr-x. leonard developers unconfined_u:object_r:user_home_t:s0 .
drwxr-xr-x. leonard developers unconfined_u:object_r:user_home_t:s0 ..
-rw-r--r--. leonard developers unconfined_u:object_r:user_home_t:s0 .htaccess
-rw-r--r--. leonard developers unconfined_u:object_r:user_home_t:s0 index.php
lrwxrwxrwx. leonard developers unconfined_u:object_r:user_home_t:s0 markdown -> /home/leonard/github/markdown-editor
drwxr-xr-x. leonard developers unconfined_u:object_r:user_home_t:s0 notes

我怎样才能让符号链接以这种方式工作?

更新

使用伊恩的回答,我跑了audit2why < /var/log/audit/audit.log,得到了:

type=AVC msg=audit(1461761590.750:1232443): avc:  denied  { getattr } for  pid=37683 comm="httpd" path="/home/leonard/apache/sandbox/public/markdown" dev=md2 ino=25300345 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=lnk_file

        Was caused by:
        The boolean httpd_enable_homedirs was set incorrectly.
        Description:
        Allow httpd to read home directories

        Allow access by executing:
        # setsebool -P httpd_enable_homedirs 1

运行setsebool命令神奇地使它工作。我只是不确定/home/*/apache/sitename.tld在没有启用此功能的情况下,我们拥有的所有其他站点 () 是如何工作的?

apache-2.2 symbolic-link selinux centos6.5
  • 2 个回答
  • 2275 Views
Martin Hope
Leonard Challis
Asked: 2015-08-08 05:20:18 +0800 CST

我可以在 SAN 自签名证书中使用通配符吗?

  • 5

我们有一个可通过 Internet 访问的开发服务器,但受 IP 限制,因此这里的安全性只是允许我们重现实时环境的一种方式,而不是试图确保安全。没有使用顶级域,我们称之为dev.com,但开发人员将每个站点都设置在自己的特定子域中。因此,假设有site1.com,site2.com和site3.com, 然后开发人员george将nico拥有完整的 URL,例如:

  • www.site1.com.george.dev.com
  • www.site2.com.george.dev.com
  • www.site1.com.nico.dev.com
  • ETC

本来以为通配符自签名证书就可以了,后来发现*.dev.com只适用于something.dev.com子域而不是子域。我决定按照这个答案中的说明进行操作。当我使用:

DNS.1 = www.site2.com.nico.dev.com
DNS.2 = www.site1.com.george.dev.com

一切正常,但不幸的是,许多网站都有很多开发人员,所以这里有超过 100 个条目DNS.x。我想知道是否可以在[ alternate_names ]我的openssl.cnf. 我尝试了以下方法:

DNS.1 = dev.com
DNS.2 = www.site1.com.george.dev.com
DNS.3 = *.*.*.nico.dev.com

虽然DNS.2有效,DNS.3但没有,给我NET::ERR_CERT_COMMON_NAME_INVALIDChrome 中的错误。

有没有办法做到这一点,还是我必须生成一个很长的DNS.x条目列表来涵盖所有站点?

我听说通过创建我自己的 CA,这是可能的。我遵循了有关此答案的重要说明。在我自己的 CA 完好无损的情况下,我创建了一个与DNS.1通用名称相同的证书,DNS.2并DNS.3使用如下通配符:

DNS.1 = dev.com
DNS.2 = *.dev.com
DNS.3 = *.*.*.*.nico.dev.com

然后我cacert.pem从上面链接的指南的第一步导入到 chrome 作为受信任的根证书颁发机构并重新启动浏览器。对于每个域配置,我分别将 and 设置为and并SSLCertificateKeyFile测试了几个域:SSLCertificateFileserverkey.pemservercert.pem

  • 当转到主域https://dev.com时,我看到了绿色挂锁!
  • 当转到子域https://www.dev.com时,我还看到了绿色挂锁!
  • 转到 URL https://www.test.com.nico.dev.com时,我看到了错误NET::ERR_CERT_COMMON_NAME_INVALID
  • 当我转到https://www.xxxxxxxxxx.com.nico.dev.com的任何变体时,我看到了错误NET::ERR_CERT_AUTHORITY_INVALID

所以看起来第一级通配符工作正常,但在此之下,它没有。这对于 Chrome 和 IE(使用 Windows 证书)和 Firefox(管理自己的证书)是相同的。

所以我的问题仍然存在,是否可以以这种方式使用 sub-sub(-sub*) 域?

ssl-certificate
  • 2 个回答
  • 6410 Views
Martin Hope
Leonard Challis
Asked: 2014-11-14 13:42:24 +0800 CST

为什么 yum 不安装更新?

  • 9

我遇到了错误,我认为使用 coreutils,yum 不会更新。这是我在运行时看到的精简输出yum update:

Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-3.el6 will be updated
---> Package PyYAML.x86_64 0:3.10-3.1.el6 will be an update
... more of the same, and then:
--> Processing Dependency: coreutils = 8.4-31.el6_5.2 for package: coreutils-libs-8.4-31.el6_5.2.x86_64
---> Package coreutils.x86_64 0:8.4-37.el6 will be an update
... then more of the same    --> Finished Dependency Resolution
--> Running transaction check
---> Package coreutils.x86_64 0:8.4-31.el6_5.2 will be updated
--> Processing Dependency: coreutils = 8.4-31.el6_5.2 for package: coreutils-libs-8.4-31.el6_5.2.x86_64
---> Package kernel.x86_64 0:2.6.32-431.17.1.el6 will be erased
--> Finished Dependency Resolution
Error: Package: coreutils-libs-8.4-31.el6_5.2.x86_64 (@updates)
           Requires: coreutils = 8.4-31.el6_5.2
           Removing: coreutils-8.4-31.el6_5.2.x86_64 (@updates)
               coreutils = 8.4-31.el6_5.2
           Updated By: coreutils-8.4-37.el6.x86_64 (base)
               coreutils = 8.4-37.el6
 You could try using --skip-broken to work around the problem
** Found 71 pre-existing rpmdb problem(s), 'yum check' output follows:
audit-libs-2.3.7-5.el6.x86_64 is a duplicate with audit-libs-2.2-4.el6_5.x86_64
audit-libs-python-2.3.7-5.el6.x86_64 is a duplicate with audit-libs-python-2.2-4.el6_5.x86_64
... then lots more like the above duplicate

我有另一台服务器(几乎)与此相同(它们是负载平衡的并且从同一个图像工作)并且没有遇到同样的问题。可能是什么问题,我应该如何最好地进行?

更新:

我也运行yum-complete-transaction失败并说它已重命名事务文件。它仍然说有一个不完整的交易,但现在当我运行它时会发生这种情况:

[root@nico ~]# yum-complete-transaction
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * webtatic: uk.repo.webtatic.com
drivesrvr                                                                                                                                                                                                                                |  951 B     00:00
There are 1 outstanding transactions to complete. Finishing the most recent one
The remaining transaction had 252 elements left to run
... lots of:
Package name-1.23.x8x_64 already installed and latest version
...
--> Running transaction check
... lots of entries like this:
---> Package PyYAML.x86_64 0:3.10-3.el6 will be updated
... and this:
---> Package PyYAML.x86_64 0:3.10-3.1.el6 will be an update
... and this:
---> Package audit-libs.x86_64 0:2.2-4.el6_5 will be erased
Killed

然后它突然停在这Killed条线上。

我尝试yum update --skip-broken下一步运行:

[root@nico ~]# yum update --skip-broken
Freeing read locks for locker 0x7d: 28940/139976145426176
Freeing read locks for locker 0x7f: 28940/139976145426176
Freeing read locks for locker 0x80: 28940/139976145426176
Freeing read locks for locker 0x81: 28940/139976145426176
Freeing read locks for locker 0x82: 28940/139976145426176
Loaded plugins: downloadonly, fastestmirror, replace
Setting up Update Process
Loading mirror speeds from cached hostfile
 * webtatic: uk.repo.webtatic.com
drivesrvr                                                                                                                                                                                                                                |  951 B     00:00
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
... lots of will be updated/will be an update/etc, then:
--> Processing Dependency: coreutils = 8.4-31.el6_5.2 for package: coreutils-libs-8.4-31.el6_5.2.x86_64

然后还有几个Running transaction check:s,以及Processing Dependency: coreutils =...更多条目中的willy be updated/willbe an update条目。然后:

Packages skipped because of dependency problems:
    coreutils-8.4-37.el6.x86_64 from base

Dependencies Resolved

然后我会看到一个包含包列表的表格Installing:,Updating:最后有一个摘要:

Install       2 Package(s)
Upgrade      79 Package(s)
Remove        1 Package(s)

然后它会下载所有包(81/81 成功),最后显示:

Total                                                                                                                                                                                                                           3.0 MB/s | 115 MB     00:37
Running rpm_check_debug
Killed

更新 2:

我也跑了yum clean all,在那里也遇到了一些问题。我找到了一些删除__db*文件并重试的建议:

[root@nico ~]# yum clean all
rpmdb: Thread/process 29404/139880514733824 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@nico ~]# rm -f /var/lib/rpm/__db*
[root@nico ~]# yum clean all
Loaded plugins: downloadonly, fastestmirror, replace
Cleaning repos: base drivesrvr epel extras ius newrelic percona-release-noarch percona-release-x86_64 rackspace updates webtatic
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@nico ~]# yum clean all
Loaded plugins: downloadonly, fastestmirror, replace
Cleaning repos: base drivesrvr epel extras ius newrelic percona-release-noarch percona-release-x86_64 rackspace updates webtatic
Cleaning up Everything
[root@nico ~]#

更新 3:

跑的时候尾/var/log/messages了,看到很多输出yum-complete-transaction,最后两行是:

Nov 14 08:19:47 nico kernel: Out of memory: Kill process 30995 (yum-complete-tr) score 149 or sacrifice child
Nov 14 08:19:47 nico kernel: Killed process 30995, UID 0, (yum-complete-tr) total-vm:641952kB, anon-rss:181420kB, file-rss:4kB

所以大概这表明它与记忆有关。如果是这样,这是需要更多 RAM 的情况,还是我需要调查另一个问题?

centos
  • 5 个回答
  • 64009 Views
Martin Hope
Leonard Challis
Asked: 2014-08-22 00:13:20 +0800 CST

离开后再重新加入域后登录域帐户

  • 0

我愚蠢地从公司域中删除了我的笔记本电脑,但使用本地管理员帐户将自己放回了它。它的设置很好,但是我得到了错误there are currently no logon servers available to service the logon request。我知道凭据首先连接到网络时需要缓存,但是我想知道是否有一种方法可以在不连接网络的情况下执行此操作,因为我多年来一直没有问题地登录该帐户,但只是暂时被敲了自己离开域?

或者,这个缓存是否被清除,我需要再次登录才能进入域?

我在 Windows 7 上。

windows
  • 1 个回答
  • 174 Views
Martin Hope
Leonard Challis
Asked: 2014-08-04 05:02:36 +0800 CST

为什么 iptables 不允许 MySQL 连接?

  • 1

由于某种原因,不允许来自特定 IP 地址的 mysql 连接。这是我的规则(从 中获取iptables-save):

-A INPUT -s 12.34.56.78/32 -p tcp -m state --state NEW -m multiport --dports 22,80,3306 -j ACCEPT

这里有趣的是 SSH 连接和 HTTP 页面可以完美加载而没有问题。我后来为 MySQL 连接添加了 3306,但它们似乎被忽略了。为什么?

我在 CentOS 上。我已重新启动 iptables 服务并将 IPTABLES_SAVE_ON_STOP/RESTART 设置为 yes。

运行netstat -tunelp向我展示了这一点:

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      27         8849593    10712/mysqld

这是我的完整规则列表iptables -L:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  192.168.1.0/24       anywhere            state NEW multiport dports ssh,http,mysql
ACCEPT     tcp  --  some-resolved-hostname-1.com  anywhere            state NEW multiport dports ssh,http,mysql
ACCEPT     tcp  --  some-resolved-hostname-2.com  anywhere            state NEW multiport dports ssh,http,mysql
ACCEPT     tcp  --  some-resolved-hostname-3.com  anywhere            state NEW multiport dports ssh,http,mysql
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

注意:服务器端没有日志(包括错误日志)。我尝试连接时遇到的错误是:

D:\>mysql -u username -p -h 12.34.56.78
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '12.34.56.78' (10060)

此外(因为这是来自试图连接的 Windows 机器)我试过这个:

D:\>telnet 12.34.56.78 3306
Connecting To 12.34.56.78...Could not open connection to the host, on port 3306: Connect failed

还要注意的skip_networking是 to to off。

centos
  • 2 个回答
  • 7941 Views
Martin Hope
Leonard Challis
Asked: 2014-06-26 02:37:50 +0800 CST

如何允许访问 apache 中实际上是 RewriteRule 匹配的目录?

  • 0

我们有一个包含很多域的服务器。每个域将具有以下一个或多个我们希望通过 IP 保护的管理区域:

  • domain.tld/admin(管理区域)
  • domain.tld/blog/wp-admin(博客子目录中的 wordpress 管理区域)
  • domain.tld/wp-admin(wordpress 管理区域)

这是我们用来保护所有站点上所有这些的 Apache 配置的一个片段:

<Directory ~ "^/home/user/apache/[^/]+/public/((blog/)?wp\-)?admin">
  AllowOverride All
  Order Deny,Allow
  Deny from all
  Allow from 123.45.67.89 23.45.67.89 34.56.78.90
</Directory>

这会将上述任何文件夹限制为仅对这些 IP 地址可见。对于大多数网站和博客来说,这非常有效。但是,在一个小型站点上,这不起作用。

我认为可能的区别在于admin该站点上的文件夹实际上并不存在,而是RewriteRule匹配 a 以从索引页面提供该页面。奇怪的是它确实阻止/admin并给出了403错误,但它不允许Allow from规则中列出的 IP。

为什么目录匹配和拒绝,但不允许?这是预期的行为吗?我怎样才能解决这个问题?

apache-2.2
  • 1 个回答
  • 2802 Views
Martin Hope
Leonard Challis
Asked: 2014-06-07 05:38:02 +0800 CST

如何允许 apache 在启用 SELinux 的情况下轮换用户主目录中的日志?

  • 3

我们的开发机器有多个用户,他们的各个站点都存储在/home/username/apache. 在这些文件夹中是子文件夹,例如conf包含虚拟主机配置、logs包含日志、public包含实际 Web 文件等。

我想更改日志,而不是单个日志文件:

CustomLog "/home/user/apache/domain.tld/logs/web.log" combined

我们将日志分为每日日志:

CustomLog "|/usr/sbin/rotatelogs -l /home/user/apache/domain.tld/logs/%Y%m%d_web.log 86400" combined

但是,当我放入此配置时,重新启动 apache,然后重新加载页面,同时audit.log进入ausearch,我看到如下错误:

----
type=SYSCALL msg=audit(06/06/2014 14:16:51.401:406272) : arch=x86_64 syscall=open success=no exit=-13(Permission denied) a0=7fff70a92460 a1=80441 a2=1b6 a3=7fff70a92110 items=0 ppid=64542 pid=64617 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1193 comm=rotatelogs exe=/usr/sbin/rotatelogs subj=unconfined_u:system_r:httpd_rotatelogs_t:s0 key=(null)
type=AVC msg=audit(06/06/2014 14:16:51.401:406272) : avc:  denied  { search } for  pid=64617 comm=rotatelogs name=home dev=md2 ino=7208961 scontext=unconfined_u:system_r:httpd_rotatelogs_t:s0 tcontext=system_u:object_r:home_root_t:s0 tclass=dir

我想我可以通过更改类型来解决这个问题,就像我已经解决了其他 SELinux 问题(例如允许 apache 写入文件)一样,但是在尝试了一些之后,我仍然得到上面相同的错误。我试过了httpd_log_t,没有用。httpd_rotatelogs_exec_tvar_log_t

我正在使用chcon命令执行此操作。

我错过了什么?

apache-2.2
  • 2 个回答
  • 4166 Views
Martin Hope
Leonard Challis
Asked: 2013-08-21 01:18:27 +0800 CST

为什么 Firefox 23 显示不受信任的连接错误?

  • 4

我们最近从标准 SSL 证书变为通配符证书。我们使用 RapidSSL 作为我们的证书。从 Firefox 23 开始,我们收到以下不受信任的连接错误:

www.safelincs.co.uk 使用无效的安全证书。

证书不受信任,因为未提供颁发者链。

(错误代码:sec_error_unknown_issuer)

我查看了这个并认为它是缺少中间证书,所以我去了RapidSSL 支持页面并下载了主要中间证书 (crt),然后将以下行添加到 apache 配置中。

SSLCertificateChainFile /path/to/intermediate.crt

成功重新启动 apache 后,我运行了SSL 检查。路径如下:

*.safelincs.co.uk -> RapidSSL CA -> GeoTrust Global CA ->Equifax

我认为这可以解决问题,但是当我访问以下网站时仍然出现错误:https ://www.safelincs.co.uk 。

显然,我不是专家,但是有人可以指出我正确的方向吗?到目前为止,我们注意到这仅发生在 Firefox 23 上,但这是一个大问题,因为这使得我们的销售客户占很大比例。

ssl-certificate
  • 1 个回答
  • 4721 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