Unable to code sign the apache modules in mac - apache

I get the below error while starting Apache
root# sudo apachectl configtest
[Tue Jun 28 13:31:53.686521 2022] [so:error] [pid 8913] AH06665: No code signing authority for module at /private/libexec/apache2/mod_dispatcher.so specified in LoadModule directive.
httpd: Syntax error on line 191 of /private/etc/apache2/httpd.conf: Code signing absent - not loading module at: /private/libexec/apache2/mod_dispatcher.so
To fix the above problem, I created Certificate Authority in mac machine by following - https://www.simplified.guide/macos/keychain-ca-code-signing-create and trying to codesign to sign the AEM Dispatcher module with below command
codesign --sign "XXX CA" --force --keychain ~/Library/Keychains/login.keychain-db /private/libexec/apache2/mod_dispatcher.so
But I get the following error The specified item could not be found in the keychain.
Ref - https://www.codexpedia.com/apache-server/no-code-signing-authority-for-module-php-on-mac-monterey/
Can anyone tell me if there is any problem in above command ?
My macOS version is 12.2 (Monterey)

Related

Flask Apache Start Fails with Permission Denied

I am trying to install Flask on my CentOS 7.9.2009 VM running Apache HTTP Server. I've installed Python3.8 and mod_wsgi but when I attempt to start Apache I get the below Permissioned denied when loading the mod_wsgi. I've checked multiple blogs and forums and cannot find a resolution. Any idea why I am getting this error?
Error: cannot open shared object file: Permission denied
httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/02-wsgi.conf: Cannot load /home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so into server: /home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so: cannot open shared object file: Permission denied
I installed python3.8 from source using ./configure --enable-optimizations --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" but I am still getting the above permission denied error.
Below is how my app.conf file looks like and also output of mod_wsgi module-config.
app.conf:
LoadModule wsgi_module "/home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so"
mod_wsgi module-config:
[myuser#mycentos conf.d]$ mod_wsgi-express module-config
LoadModule wsgi_module "/home/myuser/.local/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so"
WSGIPythonHome "/usr/local"
I get the error when I try to start Apache - sudo systemctl start httpd.
The permission issue was because of SELinux enabled/enforced on my system. I reached out to one of the mod_wsgi source code authors and he pointed me to check this. For now disabling this resolved my immediate issue. If others have suggestions to resolve this without turning it off please suggest.
$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31

Moodle 3.4 installation on Centos 7

Installing a test Moodle (3.4.1) using the instructions on Moodle site but only got blank page when accessing it. I put the moodle installation on /var/www/html/moodle. The install.php script returns with success.
I am using PHP 7.0 on the ius repository.
httpd error log has these entries:
[Thu Jan 18 10:45:24.626059 2018] [:error] [pid 29857] [client ::1:41946] PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
[Thu Jan 18 10:21:39.114019 2018] [:error] [pid 28769] [client ::1:41930] PHP Fatal error: Unknown: Failed opening required '/var/www/html/moodle/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
I have tried to chmod to 755 and still the same problem.
Am I missing some php libraries?
Thanks,
Alex
try to give all the rights
sudo chmod -R 777 /path/to/moodle
Probably I did something wrong during the first install. Redid a clean install and everything works fine.

Apache mod_ssl could not be loaded

Trying to enable the mod_ssl module on Apache 2.4.25, I get the following error:
httpd: Syntax error on line 129 of /ld01/otsweb/build/apache/httpd24.conf: Cannot load modules/mod_ssl.so into server: \t0509-022 Cannot load module /usr/local/apache24/modules/mod_ssl.so.\n\t0509-150 Dependent module libssl.so could not be loaded.\n\t0509-022 Cannot load module libssl.so.\n\t0509-026 System error: A file or directory in the path name does not exist.\n\t0509-022 Cannot load module /usr/local/apache24/modules/mod_ssl.so.\n\t0509-150 Dependent module /usr/local/apache24/modules/mod_ssl.so could not be loaded.
Line 129 is the LoadModule ssl_module modules/mod_ssl.so line in the httpd.conf file.
I have the same configuration running correctly on another server. That server does not have a libssl.so file on it, yet Apache with SSL is running.
Apache was configured with: (OpenSSL version is 1.0.2k from openssl.org)
./configure --enable-mods-shared="proxy proxy_http" --enable-auth-digest --enable-ssl --with-ssl=/usr/local/ssl/bin
Has anyone seen this same error?
With the release of OpenSSL 1.0.2l we decided to reinstall Apache from scratch, and everything is working correctly. A clean install of both seems to have cleared out the problem.

Apache crashes with munmap_chunk(): invalid pointer after update to php7 on Jessie

I recently updated to php 7.0.4 on my server running a Debian 8.
here is what dpkg -l | grep php gives me:
ii libapache2-mod-php7.0 7.0.4-1~dotdeb+8.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-common 21-1~dotdeb+8.1 all Common files for PHP packages
ii php-readline 21-1~dotdeb+8.1 all readline module for PHP [default]
ii php7.0 7.0.4-1~dotdeb+8.1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.0-cli 7.0.4-1~dotdeb+8.1 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.4-1~dotdeb+8.1 all Common files for packages built from the PHP source
ii php7.0-curl 7.0.4-1~dotdeb+8.1 amd64 CURL module for PHP
ii php7.0-gd 7.0.4-1~dotdeb+8.1 amd64 GD module for PHP
ii php7.0-imap 7.0.4-1~dotdeb+8.1 amd64 IMAP module for PHP
ii php7.0-intl 7.0.4-1~dotdeb+8.1 amd64 Internationalisation module for PHP
ii php7.0-json 7.0.4-1~dotdeb+8.1 amd64 JSON module for PHP
ii php7.0-mcrypt 7.0.4-1~dotdeb+8.1 amd64 libmcrypt module for PHP
ii php7.0-mysql 7.0.4-1~dotdeb+8.1 amd64 MySQL module for PHP
ii php7.0-opcache 7.0.4-1~dotdeb+8.1 amd64 Zend OpCache module for PHP
ii php7.0-readline 7.0.4-1~dotdeb+8.1 amd64 readline module for PHP
My php applications run fine most of the time.But on some requests I just get a Page being generated for no foreseeable reason.
The /var/log/apache2/error.log states in such a case:
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6ddb4a50 ***
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6dd5cad0 ***
[Wed Mar 09 11:26:44.940931 2016] [core:notice] [pid 28486] AH00052: child pid 29338 exit signal Aborted (6)
[Wed Mar 09 11:26:44.941017 2016] [core:notice] [pid 28486] AH00052: child pid 29344 exit signal Aborted (6)
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6dd5cad0 ***
[Wed Mar 09 11:26:46.942581 2016] [core:notice] [pid 28486] AH00052: child pid 29347 exit signal Aborted (6)
I'll give some more information:
Syntax:
$ apachectl configtest
Syntax OK
Version:
apachectl -v
Server version: Apache/2.4.10 (Debian)
Server built: Nov 28 2015 14:05:48
Before the php update I did not see those errors. What is wrong here? Or how can I better find the source? I am lost here because this error occures kind of random. Sometimes the same request succeeds that faild with this error a minute ago. I would apprechiate your help.
That's now the second time we have been hit hard by the very same issue.
It happens when running PHP 7.0 on a up to date debian.
This will break any type of website system which heavily uses regular expression.
We have seen it iwth Neos (neos.io) or Typo3 (starting with 6.2).
In case it's not possible to use the testing version of the libpcre3.
Someone can disable the just in time compiling within the php.ini
Edit your php.ini add pcre.jit=0 anywhere you like
Restart your apache
Be happy
I have the same version and solved by upgrading libpcre3 like #Kevin Fischer write.
I was upgrade libpcre3 package form 2:8.35-3.3+deb8u4 (stable) to 2:8.38-3.1 (testing) version.
Step by step:
Add line deb http://ftp.us.debian.org/debian testing main contrib non-free to /etc/apt/sources.list
Create file /etc/apt/apt.conf.d/99default-release with content: APT::Default-Release "stable";
Run command apt-get update from root
Run command apt-get -t testing install libpcre3 to install testing version of libpcre3 package
Restart your server and check logs, error should be disappears.
For more info to install testing package see this question.
Warning! Testing packages can works incorrectly! Update in your own risk or wait new release.
We've just had a similiar situation, where one of our framework's components would fail us with:
*** Error in `php': munmap_chunk(): invalid pointer: 0x00007fdce5550060 ***
I can't tell you anything about the bug itself, but the cause of it was a broken libpcre3 version, namely 8.35-3.3+deb8u4. We we're running a custom build, because PHP7 requires JIT support from libpcre3, which isn't included in the default one our Ubuntu version comes with (Ubuntu 14.04 LTS, 8.31-2ubuntu2.3). Upgrading the libpcre3 version solved the problem for us.
I also kept getting those nasty apache crashes, but none of the solutions above and on other websites were working for me.
After a lot of trial and error, I found out the root cause on my system.
I manually edited the PHP configuration and added two extensions. Both for Microsoft's SQL Server.
I added the following lines to the php.ini
extension=sqlsrv.so
extension=pdo_sqlsrv
I did not notice that I fogot the ".so" at the pdo driver.
After changing the lines as shown below, the Apache service is running fine again.
extension=sqlsrv.so
extension=pdo_sqlsrv.so

Centos | Yiiframework | Permission Denied

I am facing permission denied error while trying to deploy an Yii based application on Apache Httpd server, following are logs of same.
require_once(): Failed opening required
'/home/tarun/scripts/yii-1.1.13/framework/yii.php'
(include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/hellouttarakhand.com/index.php on line 12 [Sat Apr 06
14:49:03 2013] [error] [client ::1] PHP Warning:
require_once(/home/tarun/scripts/yii-1.1.13/framework/yii.php): failed
to open stream: Permission denied in
/var/www/hellouttarakhand.com/index.php on line 12
Due to above error, application page always appears blank as script is not able to execute.
I have given chmod 777 to yii root folder as well executed following command
chcon -Rv --type=httpd_user_content_rw_t
/home/tarun/scripts/yii-1.1.13/
but still no luck with this error.
Any pointers will be appreciated.