How to run varnish as a non-privilege user? - compilation

I need to run varnish as a non-root user. Here is what I'm actually doing:
wget https://repo.varnish-cache.org/source/varnish-4.0.2.tar.gz
tar xzf varnish-4.0.2.tar.gz
./configure --prefix=/home/neuquino/varnish
make
make install
But, when I run varnishd command I get the following error:
Message from VCC-compiler:
Not running as root, no priv-sep
It seems to be something with VCL compiler. Is there any option I should pass to the ./configure or make commands to be able to run varnishd as a normal user?
I'm looking forward to find something like ./configure --user=neuquino, but I can't find such option in the configure file.

Related

Install wkhtmltopdf on CPanel server without root acces

I'm trying to use wkhtmltopdf on my CPanel server. But I haven't root access and I can't put it in /usr/local/bin or /usr/bin/ .
So I just put the script on my /home/perso/wkhtmltopdf and made a chmod +x wkhtmltopdf.
But if I try to execute it, for example like this: ./wkhtmltopdf http://www.google.com test.pdf I get a
bash: ./wkhtmltopdf: cannot execute binary file
Any idea how can I place my script in order to be able to execute it ?
To run wkhtmltopdf, you need to install on the server.
Try to ask your hosting provider.
Usually for security, providers disable the execution of binary scripts by ordinary users.

Can be a docker layer "bypassed" on build?

let's supposse I have a Dockerfile like this:
FROM debian:stretch
RUN apt update
RUN apt install -y wget
RUN wget https://stackoverflow.com/
# I know the wget is useless. Is just an example :)
CMD ["echo", "hello-world"]
I want to put over the wget statement, a new RUN statement. After this change, when I rebuild, It will re-run all the commands from my modification to down, so the wget will be executed again. The problem is that the wget command takes so much time to finish because on my real file, the file is a very big file.
The question is, can be docker "tweaked" somewhere in order to avoid on building the execution again of the wget layer? If I already built it, can that layer be used again even changing a statement over it?
Thank you.
AFAIK this is not possible, as docker only reuses the layers up until your change and starts to build again from there on out.
This is because the new layers get tested on the previously built layers (so your RUN wget layer is tested and built on the layers from FROM to RUN apt install -y wget). So if you'd enter another RUN instruction above the RUN wget instruction, you'd get a changed environment for your RUN wget instruction, so it needs to be executed again.
I don't think there's a way to fidget with it manually so it would reuse the layer built on a "different" environment and neither would I recommend it.
Using docker-compose, or the -v flag when running docker run you can mount a volume that will persist between runs. Change your wget to a script that conditionally runs in absence of the file.
That won’t cache the later but will make that step faster.
You may need to modify the folder where you store that file depending on the rest of your script and how your environment is set up.
I’m using compose for volume mounting here: https://github.com/jaydorsey/ghgvcR/blob/master/docker-compose.yml
Look at the bin/download-files.sh file in that repo for a bash example.

Getting chef-client 11.14.6 for later MacOSX versions

I have inherited a cheffed OSX machine running chef-client 11.14.6. I am trying to lay my hands on the installer for 11.14.6, but it seems that Chef have pulled it from the downloads site ( https://downloads.chef.io/chef-client/mac/ ).
Does anyone know anything about this, or know where I can get "archived" version?
Much appreciated.
I don't see any copies in any repos so it's probably lost to the mists of time by now. You should be able to build a new one using this commit from omnibus-chef https://github.com/chef/omnibus-chef/tree/6d5001c588edacc98f6045e22c70195200111660
Yes. From my research, and the research of others. It seems as if it has been removed.
However, we (I can't take the credit - it was one of my colleagues :) ) managed to get it working. We had another machine with the correct version on it, so we grabbed it from there and zipped it up (using root as the base, and grabbing /opt/chef).
Once tarball (e.g. opt.chef-11.14.6.tar.gz) is transferred to new machine, these were the steps used:
install chef-client v11.10.4 using:
(echo "version=11.10.4"; curl -L https://www.opscode.com/chef/install.sh) | sudo bash
verify your chef-client version is currently reported as 11.10.4 with "chef-client -v"
extract the tarball as root into the root filesystem using:
cd / && tar xvfz /tmp/opt.chef-11.14.6.tar.gz
verify your chef-client version is now reported as 11.16.4 with "chef-client -v"
run your knife bootstrap command like normal, but don't include the --bootstrap-version parameter, it'll detect chef-client is already installed and use the one you have installed manually.
I did not try rebuilding it.

Grunt-contrib-sass or the sass gem is not working when using git push

I'm pretty sure I've tracked the issue down to Node.js not seeing Sass, but I have no clue why...
If I push from my laptop using:
git push lamp somebranch:master, the server remotely checks it out fine, runs npm install without error, and starts processing the gruntfile, but then aborts with "remote: Warning: spawn ENOENT Use --force to continue."
However, (after I push from my laptop like above) I can ssh in, cd into my hooks directory and run ./post-receive and it finishes "Done, without errors." I also tried running grunt in the website's root and it also completed without error.
Any ideas as to what might be going on? I'm completely stumped. Should I set paths to the sass gem in the hook? I scrapped down my gruntfile to use the same target locally as well as on the server to rule out the gruntfile. It compiles fine locally, compiles fine on the server, but fails only when using git push lamp somebranch:master.
Some may wonder why I just didn't compile locally and dump the css into the web root from the devel box... perhaps I should. This time though, I really wanted Push-to-deploy all the way through, compiles and all. For anyone attempting the same thing and running into the same problem, this should help.
First off, it probably wouldn't hurt to scrub the system of any versions of ruby and sass that were installed via the distro's package manager. Then I scrubbed any remnants of previous tinkering with rvm implode and removed traces from .bashrc, etc. Next I ran \curl -sSL https://get.rvm.io | bash -s stable --ruby --auto-dotfiles and pressed ctrl-c to fix any errors first. Once the install script was happy, I let it download and install as normal. I did not have to use rvm install n.n.n,rvm use n.n.n, or rvm use n.n.n --default as 2.2.1 was pulled in like I wanted anyway and seemed fine. After rvm had setup ruby, I then ran gem install sass
Now, the end-all-be-all... using PermitUserEnvironment, like had been mentioned here: How to use sshd-config permituserenvironment option was the way to go. I saw that there were security concerns with that method, but it was the only thing that worked and I won't be trying to run limited shells. It is normal behavior for SSH to not allow the env vars when not using a login shell. I assumed, however, that the git hooks had full access to the user's normal vars (with ruby paths, etc.) and that assumption was incorrect. Add PermitUserEnvironment yes to the server's /etc/ssh/sshd_config or the like and restart the ssh daemon. As the user on the server, I ran env and copied that into .ssh/environment and cleaned up what wasn't needed. After that, I did my git push from the devel box and it found and ran the sass compiler just fine.

Class 'AMQPConnection' not found

I am using Mac OSX Lion. I am running php ver 5.3.6 through MAMP and when trying the create a AMQPConnection I get this error
Class 'AMQPConnection' not found
I installed rabbitmq through macports using this command
$ sudo port install rabbitmq-server
I run the server using this command
$ sudo rabbitmq-server -detached
It all works fine
I added "extension=amqp.so" to my php.ini file. More specifically my /Applications/MAMP/bin/php/php5.3.6/conf/php.ini file.
I have rabbitmq-c
I ran autoreconf -i && ./Configure && make && sudo make install with no errors
I configured rabbit with this command phpize && ./configure && make && make install
All that seemed to go perfectly.
I even created my user with permissions and verified those permissions with the web plugins that can be accessed through localhost:55672
I even tried copying amqp.so into my /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/ file in a futile attempt to get it working.
Everything that I have done has seemed to work flawlessly. I get no error/warning messages. The Rabbit server is running. I ran it without the -detached option to see if I was getting any errors there. Nothing.
Any Suggestions??????
Best way to test your RabbitMQ Server installation is by testing with simple python code.
Installing PIKA library on Mac OSX is very easy. Follow the steps given here.
http://www.rabbitmq.com/tutorials/tutorial-one-python.html
copy paste and create two python files receive.py and send.py. Execute these from two terminal windows. In about 10 minutes you'll know that RabbitMQ is able to receive the message and queue.
Create the info.php on server with
Check the results from browser if it shows AMQP library is active.
I feel your RabbitMQ server is installed, but PHP library is not getting loaded correctly.
Check your error.log. There must be some details why it is failing to load 'amqp.so' file.
Can You please Add:
use PhpAmqpLib\Message\AMQPMessage;
under your:
use PhpAmqpLib\Connection\AMQPStreamConnection;
line and it will work.

Resources