Posts Tagged ‘ Linux & Unix

Add CA certifice from Let’s Encrypt to Java 8

For add cert to Java 8 you need use keytool

cd /tmp/ && \
curl -O https://letsencrypt.org/certs/letsencryptauthorityx1.der && \
sudo $JAVA_HOME/bin/keytool -noprompt -importcert -alias letsencryptauthorityx1 -keystore $JAVA_HOME/jre/lib/security/cacerts -file  letsencryptauthorityx1.der  -storepass changeit && \
curl -O https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.der && \
sudo $JAVA_HOME/bin/keytool -noprompt -importcert -alias lets-encrypt-x3-cross-signed -keystore $JAVA_HOME/jre/lib/security/cacerts -file lets-encrypt-x3-cross-signed.der -storepass changeit

Read more

Syncthing: Debian run script

syncthing
Rename syncthing.txt to syncthing
Put to /etc/init.d/
Change USER and DAEMON vars

 chmod 755 /etc/init.d/syncthing

To run Syncthing :

sudo service syncthing start

For autostart

sudo update-rc.d syncthing defaults

Certificate order in Haproxy PEM file

For SSL in Haproxy you need to create PEM-file and put cert plus private key. But in right order

-----BEGIN MY CERTIFICATE-----
-----END MY CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
-----END INTERMEDIATE CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
-----END INTERMEDIATE CERTIFICATE-----
-----BEGIN ROOT CERTIFICATE-----
-----END ROOT CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----

avconv: simple video converter in Linux

If you want convert video from big size to smartphone size use this Libav tool
Ubuntu:

apt-get install libav-tools

or Gentoo

USE="mp3 speex threads v4l jpeg2k aac amr cpudetection faac opus vdpau x264 webp  x265 xvid " CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1"  emerge -av libav

and command for convert

avconv -i original_video.mkv -b:v 600k -s 576x432 -strict experimental small_size.mp4

Path MTU Discovery Black Hole

Эта проблема совсем не нова. Она описана в RFC 2923 в 2000 году. Но тем не менее, продолжает встречаться с завидным упорством у многих провайдеров. А ведь именно провайдер виноват в данной ситуации: не нужно блокировать ICMP тип 3 код 4. Причем слушаться «голоса разума» ( т. е. клиентов, понимающих в чем проблема) они обычно не хотят.

Решение проблемы с PMTU

Не будем звонить в техподдержку, а попробуем решить проблему, исходя из собственных средств.
Разработчики Linux, тоже знающие о ней, предусмотрели специальную опцию в iptables. Цитата из man iptables:

TCPMSS
This target allows to alter the MSS value of TCP SYN packets, to control the maximum size for that connection (usually limiting it to your outgoing interface’s MTU minus 40 for IPv4 or 60 for IPv6, respectively). Of course, it can only be used in conjunction with -p tcp. It is only valid in the mangle table. This target is used to overcome criminally braindead ISPs or servers which block “ICMP Fragmentation Needed” or “ICMPv6 Packet Too Big” packets. The symptoms of this problem are that everything works fine from your Linux firewall/router, but machines behind it can never exchange large packets:
1) Web browsers connect, then hang with no data received.
2) Small mail works fine, but large emails hang.
3) ssh works fine, but scp hangs after initial handshaking.
Workaround: activate this option and add a rule to your firewall configuration like:

iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

Read more

Upgrade Cacti to 0.8.8g

Very simple to do Cacti upgrade

wget http://www.cacti.net/downloads/cacti-0.8.8g.tar.gz
 
mysqldump -l --add-drop-table cacti > cacti.sql
mv cacti cacti_old
tar xvf cacti-0.8.8g.tar.gz
mv cacti-0.8.8g cacti

Read more

Update MySQL to 5.7

If you want update Mysql from 5.6 to 5.7 do this steps

https://dev.mysql.com/downloads/repo/apt/

Download mysql-apt-config_0.6.0-1_all.deb

Install apt-sources

dpkg -i mysql-apt-config_0.6.0-1_all.deb

After that you have apt-resources for installing
Update resources

apt-get update

Read more

Asterisk 13 + chan_dongle. Уточнения

По следам заметки chan_dongle + asterisk 10
Текущая версия dongle уже не поддерживается на сайте google
Форк можно взять тут https://github.com/bg111/asterisk-chan-dongle
Особо ничего не поменялось.
Собирать будем под Asterisk 13.7

Asterisk 13.7.0, Copyright (C) 1999 - 2014, Digium, Inc. and others

Read more

Show information of certificate

Run this command if you want get SSL certificate info from bash

openssl x509 -in certificate-1.crt -noout -text -certopt no_header,no_version,no_serial,no_signame,no_pubkey,no_sigdump,no_aux

Mysql: errno: 24 – Too many open files) (1018)

При создании бекапа выскочина ошибка

mysqldump: Couldn't execute 'SHOW TRIGGERS LIKE 'logs'': Can't read dir of './mydatabase/' (errno: 24 - Too many open files) (1018)

Хотя в limits.conf указано значение 30000 и в my.cnf

open-files-limit = 20000

И процесс запущен с правильными параметрами

/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql/error.log --open-files-limit=20000 --pid-file=/var/run/mysql.run  --port=3306

Read more

Error install nokogiri

Fetching: mini_portile-0.6.2.gem (100%)
Fetching: nokogiri-1.6.6.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
	ERROR: Failed to build gem native extension.
 
        /usr/bin/ruby1.9.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
 
Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/ruby1.9.1
	--help
	--clean
	--use-system-libraries
	--enable-static
	--disable-static
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--enable-cross-build
	--disable-cross-build
 
 
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.3/ext/nokogiri/gem_make.out

Fix
Read more