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

carlitobrigante's questions

Martin Hope
carlitobrigante
Asked: 2021-08-04 15:02:05 +0800 CST

CentOS 上 gitweb.cgi 的权限被拒绝

  • 1

我已经在我的网络服务器上设置了 gitweb。我在服务器上创建了项目。我可以向它们添加提交,也可以远程克隆它们。

当我访问我的 git.website 时,会显示 gitweb“主页”,并且会加载 css、logo、favicon 等静态文件。

问题是我只看到消息:未 找到此类项目。每次刷新网页时,我都会在 /var/log/httpd/error_log 中看到以下内容

[Wed Aug 04 00:39:32.321352 2021] [cgid:error] [pid 44346:tid 140132795492096] [client MY_HOME_IP:37700] fatal: mmap failed: Permission denied: /var/www/git/gitweb.cgi, referer: https://git.mydomain.abc/

我已经确认 httpd 以 apache 用户身份运行,并且 /var/www 的所有权也设置为 apache。我相信权限也已正确设置:

[root@git ~]# ps auxw | grep httpd
root       44780  0.2  1.6 281804 13828 ?        Ss   00:48   0:00 /usr/sbin/httpd -DFOREGROUND
apache     44782  0.0  1.0 295684  8876 ?        S    00:48   0:00 /usr/sbin/httpd -DFOREGROUND
apache     44783  0.0  1.7 1484604 14712 ?       Sl   00:48   0:00 /usr/sbin/httpd -DFOREGROUND
apache     44784  0.0  2.2 1353476 18956 ?       Sl   00:48   0:00 /usr/sbin/httpd -DFOREGROUND
apache     44785  0.0  2.0 1353476 16760 ?       Sl   00:48   0:00 /usr/sbin/httpd -DFOREGROUND
apache     45019  0.0  1.7 1353476 14708 ?       Sl   00:48   0:00 /usr/sbin/httpd -DFOREGROUND
root       45141  0.0  0.1 221928  1140 pts/0    S+   00:48   0:00 grep --color=auto httpd
[root@git ~]# ls -ld /var/ /var/www/ /var/www/git/ ; ls -lZ /var/www/git/gitweb.cgi 
drwxr-xr-x. 21 root   root   4096 Aug  2 18:16 /var/
drwxr-xr-x.  5 apache apache   44 Aug  2 18:23 /var/www/
drwxr-xr-x.  8 apache apache  179 Aug  4 00:18 /var/www/git/
-rwxr-xr-x. 1 apache apache system_u:object_r:git_script_exec_t:s0 253816 Jul 20  2020 /var/www/git/gitweb.cgi
[root@git ~]# 

/etc/gitweb.conf

$projectroot = '/var/www/git/';
$git_temp = "/tmp";
$stylesheet = "static/gitweb.css";
$logo = "static/git-logo.png";
$favicon = "static/git-favicon.png";

/etc/httpd/conf.d/gitweb-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName git.mydomain.abc 
    DocumentRoot /var/www/git
    <Directory /var/www/git>
        SetEnv  GITWEB_CONFIG  /etc/gitweb.conf
        Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All
        order allow,deny
        Allow from all
        AddHandler cgi-script .cgi
        DirectoryIndex gitweb.cgi
    </Directory>
    <Files gitweb.cgi>
        SetHandler cgi-script
    </Files>
SSLCertificateFile /etc/letsencrypt/live/git.mydomain.abc/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/git.mydomain.abc/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

如果有人看到我做错了什么,我将非常感谢一些指导.. 谢谢!

EDIT1: 这里是 audit.log

type=SYSCALL msg=audit(1628072069.412:134): arch=c000003e syscall=9 success=no exit=-13 a0=0 a1=b9 a2=1 a3=2 items=0 ppid=2911 pid=2917 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="git" exe="/usr/bin/git" subj=system_u:system_r:git_script_t:s0 key=(null)ARCH=x86_64 SYSCALL=mmap AUID="unset" UID="apache" GID="apache" EUID="apache" SUID="apache" FSUID="apache" EGID="apache" SGID="apache" FSGID="apache"
type=PROCTITLE msg=audit(1628072069.412:134): proctitle=2F7573722F62696E2F676974002D2D6769742D6469723D2F7661722F7777772F6769742F2F796F75747562652D646C2D62617463682E67697400666F722D656163682D726566002D2D666F726D61743D2528636F6D6D697474657229002D2D736F72743D2D636F6D6D697474657264617465002D2D636F756E743D3100726566
type=AVC msg=audit(1628072069.433:135): avc:  denied  { map } for  pid=2919 comm="git" path="/var/www/git/myrepo01.git/objects/1c/1c5ca1a07da5187a696cd1661d6b2a734ad98c" dev="vda1" ino=36639 scontext=system_u:system_r:git_script_t:s0 tcontext=unconfined_u:object_r:git_content_t:s0 tclass=file permissive=0

EDIT2 问题归结为我不是专家的 SELinux。将模式更改为Permissive我现在可以看到我的所有存储库..但是我必须弄清楚如何使它与Enforced模式一起工作..

centos cgi git apache-2.4 selinux
  • 1 个回答
  • 168 Views
Martin Hope
carlitobrigante
Asked: 2021-08-01 02:08:18 +0800 CST

Postfix 不发送邮件

  • 0

我正在尝试了解邮件服务器,并且对设置中的所有移动部分感到非常害怕..

目前我无法从我的 smtp 服务器发送。我可以很好地接收来自各个域的邮件。

在我的日志中,我在尝试发送邮件时看到以下条目。

  • 邮件日志
Jul 31 11:59:15 mail postfix/submission/smtpd[1290]: connect from unknown[78.136.22.232]
Jul 31 12:01:03 mail postfix/postscreen[1294]: CONNECT from [209.85.214.179]:46881 to [45.77.139.149]:25
Jul 31 12:01:03 mail postfix/postscreen[1294]: PASS OLD [209.85.214.179]:46881
Jul 31 12:01:03 mail postfix/smtpd[1297]: connect from mail-pl1-f179.google.com[209.85.214.179]
Jul 31 12:01:05 mail postfix/smtpd[1297]: 03178A46: client=mail-pl1-f179.google.com[209.85.214.179]
Jul 31 12:01:05 mail postfix/cleanup[1299]: 03178A46: message-id=<CAMJ_LmbWv_5o7GZJx8RwqOqz52O_sWTrgX0_=mSi_Vt6+uz++Q@mail.gmail.com>
Jul 31 12:01:05 mail postfix/cleanup[1299]: 03178A46: milter-reject: END-OF-MESSAGE from mail-pl1-f179.google.com[209.85.214.179]: 5.7.1 Gtube pattern; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-pl1-f179.google.com>
Jul 31 12:01:05 mail postfix/smtpd[1297]: disconnect from mail-pl1-f179.google.com[209.85.214.179] ehlo=2 starttls=1 mail=1 rcpt=1 data=0/1 quit=1 commands=6/7
Jul 31 12:04:15 mail postfix/submission/smtpd[1290]: timeout after CONNECT from unknown[78.136.22.232]
Jul 31 12:04:15 mail postfix/submission/smtpd[1290]: disconnect from unknown[78.136.22.232] commands=0/0
root@mail:~#

我的操作系统是 Debian 9,所有 iptables 规则在测试时都已刷新。这是我的 master.cf 和 main.cf --> https://pastebin.com/9WUnzYZt

谢谢

EDIT1: 我忘了提及的事情。我从我的 main.cf 中执行了 grep 'smtp.*restrict'。我注意到 smtpd_recipient_restrictions 指向一个 sql 文件。sql文件本身有以下查询..这可能是外发邮件失败的原因吗?

root@mail:~# grep smtp.*restrict /etc/postfix/main.cf
smtpd_relay_restrictions =      reject_non_fqdn_recipient
smtpd_recipient_restrictions = check_recipient_access mysql:/etc/postfix/sql/recipient-access.cf
smtpd_client_restrictions =     permit_mynetworks
smtpd_helo_restrictions =   permit_mynetworks
smtpd_data_restrictions = reject_unauth_pipelining
root@mail:~# grep query /etc/postfix/sql/recipient-access.cf
query = select if(sendonly = true, 'REJECT', 'OK') AS access from accounts where username = '%u' and domain = '%d' and enabled = true LIMIT 1;
root@mail:~#

EDIT2:我配置 mutt 以排除这是客户端问题,但我似乎仍然无法让它工作..

└─[$] <> cat muttrc
set folder = "imaps://[email protected]@imap.mydomain.abc:993"
set smtp_url =  "smtp://[email protected]@smtp.mydomain.abc:587"

set from = "[email protected]"
set realname = "hostmaster"

set spoolfile = "+Inbox"
set record = "+Sent"
set trash = "+Trash"
set postponed = "+Drafts"

mailboxes =Inbox =Sent =Trash =Drafts =Junk =Other

但是,每当我尝试发送邮件时,无论它是另一个域还是与发件人相同的电子邮件地址,我都会看到此错误

SMTP session failed: 451 4.3.0 <[email protected]>: Temporary lookup failure 
linux mysql debian email postfix
  • 1 个回答
  • 387 Views
Martin Hope
carlitobrigante
Asked: 2021-07-31 14:25:53 +0800 CST

POSTFIX:新邮件服务器。既不能发送也不能接收邮件

  • 0

我正在尝试了解邮件服务器并设置了一个。但是,我既不能发送,也不能接收邮件。我可以登录到我的电子邮件帐户,我看到文件夹(收件箱、已发送、垃圾箱等)正在电子邮件客户端中填充。另外 /var/log/syslog 表示我的用户已通过 imap-login 成功登录

当我在登录之前单击 Thunderbird 的测试按钮时,测试总是失败并显示:“Thunderbird 找不到您的电子邮件帐户的设置” 我已经完全关闭了服务器上的防火墙。我相信我的 DNS 记录设置正确,因为 MX 查找不返回任何错误/警告。我已经验证了 dovecot 中指定的 mysql 用户确实对用于邮件的数据库具有权限,域、别名和帐户表都已创建。[email protected] 已导入到帐户表中。

有任何想法吗?

这是我设置它的指南,我也在使用 Debian 9。谢谢!

debian email postfix dovecot
  • 1 个回答
  • 61 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