Also using the answer above
setsebool -P httpd_can_network_connect=1 setsebool -P httpd_can_network_connect_db=1
I also had to change the security context of the file httpd was trying to access.
Skipping the php script running through apache tried to access the certificate file, which was outside the normal root of the httpd document. Changing file permissions for httpd access was not enough to allow httpd access to this file. I also had to switch to a security context, so before changing:
[admin]$ ls -Z ../../certs/rds-ca-2015-root-us-east-1-BUNDLE.pem -rw-r--r--. admin apache unconfined_u:object_r:unlabeled_t:s0 ../../certs/rds-ca-2015-root-us-east-1-BUNDLE.pem
Change context using:
sudo chcon -v --type=httpd_sys_content_t ../../certs/rds-ca-2015-root-us-east-1-BUNDLE.pem```
To obtain:
[admin]$ ls -Z ../../certs/rds-ca-2015-root-us-east-1-BUNDLE.pem -rw-r--r--. admin apache unconfined_u:object_r:httpd_sys_content_t:s0 ../../certs/rds-ca-2015-root-us-east-1-BUNDLE.pem
Now all is well. A good resource to view is /var/log/audit/audit.log , and note the errors. In my case, the error indicating the direction of the resolution was:
type=AVC msg=audit(1509047616.042:4049): avc: denied { read } for pid=17096 comm="httpd" name="rds-ca-2015-root-us-east-1-BUNDLE.pem" dev="xvdb" ino=262146 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:unlabeled_t:s0 tclass=file
Kahitarich
source share