Преди няколко дни излезе XAMPP 1.8.0 вчера след надграждане от версия 1.7.7 имах доста интересен проблем. Phpmyadmin-а не ми се отваряше и изгърмяваше със 403

Access forbidden!


New XAMPP security concept:

Access to the requested object is only available from the local network.

This setting can be configured in the filehttpd-xampp.conf”.

Веднага отворих httpd-xampp.conf който при мен се намира в /opt/lampp/etc/extra/, на пръв поглед всичко изглеждаше наред. Правилата за локалната мрежа бяха наред. Отделно че отварях от localhost. WTF ??? Погледнах log-а гледам че достъпа ми е отрязан от конфигуацията. Тука вече нещата ме ахнаха и честно казано донякъде малко на късмет открих проблема. След като преглеждах httpd.conf-а видях в Allow/Deny клаузите един последен ред Require all granted. О да еврика. Това е новия контролен механизъм който влезе в apache 2.4.x. С него се дава достъп или се отказва такъв на всички изискани, в общи линии се имитира Allow/Deny функционалността :). За да поправим проблема добавяме Require all granted в директивите за папката /opt/lampp/phpmyadmin. After the changes, it looks like this to me

<Directory “/opt / lampp / phpmyadmin”>
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
Require all granted
</Directory>

 

Viangi can try other savages, for example to rename the phpmyadmin folder to something else and make an alias to no. But it's uglier and not very meaningful 🙂

p.s I was asked why I use XAMPP and not a clean installation of all components as my Debian gave birth to them – the answer is very very simple – LAZINESS. I'm too lazy to write a few commands and then touch my conf and so on. It is much easier to download the whole package, unzip and burn 😉

Enhanced by Zemanta

A shell script wants your job

Today while I was working I saw that one of the machines was lying very badly. I go into it watching a cron bump into a hell of a lot of zombie processes (roughly around 50-60). There was no way I could kill them all with killall so I had to make a little more competent solution to the problem – to draw an elementary bash a script to find and kill processes. 50-PIDs are not easy to write by hand :D. I scratched the script for a minute and it is very simple, but it still deserves attention 🙂

At its base is the conveyor

ps ax | grep -v grep | grep process_name | awk '{print $1}')

Here we get a sheet with all the PIDs of the process that we have to kill by excluding grep from this list. Now that we have the list, things become easy, everything turns into one for. Here is the end result

#!/bin/bash

PR=$(ps ax | grep -v grep | grep process_name | awk '{print $1}')

for PID in $PR
do
echo "$PID will be killed"
kill -9 $PID
done

Can be “tuning” as the name is taken as an argument after the name of the script and thus is called as executable binary. However, it is not a very good practice to have such frequent cases 😀 But it never prevents us from being protected from any

Enhanced by Zemanta