Hello,
I am running mailserver and I installed logwatch into it. Normally when I executed logwatch via console or cronscript with root user everything works fine. But planned cronjob not working properly.
I am receiving emails like:
Code:
/etc/cron.daily/0logwatch:
sendmail: error while loading shared libraries: libcrypto.so.1.0.0: cannot enable executable stack as shared object requires: Permission denied
So I started with investigation:
1. library with name libcrypto exist on system and there are 2 samples of it:
Code:
openssl-1.0.0-25.el6_3.1.x86_64 : A general purpose cryptography library with
: TLS implementation
Repo : installed
Matched from:
Filename : /usr/lib64/libcrypto.so.1.0.0
zimbra-core-7.2.1_GA_2790.RHEL6_64-20120815212147.x86_64 : Zimbra Core
Repo : installed
Matched from:
Filename : /opt/zimbra/openssl-1.0.0j/lib/libcrypto.so.1.0.0
2. I tried to find out what permissions they have, looks like lib in /usr dir have w for root, but it should not be cause of problem I think
Code:
-rwxr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib64/libcrypto.so.1.0.0
-r-xr-xr-x. root root system_u:object_r:lib_t:s0 /opt/zimbra/openssl-1.0.0j/lib/libcrypto.so.1.0.0
3. Then I found out, its SELinux related and I found this in audit.log
Code:
type=AVC msg=audit(1357439119.411:13817): avc: denied { execstack } for pid=22452 comm="sendmail" scontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023 tcontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023 tclass=process
type=SYSCALL msg=audit(1357439119.411:13817): arch=c000003e syscall=10 success=no exit=-13 a0=7fff604bf000 a1=1000 a2=1000007 a3=7fc0c2ffb000 items=0 ppid=22159 pid=22452 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=778 comm="sendmail" exe="/opt/zimbra/postfix-2.7.10.3z/sbin/sendmail" subj=system_u:system_r:logwatch_t:s0-s0:c0.c1023 key=(null)
4. I found out that libraries have different GNU STACK
/usr/lib64/libcrypto.so.1.0.0
Code:
Elf file type is DYN (Shared object file)
Entry point 0x5ca00
There are 7 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000173324 0x0000000000173324 R E 200000
LOAD 0x0000000000173cd0 0x0000000000373cd0 0x0000000000373cd0
0x0000000000021ad0 0x00000000000257b8 RW 200000
DYNAMIC 0x000000000018b510 0x000000000038b510 0x000000000038b510
0x00000000000001c0 0x00000000000001c0 RW 8
NOTE 0x00000000000001c8 0x00000000000001c8 0x00000000000001c8
0x0000000000000024 0x0000000000000024 R 4
GNU_EH_FRAME 0x0000000000145654 0x0000000000145654 0x0000000000145654
0x00000000000085d4 0x00000000000085d4 R 4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 8
GNU_RELRO 0x0000000000173cd0 0x0000000000373cd0 0x0000000000373cd0
0x0000000000018330 0x0000000000018330 R 1
Section to Segment mapping:
Segment Sections...
00 .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss
02 .dynamic
03 .note.gnu.build-id
04 .eh_frame_hdr
05
06 .ctors .dtors .jcr .data.rel.ro .dynamic .got
/opt/zimbra/openssl-1.0.0j/lib/libcrypto.so.1.0.0
Code:
Elf file type is DYN (Shared object file)
Entry point 0x60a40
There are 6 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000189f24 0x0000000000189f24 R E 200000
LOAD 0x000000000018a000 0x000000000038a000 0x000000000038a000
0x0000000000022170 0x0000000000025c20 RW 200000
DYNAMIC 0x00000000001a2070 0x00000000003a2070 0x00000000003a2070
0x00000000000001c0 0x00000000000001c0 RW 8
NOTE 0x0000000000000190 0x0000000000000190 0x0000000000000190
0x0000000000000024 0x0000000000000024 R 4
GNU_EH_FRAME 0x000000000015b46c 0x000000000015b46c 0x000000000015b46c
0x0000000000008804 0x0000000000008804 R 4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RWE 8
Section to Segment mapping:
Segment Sections...
00 .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss
02 .dynamic
03 .note.gnu.build-id
04 .eh_frame_hdr
05
Ok the questions are now:
a) why it doesnt work if I can run logwatch succesfuly via console w/o errors but with crontab it cannot work?
b) which library is used when the task is executed from crontab of these 2? its from usr or zimbra dir? how to find it out?
c) how to solve this problem? any suggestions?
Thank you very much for your time