Archive for the Linux Category

Feb 20 2015

If your SSL certificate was received in DER format, here is the command to convert it to PEM:

openssl x509 -in signed_cert.der -inform DER -out server.crt

Feb 6 2015

compiling mariadb 10.0 on Slackware

add option
-DWITH_JEMALLOC=NO
to slackbuild

May 15 2014

HDD check on linux

1. Check HDD for bad block
sudo badblocks -v /dev/sda1 > bad-blocks
2. Pass the file to fsck
sudo fsck -t ext4 -l bad-blocks /dev/sda1

Jan 15 2014

clamdscan

Przykład clamdscan
sudo -u clamav clamdscan /home/ftp/samba_public/

Jan 15 2014

Linux random password

in bash script
tr -dc A-Za-z0-9_ < /dev/urandom | head -c 16 | xargs

function in $HOME/.bashrc
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs }

Dec 20 2013

PHP Warning: preg_match(): Compilation failed: support for \P, \p, and \X has not been compiled

recompile pcre with option

–enable-utf8 –enable-unicode-properties

Oct 23 2013

Upgrade all perl modules via CPAN

cpan -r
or
perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

Sep 6 2013

openfire logs problem

Error: java.io.FileNotFoundException: /logs/debug.log (No such file or directory)

Solution:
edit file “./lib/log4j.xml” and replace “{$openfireHome}” with absolute path to logs

Mar 14 2013

fail2ban mysql

Dodaj kod do
/usr/share/fail2ban/server/datedetector.py

# AAMMJJ HH:MM:SS
template = DateStrptime()
template.setName("YearMonthDay Hour:Minute:Second")
template.setRegex("\d{2}\d{2}\d{2} \d{2}:\d{2}:\d{2}")
template.setPattern("%y%m%d %H:%M:%S")
self.__templates.append(template)

# cat /etc/fail2ban/filter.d/mysqld.conf

Fail2Ban configuration file
#
# Author: Darel
#

[Definition]
failregex = Access denied for user ‘.*’@’

Dec 10 2012

perl – uninstall module

perl -MCPAN -e shell
install CPANPLUS
exit

perl -MCPANPLUS -e shell
help
[General]
h | ? # display help
q # exit
v # version information
[Search]
a AUTHOR … # search by author(s)
m MODULE … # search by module(s)
f MODULE … # list all releases of a module
o [ MODULE … ] # list installed module(s) that aren’t up to date
w # display the result of your last search again
[Operations]
i MODULE | NUMBER … # install module(s), by name or by search number
i URI | … # install module(s), by URI (ie http://foo.com/X.tgz)
t MODULE | NUMBER … # test module(s), by name or by search number
u MODULE | NUMBER … # uninstall module(s), by name or by search number
d MODULE | NUMBER … # download module(s)
l MODULE | NUMBER … # display detailed information about module(s)
r MODULE | NUMBER … # display README files of module(s)
c MODULE | NUMBER … # check for module report(s) from cpan-testers
z MODULE | NUMBER … # extract module(s) and open command prompt in it
[Local Administration]
b # write a bundle file for your configuration
s program [OPT VALUE] # set program locations for this session
s conf [OPT VALUE] # set config options for this session
s mirrors # show currently selected mirrors