JSON support was not enabled-Modsecurity - mod-security

1) I have compiled modsecurity using YAJL using --with-yajl but in the config log I see that the yajl library is not picked and in the modsecurity log I get
"JSON support was not enabled"

I initially had mod_security working with PHP 5.5 and Apache 2.4, with Ubuntu 12.04, but after enabling JSON request inspection I got the same error as you reported.
To fix it, I had to make yajl, re-compile mod_security with the yajl configure option, and then ensure that Apache was using the updated mod_security, and restart Apache.
mod_security was then able to successfully parse json request body and not output the error any longer.
I went to http://lloyd.github.io/yajl/ and found the download package for yajl-2.1.0, and then referred to https://gist.github.com/rpfilomeno/1140359f4bd360137a98.
For example:
tar -xvzf lloyd-yajl-2.1.0-0-ga0ecdde.tar.gz
cd lloyd-yajl-66cb08c/
sudo ./configure
sudo make
sudo make install
sudo ldconfig
That should install yajl. Then cd to the folder with the mod_security files, and run
cd ../modsecurity-2.9.1/
sudo ./configure --with-yajl="/usr/local/lib /usr/local"
sudo make
sudo make install
I then configured it to run with Apache 2.4, and have been able to parse requests with a JSON body.
*Note that when making yajl, if there is an error relating to cmake not being installed, run the following sudo apt-get install cmake, and then try making it again.

Check your config.log if it has following
checking for libyajl config script... no
checking for yajl install... no
configure: optional yajl library not found
Then create a link to yajl.pc as
# ln -s /usr/local/share/pkgconfig/yajl.pc /usr/share/pkgconfig/yajl.pc
In my case file yajl.pc was in /usr/local/share/pkgconfig/ location. If you cannot find it there try " find / -name yajl.pc " to locate it.
Hope this helps you.

Related

Vmware on Arch: Could not open /dev/vmmon: No such file or directory

I want to install VMware Workstation on Arch. I used the command yay -S vmware-workstation to install. After installation finished, I ran VMware, created an VM, started it, and got the error:
Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.
I tried to install linux-header but it still didn't work.
OS: Arch Linux, 5.10.56-1-lts.
Thanks for any help!
I ran into this problem too, and the solutions I found online ended up having their own problems that needed to be solve, which I'll document here.
To solve the error Could not open /dev/vmmon/: you need to run:
sudo vmware-mod-config --console --install-all
If this returns an error about Glib not having support, you need to clone https://github.com/mkubecek/vmware-host-modules.git and make it.
$ git clone https://github.com/mkubecek/vmware-host-modules.git
$ cd vmware-host-modules
$ git checkout -b 16.2.1 origin/workstation-16.2.1
$ sudo make
If this returns an error containing fatal error: generated/autoconf.h: No such file or directory, you need to install linux-headers and make sure it matches your linux kernel version. Probably also make sure your kernel is up to date, although I'm not sure if that's necessary.
$ sudo pacman -S linux
$ sudo reboot
$ sudo pacman -S linux-headers
Now you should be able to make install in that cloned repo, which should install the required modules for you to be able to run the vmware-mod-config --console --install-all command, which should solve the issue.
So working backwards, the steps are:
Update your linux kernel and install the right linux-headers for it.
Clone this git repo, cd into it, git checkout -b 16.2.1 origin/workstation-16.2.1, and run sudo make install
Run sudo vmware-mod-config --console --install-all
More about can be found at my post here: https://bbs.archlinux.org/viewtopic.php?pid=2020372#p2020372
I also encountered same problem. Most of the stackoverflow pages suggest to reinstall the vmware but its not a fair solution and even its not a solution. Its just like if you have pain in teeth remove that teeth.
Another thing is that some post and even vmware official posts said to disable secure boot.
But after trying both nothing changed so i goto to cd /dev and found that the file vmmmon exists.
And when i tries to load the file it loaded successfully.
So from here i concluded that to solve this issue do the following:
Either disable the secure boot or sign the vmmon.
CD to /dev/
Load vmmon using modprobe
and as always Happy coding....
The command: sudo vmware-modconfig --console --install-all works, but every time that I reboot the system the error come out again.
In my case, the cause of this problem was the vmmon didn't be load. So I just
sudo modprobe -v vmmon
and it work.

Not able to create site-package inside /usr/lib/Python2.7 it shows "Operation not permitted"

I was trying to install thrift(0.11.0) over my system(macOs 10.14.5).For which I downloaded and extracted tar file. Then I ran following commands :
./bootstrap.sh
./configure
make
make install
But make install throwed the following error :
error: could not create '/usr/lib/python2.7/site-packages': Operation not permitted
then I also tried manually creating site-package inside /usr/lib/python2.7 but still the error message was same.
I have also tried sudo while running make install but it didn't helped much.
1.open thrift's subfolder lib/py/ and modify the Makefile as follow:
PY_PREFIX=/usr
change to
PY_PREFIX = /Users/amy/python
2.sudo make install
I faced the same problem trying to install thrift on Mac OS.
I found a separate guide for installing thrift on Mac OS, I tried it and it finally worked successfully:
1- Download the boost library from boost.org untar compile with
./bootstrap.sh
sudo ./b2 threading=multi address-model=64 variant=release stage install
2- Download libevent, untar and compile with
./configure --prefix=/usr/local
make
sudo make install
3- Download the latest version of Apache Thrift, untar and compile with
./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local
Try it and let me know your results.
Reference: Apache Thrift - OS X Install

Error: VNDK library: libandroid_net's ABI has EXTENDING CHANGES

I am setting up an environment to run AOSP code on Ubuntu 18.04.1 LTS and got the error "error: VNDK library: libandroid_net's ABI has EXTENDING CHANGES". Please help me to resolve this. I have searched for hours but didn't get the solution.
I have done following things:
Installed required packages: sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip
Installed community-maintained default set of udev rules for all Android devices: apt-get install adb
Install repo: https://source.android.com/setup/build/downloading.html
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Initializing a Repo client
mkdir WORK
cd WORK
git config --global user.name "Your Name"
git config --global user.email "you#example.com"
repo init -u https://android.googlesource.com/platform/manifest
Installed pixel 3 XL binaries which include google-devices and qcom blueline. Used Extractor and ./*.sh command to extract them.
Copied qcom extracted vendor folder into Source Code and then copied pixel 3 xl vendor folder. Meged and replaced in all dialogs.
Run make clobber to clean the build directory.
Run . build/envsetup.sh to initialize the environment.
Run lunch aosp_arm-eng to select your run target as asop_arm BUILD with eng BUILDTYPE.
Run make -j16 to build the code.
Got build error:
error: VNDK library: libandroid_net's ABI has EXTENDING CHANGES
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e7400000, 83886080, 0) failed; error='Not enough space' (errno=12)
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000cac00000, 73400320, 0) failed; error='Not enough space' (errno=12)
For 'Not enough space' error: I am setting cache and configuring jack
export USE_CCACHE=1 to enable compiler cache
Failed to do prebuilts/misc/linux-x86/ccache/ccache -M 15G because there is no ccache folder exists.
export ANDROID_JACK_VM_ARGS="-Xmx4g -Dfile.encoding=UTF-8 -XX:+TieredCompilation" to configure Jack.
For resolving the VNDK issue I am not sure by may be binaries I have included are not correct so I have deleted the vendor folder that contains Pixel 3 XL binaries.
I am a newbie for this task and just started a week ago to look into this.
Please suggest.
Thank you in advance.

installing php-imap on amazon ec2 linux 2

I need to install php-imap on amazon ec2 linux 2 instance.
All the php stuff is inside amzn2extra-lamp-mariadb10.2-php7.2 but php-imap package is missing.
Any advice ?
Thanks
I installed it like this.
I downloaded the php source code of the currently installed version in my Amazon Linux 2
wget http://php.net/get/php-7.2.8.tar.bz2/from/a/mirror
Unpacked it and went into php-7.2.8/ext/imap/
Compiled extension:
phpize
./configure
I got some errors.
Some U8T_CANONICAL stuff so
sudo yum install libc-client-devel
Then libc-client.a not found so created a symlink for it:
cd /usr/lib
sudo ln -s /usr/lib64/libc-client.a
some other imap library error so:
sudo yum install uw-imap-static
I got some other errors so the working configure line was:
./configure --with-kerberos --with-imap-ssl
make
SUCCESS!
cd php-7.2.8/ext/imap/modules
sudo cp imap.so /usr/lib64/php/modules/
Created an ini file to load it:
sudo vi /etc/php.d/30-imap.ini
added to the file this content:
extension=imap
restarted php service (you might need to restart httpd depending on your php installation):
sudo systemctl restart php-fpm
PHPinfo now contains:
imap
IMAP c-Client Version 2007f
SSL Support enabled
Kerberos Support enabled
For those who are facing the U8T_CANONICAL error and can't being able to install the libc-client-devel on Amazon Linux 2 AMI need to do something extra to resolve the U8T_CANONICAL error.
The main problem is that libc-client-devel isn't available so we need to do it in another way.
I found this link while searching for my problem. The solution that is posted here is solid. The following link that i gave is for those who are not being able to install the libc-client-devel will be benifited from the link.
Or you could just copy paste the commands i'm giving below.
1 - sudo yum groupinstall "Development Tools"
2 - sudo amazon-linux-extras install epel
3 - yum install epel-release
4 - sudo yum install libc-client-devel uw-imap-static openssl-devel
5 - sudo ln -s /usr/lib64/libc-client.a /usr/lib
The rest can be followed from respondent.
Again thanks to the person who answered.
Same problem here.
I came from debian/ubuntu and i miss a lot of php packages on aws linux2.
I know it's still a candidate and not a final LTS release. Only worked for a month with this distro and saw a lot of changes and updates. Some php dependencies can be solved with pear or pecl, but I couldn't get nothing working on php-imap.
php-imap depends on libc-client (maybe that's a problem?)
Here is my solution.
Search for the libc-client rpm that correspond to your version and
install manually.
Search for the rpm that corresponds to your php installed version. In my case it was 7.2.5**-2** about 2 weeks ago. (today is
7.2.5**-3** ) and isntall manually
CODE
wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64//php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm -P /tmp
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libc-client-2007f-16.el7.x86_64.rpm -P /tmp
rpm -i /tmp/libc-client-2007f-16.el7.x86_64.rpm
rpm -i /tmp/php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm
If it fails because Failed dependencies:
rpm -ivh /tmp/php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm --nodeps
I dont like this solution, but can't find for now any other solution more stable and easy. It will be a pain with updates....

How do you install Docutils from the Terminal so that Django admindocs will work?

Docutils is a great package. If you are using Django the admindocs package needs docutils. Instructions are available for installing with a web browser, but what if you are remote and logging in with a terminal over SSH? How to install in that case? What if you just want a quick recipe to do the job with the terminal?
I know I'm rather late to this question, but the accepted answer doesn't really reflect the common best practices from Python community members (and even less so from the Django community members.) While the outlined manual installation process does work, is is far more pains taking and error prone than the following:
You really should be using Pip. With Pip installing docutils system wide is as simple as:
$ sudo pip install docutils
This not only works for docutils but nearly any package on the 'Cheese Shop' as well as many other code repositories (Github, Bitbucket, etc.)
You may also want to look into other common Python best practice tools like virtualenv and virtualenvwrapper so that you can avoid global package installation.
To install Pip on Ubuntu/Debain I generally do the following:
$ sudo apt-get install python-pip
BTW: for virtualenv 'sudo apt-get install python-virtualenv' and for virtualenvwrapper 'sudo apt-get install virtualenvwrapper'.
The key to the install is to use the curl utility. The following will install docutils:
mkdir docutilsetup
cd docutilsetup
curl -o docutils-docutils.tar.gz http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/?view=tar
gunzip docutils-docutils.tar.gz
tar -xf docutils-docutils.tar
cd docutils
sudo python setup.py install
This performs the following steps: Create a directory to download docutils into. cd into the directory just made, and use curl to download the zipped version of docutils. Unzip the file which creates a subdirectory docutils. cd into that directory and install with root permissions.
If you are using Django you will have to restart Django for admindocs to start working.
Although it is an old thread, I want to share the answer I found. To install type command
sudo apt install python-docutils
or
sudo apt install python3-docutils
This will install the dependencies too. Yesterday, I installed docutils using this command for Geany editor and it is working fine.