You are not logged in.

#1 2020-06-20 06:25:40

Mukundan314
Member
From: Coimbatore
Registered: 2018-02-25
Posts: 13

Gitea: Permission denied when using sendmail as mailer

I am having some trouble configuring gitea to use sendmail as the mailer.
Using the sendmail command from the gitea user seems to work fine.

relavent gitea config (/etc/gitea/app.ini):

[mailer]
ENABLED       = true
FROM          = gitea@mukundan.io
MAILER_TYPE   = sendmail
SENDMAIL_PATH = sendmail

Systemd logs:

$ systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
     Loaded: loaded (/usr/lib/systemd/system/gitea.service; enabled; vendor preset: disabled)
     Active: active (running) since Fri 2020-06-19 17:02:59 IST; 16h ago
   Main PID: 593 (gitea)
      Tasks: 15 (limit: 9394)
     Memory: 142.1M
     CGroup: /system.slice/gitea.service
             ├─ 593 /usr/bin/gitea web -c /etc/gitea/app.ini
             ├─4421 sendmail -f gitea@mukundan.io -i mukundan314@gmail.com
             └─4422 /usr/bin/postdrop -r

Jun 20 09:11:42 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/517158.4422: Permission denied
Jun 20 09:11:52 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/517409.4422: Permission denied
Jun 20 09:12:02 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/517659.4422: Permission denied
Jun 20 09:12:12 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/517874.4422: Permission denied
Jun 20 09:12:22 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/518114.4422: Permission denied
Jun 20 09:12:32 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/518345.4422: Permission denied
Jun 20 09:12:42 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/518576.4422: Permission denied
Jun 20 09:12:52 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/518807.4422: Permission denied
Jun 20 09:13:02 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/519055.4422: Permission denied
Jun 20 09:13:12 gamma postfix/postdrop[4422]: warning: mail_queue_enter: create file maildrop/519294.4422: Permission denied

Also tried the following systemd override, does not seem to fix the problem:

[Service]
NoNewPrivileges=false
PrivateUsers=false
PrivateDevices=false
ProtectHome=false
ProtectSystem=false
ReadWritePaths=/

Last edited by Mukundan314 (2020-06-20 06:45:53)

Offline

#2 2021-04-18 16:15:55

M1CK431
Member
Registered: 2015-11-28
Posts: 16

Re: Gitea: Permission denied when using sendmail as mailer

Hi,

I was having the same issue right now. I have solved it by:
- adding the gitea user to the postdrop group (allow gitea to write in /var/spool/postfix/maildrop)

gpasswd -a gitea postdrop

- override the default systemd service

systemctl edit gitea.service

then add the following:

[Service]
ReadWriteDirectories=/var/spool/postfix/maildrop

I guess it's too late for you @Mukundan314 but I hope this answer could help someone else in the futur.

Offline

Board footer

Powered by FluxBB