LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-11-2010, 10:00 PM   #1
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Rep: Reputation: 15
Post postfix and selinux [selinux updates broke postfix?]


Hi all, I've been looking at this again, your input will be appreciated

I did a "yum update" to install selinux updates
Code:
Mar 10 05:34:54 Updated: selinux-policy-3.3.1-135.fc9.noarch
Mar 10 05:35:17 Updated: selinux-policy-targeted-3.3.1-135.fc9.noarch
Now postfix wont sendmails with selinux enabled;

I want to get postfix sending emails without having to disable selinux :S
I can start postfix and it sends emails with selinux off | SETENFORCE 0
If i then SETENFORCE 1 without stopping postfix the service still runs but doesnt sendmail :S

Code:
Mar 11 05:24:38 HOSTNAME postfix/cleanup[27957]: fatal: open lock file pid/unix.cleanup: cannot open file: Permission denied
Mar 11 05:24:39 HOSTNAME postfix/master[27911]: warning: process /usr/libexec/postfix/cleanup pid 27957 exit status 1
Mar 11 05:24:39 HOSTNAME postfix/master[27911]: warning: /usr/libexec/postfix/cleanup: bad command startup -- throttling
^^^ OK WHATS THIS?? Permission denied? - IF I CAN FIX THIS IT SHOULD WORK! ^^^


BACKGROUND INFO

Hi all, all this is done by looking at forums/docs on the net;

So my server has been running fine for a year or so, i use postfix and dovecot;
I wanted to update some mailboxes so i added a user

Code:
adduser -s /sbin/nologin sales; passwd info
(later realising that there was in a config file aliases)

Code:
sales:		postmaster
so i changed that by commenting it out.

Code:
#sales:		postmaster
Futher reading showed I then needed to update this by using

Code:
newaliases
and
Code:
/etc/init.d/postfix restart
but postfix wouldent shutdown to startup again;
futher reading and log file viewing showed an avc: denied message so i turned of selinux
Code:
setenforce 0
and
Code:
/etc/init.d/postfix restart
worked,

great, reading futher i did a "yum update" to install selinux updates
Code:
Mar 10 05:34:54 Updated: selinux-policy-3.3.1-135.fc9.noarch
Mar 10 05:35:17 Updated: selinux-policy-targeted-3.3.1-135.fc9.noarch
but i still cant start or stop postfix with selinux turned on;



ok so after the SELINUX update, now POSTFIX wont send mails if SELINUX is turned on !!

I found this on bugzilla
Code:
https,//bugzilla.redhat,com/show_bug.cgi?id=553492
^^ had to replace : and . with , cos i'm not allowed to post links yet

"Bug 553492 - New selinux packages broke Postfix "

"One of my mailservers running postfix has suddenly stopped sending mail"

Same problem as me, postfix has stopped sending emails with selinux turned on after selinux updates!

Can anyone help cos the bugzilla posts freak me out, i have no-idea about below

Code:
Create a file called mypostfix.te with the following content.

=================================cut =========================================
policy_module(mypostfix, 1.0)

gen_require(`
 type sendmail_t;
')

allow postfix_postdrop_t sendmail_t:unix_stream_socket { getattr read write
ioctl };
=============================================================================

# make -f /usr/share/selinux/devel/Makefile
# semodule -i mypostfix.pp
i have no-idea if this is a fix or not, its bugzilla posts has confuzzled me!

Help a nub out please

Regards
 
Old 03-11-2010, 10:18 PM   #2
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
The steps you found on Red Hat's bugzilla site should fix your problem. There are three steps to follow. First create the text file as instructed. Second, use "make" to create a module to install into SELinux. Then finally, install the newly created module.

Have you followed the bugzilla steps yet, or have you been waiting for a reply?

I had the same problem with Postfix on CentOS a month or three back, and the fix you found fixed it for me
 
Old 03-11-2010, 10:35 PM   #3
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by blacky_5251 View Post
The steps you found on Red Hat's bugzilla site should fix your problem. There are three steps to follow. First create the text file as instructed. Second, use "make" to create a module to install into SELinux. Then finally, install the newly created module.

Have you followed the bugzilla steps yet, or have you been waiting for a reply?

I had the same problem with Postfix on CentOS a month or three back, and the fix you found fixed it for me
Hi thankyou for the confirmation, I havent followed those steps on bug report yet as i was unsure about it, i will give it a go now, thank-you again brb
 
Old 03-11-2010, 10:37 PM   #4
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
BTW, a later update to SELinux was delivered for CentOS that solved the issue as well. This might not have filtered down to FC9 yet though. If you've just received the Postfix bug, it might be another couple of weeks before the SELinux policy fix arrives
 
Old 03-11-2010, 10:48 PM   #5
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15
I don't get it :S

I made a file called mypostfix.pp and uploaded it to my root folder;
its content is;

Code:
policy_module(mypostfix, 1.0)

gen_require(`
 type sendmail_t;
 type postfix_postdrop_t;
')

allow postfix_postdrop_t sendmail_t:unix_stream_socket { getattr read write
ioctl };
Then i did

Code:
make -f /usr/share/selinux/devel/Makefile
make: /usr/share/selinux/devel/Makefile: No such file or directory
make: *** No rule to make target `/usr/share/selinux/devel/Makefile'.  Stop.
figured it the make -f needed to point to the file mypostfix.pp so;

Code:
make -f mypostfix.pp
mypostfix.pp:1: *** missing separator.  Stop.
and

Code:
semodule -i mypostfix.pp
libsepol.module_package_read_offsets: wrong magic number for module package:  expected 0xf97cff8f, got 0x696c6f70
libsemanage.parse_module_headers: Could not parse module data.
semodule:  Failed on mypostfix.pp!
help i'm such a nub :S
 
Old 03-11-2010, 10:49 PM   #6
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
The text file is meant to have a suffix of te, not pp. The make command should create the pp file.
 
1 members found this post helpful.
Old 03-11-2010, 10:56 PM   #7
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15
Renamed it but still get

Code:
make -f mypostfix.te
mypostfix.te:1: *** missing separator.  Stop.
the file has the following content

Code:
policy_module(mypostfix, 1.0)

gen_require(`
 type sendmail_t;
 type postfix_postdrop_t;
')

allow postfix_postdrop_t sendmail_t:unix_stream_socket { getattr read write
ioctl };
 
Old 03-11-2010, 11:05 PM   #8
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15
Gonna try and use linux to create the file via the ssh screen, i used notepad++ on windows2000 to make the file, then just tried the notepad++ "convert to unix format" and still no joy, gonna see if i can figure out how to make the file ...(VI perhaps) I'm such a nub
 
Old 03-11-2010, 11:24 PM   #9
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
It doesn't look quite right to me. Try this file:-
Code:
module postfix 1.0;

require {
        type postfix_postdrop_t;
        type tmp_t;
        class file getattr;
}

#============= postfix_postdrop_t ==============
allow postfix_postdrop_t tmp_t:file getattr;
Using a Linux editor is a must as well Notepad is notorious for breaking files

Last edited by blacky_5251; 03-11-2010 at 11:25 PM.
 
1 members found this post helpful.
Old 03-11-2010, 11:32 PM   #10
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15
touch mypostfix.te
vi mypostfix.te (edited empty file)

Code:
cat mypostfix.te
policy_module(mypostfix, 1.0)

gen_require(`
 type sendmail_t;
 type postfix_postdrop_t;
')

allow postfix_postdrop_t sendmail_t:unix_stream_socket { getattr read write
ioctl };
I still get
Code:
make -f mypostfix.te
mypostfix.te:1: *** missing separator.  Stop.

so i pasted your code into vi
Code:
cat mypostfix.te
module postfix 1.0;

require {
        type postfix_postdrop_t;
        type tmp_t;
        class file getattr;
}

#============= postfix_postdrop_t ==============
allow postfix_postdrop_t tmp_t:file getattr;
I still get
Code:
 make -f mypostfix.te
mypostfix.te:1: *** missing separator.  Stop.
;(

aww the joys of the learning curve

;(
 
Old 03-11-2010, 11:47 PM   #11
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
Do you have the SELinux development package installed?
Code:
rpm -qa | grep selinux-policy-devel
If not, you will need to install it before you can go on. The make command was actually correct before, it just wasn't working because it couldn't find the SELinux development Makefile (i.e. /usr/share/selinux/devel/Makefile).

So, get the RPM installed and we'll start again using these commands (assuming you've already created the text file mypostfix.te:-
Code:
make -f /usr/share/selinux/devel/Makefile
semodule -i mypostfix.pp
The "make" command should create the file mypostfix.pp, so don't continue unless it is there.
 
Old 03-11-2010, 11:49 PM   #12
spampig
Member
 
Registered: Feb 2010
Location: /Earth/UK/England/Hampshire
Distribution: Debian, Ubuntu, CentOS, Slackware
Posts: 262
Blog Entries: 2

Rep: Reputation: 56
I'm not sure if this will help - but a quick google on 'missing separator' gives this...

"Unlike most other Make programs which accept any whitespace character at the beginning of a command in a rule, GNU Make insists that every such line begins with a TAB. (Most other Unix Make programs also require TABs, and the Posix standard requires it as well.) Make sure that the line whose number is printed in the error message (in this case, line 1) begins with a TAB."

BTW From your last paste on the make, is that space supposed to be there or is it a cut/paste typo?
 
Old 03-11-2010, 11:58 PM   #13
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15
YAY!
Code:
yum install selinux-policy-devel

Installed:
  selinux-policy-devel.noarch 0:3.3.1-135.fc9

Complete!
Code:
make -f /usr/share/selinux/devel/Makefile
Compiling targeted mypostfix module
/usr/bin/checkmodule:  loading policy configuration from tmp/mypostfix.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 8) to tmp/mypostfix.mod
Creating targeted mypostfix.pp policy package
rm tmp/mypostfix.mod.fc tmp/mypostfix.mod

Code:
[root@HOSTNAME ~]# semodule -i mypostfix.pp
[root@HOSTNAME ~]#
this last command gave no output just went to the next command line; i assume it executed something :s

Gonna start postfix now and check to see if it sends mail with setenforce 1

fingers crossed....
 
Old 03-11-2010, 11:59 PM   #14
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
Also, stick with the original text file you found here:- https://bugzilla.redhat.com/show_bug.cgi?id=553492
 
Old 03-12-2010, 12:09 AM   #15
rjcroasdale
Member
 
Registered: Mar 2010
Posts: 36

Original Poster
Rep: Reputation: 15


still have to disable selinux to get mail to send;

still have these messages in maillog and message

Code:
Mar 12 06:03:52 HOSTNAME postfix/cleanup[7581]: fatal: open lock file pid/unix.cleanup: cannot open file: Permission denied
Mar 12 06:03:53 HOSTNAME postfix/master[7523]: warning: process /usr/libexec/postfix/cleanup pid 7581 exit status 1
Mar 12 06:03:53 HOSTNAME postfix/master[7523]: warning: /usr/libexec/postfix/cleanup: bad command startup -- throttling]
Code:
Mar 12 06:03:52 HOSTNAME kernel: type=1400 audit(1268373832.566:232533): avc:  denied  { connectto } for  pid=7581 comm="cleanup" path="/var/run/nscd/socket" scontext=unconfined_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket
Mar 12 06:03:52 HOSTNAME kernel: type=1400 audit(1268373832.566:232534): avc:  denied  { connectto } for  pid=7581 comm="cleanup" path="/var/run/nscd/socket" scontext=unconfined_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket
Mar 12 06:03:52 HOSTNAME kernel: type=1400 audit(1268373832.567:232535): avc:  denied  { connectto } for  pid=7581 comm="cleanup" path="/var/run/nscd/socket" scontext=unconfined_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket
Mar 12 06:03:52 HOSTNAME kernel: type=1400 audit(1268373832.567:232536): avc:  denied  { connectto } for  pid=7581 comm="cleanup" path="/var/run/nscd/socket" scontext=unconfined_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket
Mar 12 06:03:52 HOSTNAME kernel: type=1400 audit(1268373832.568:232537): avc:  denied  { read write } for  pid=7581 comm="cleanup" name="unix.cleanup" dev=sda1 ino=8306741 scontext=unconfined_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file

Should the command
Code:
[root@HOSTNAME ~]# semodule -i mypostfix.pp
[root@HOSTNAME ~]#
have outputted something?

I confirm the files the make command created are
mypostfix.fc
mypostfix.if
mypostfix.pp

and i used
Code:
policy_module(mypostfix, 1.0)

gen_require(`
 type sendmail_t;
 type postfix_postdrop_t;
')

allow postfix_postdrop_t sendmail_t:unix_stream_socket { getattr read write
ioctl };
in the .te file.

Thankyou again for taking the time to help me

Last edited by rjcroasdale; 03-12-2010 at 12:13 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix broke after update, please help! Brandon.Wamboldt Linux - Server 2 12-06-2009 09:41 AM
"../system.h :selinux/selinux.h:no such file or directory" ashmita04 Linux From Scratch 4 02-05-2009 03:36 AM
Postfix: postfix: fatal: chdir(/usr/libexec/postfix) Micro420 Ubuntu 2 07-13-2008 12:21 PM
I think I broke SELinux blanny Linux - Security 1 10-08-2006 12:52 AM
Problem with Postfix and SElinux jc materi Linux - Security 1 06-22-2006 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration