Archive for the ‘ Новини ’ Category

Ansible Error: template error while templating string: Encountered unknown tag ‘do’

Just add to ansible.cfg module jinja2.ext.do

[defaults]

# some basic default values...

jinja2_extensions=jinja2.ext.do

Lihgthouse on Debian

Install latest Chrome

apt-get install xvfb imagemagick
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb

install NodeJS and NPM

apt install nodejs
apt install npm
nodejs -v

Install Lighthouse

npm install -g lighthouse

Run test

lighthouse https://reverse.org.ua --chrome-flags="--no-sandbox --headless --disable-gpu"

Scripts for streaming desktop

ffmpeg \
   -video_size 1920x1080 -framerate 60 \
  -f x11grab -i :0.0+100,200 \
  -f alsa -i default \
  -f webm -cluster_size_limit 2M -cluster_time_limit 5100 -content_type video/webm \
  -c:a libvorbis -b:a 96K \
  -c:v libvpx -b:v 1.5M -crf 30 -g 150 -deadline good -threads 4 \
  icecast://source:hackme@localhost:8754/stream.webm

# http://localhost:8754/stream.webm

Source – https://gitlab.com/guoyunhe/plasma-cast/blob/master/stream.sh

After you can use – https://github.com/balloob/pychromecast/

Zookeeper RPM for Centos 7

You can download rpm for version 3.4.14 from url zookeeper-3.4.14-1.x86_64.rpm

It created from original binary from Apache Org

Used: https://github.com/id/zookeeper-el7-rpm

Centos 8 – update linux kernel

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

dnf install https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm

So, install the new kernel.

:~# dnf --enablerepo=elrepo-kernel install kernel-ml

Setup new Kernel to default

grub2-set-default 0

grub2-mkconfig -o /boot/grub2/grub.cfg

Mikrotik as OpenVPN server in 3 steps

Connect to Mikrotik via SSH and start writing text below

Set global VARs

:global COMMONNAME "openVPN"
:global COUNTRY "UA"
:global STATE "KV"
:global LOCALITY "Kyiv"
:global ORG "My org"
:global UNIT ""
:global KEYSIZE "1024"
:global USERNAME "admins"
:global PASSWORD "8charsPassword"
:global NET "77"
:global PORT "7777"

Make server and client CRT

/certificate
add name=ca-template country="$COUNTRY" state="$STATE" locality="$LOCALITY" organization="$ORGANIZATION" unit="$UNIT" common-name="$COMMONNAME" key-size="$KEYSIZE" days-valid=3650 key-usage=crl-sign,key-cert-sign
sign ca-template ca-crl-host=127.0.0.1 name="$COMMONNAME"
:delay [6]
add name=server-template country="$COUNTRY" state="$STATE" locality="$LOCALITY" organization="$ORGANIZATION" unit="$UNIT" common-name="server@$COMMONNAME" key-size="$KEYSIZE" days-valid=3650 key-usage=digital-signature,key-encipherment,tls-server
sign server-template ca="$COMMONNAME" name="server@$COMMONNAME"
:delay [6]
add name=$USERNAME country="$COUNTRY" state="$STATE" locality="$LOCALITY" organization="$ORGANIZATION" unit="$UNIT" common-name="$USERNAME" key-size="$KEYSIZE" days-valid=3650 key-usage=tls-client
sign $USERNAME  ca="$COMMONNAME" name="$USERNAME"

Create pool, profile, interface, firewall

/ip pool
add name=VPN-POOL-devops ranges="10.$NET.1.2-10.$NET.1.254"

/ppp profile
add dns-server="10.$NET.1.1" local-address="10.$NET.1.1" name=VPN-PROFILE remote-address=VPN-POOL use-encryption=yes

/interface ovpn-server server
set auth=sha1 certificate="server@$COMMONNAME" cipher=aes128,aes192,aes256 default-profile=VPN-PROFILE enabled=yes require-client-certificate=yes port="$PORT" max-mtu=1460


/ip firewall filter
add chain=input dst-port=$PORT protocol=tcp comment="Allow OpenVPN" action=accept place-before=0

add chain=input action=accept protocol=tcp src-address=10.$NET.1.0/24 in-interface-list=dynamic log=no log-prefix="" place-before=2

/ppp secret
add name=$USERNAME password=$PASSWORD profile=VPN-PROFILE service=ovpn


/certificate
add name="$USERNAME-to-issue" copy-from="$USERNAME" common-name="$USERNAME@$COMMONNAME"
sign "$USERNAME-to-issue" ca="$COMMONNAME" name="$USERNAME@$COMMONNAME"


/certificate
export-certificate "$COMMONNAME" export-passphrase=""
export-certificate "$USERNAME@$COMMONNAME" export-passphrase="$PASSWORD"

Goto menu Files in Mikrotik admin panel and download ca.crt + client.crt + client.key

Then make file SomeName.ovpn with content:

client
# в этой строчке мы указываем адрес в интернете нашего микротика
remote <your.server.IP> <Port>
dev tun
proto tcp
tun-mtu 1460

 
nobind
persist-key
persist-tun
 
keepalive 10 120
verb 3
cipher AES-256-CBC
auth SHA1

remote-cert-tls server
# эта строка задаёт файл с логином-паролем которые мы прописывали в PPP-Secrets на микротике
auth-user-pass auth.cfg

# в этой части мы задаём настройки сетей которые находятся за микротиком,
# а 172.21.108.1 это адрес микротика который мы указывали в PPP профиле

#route-method exe 
#route-delay 2 
#route 192.168.1.0 255.255.255.0 172.21.108.1

#for internet access
redirect-gateway autolocal 

<ca>
-----BEGIN CERTIFICATE-----

.....Put your ca crt from downloaded files.....

-----END CERTIFICATE-----

</ca>
<cert>
-----BEGIN CERTIFICATE-----

.....Put your client crt from downloaded files.....

-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN RSA PRIVATE KEY-----

.....Put your client key from downloaded files.....

-----END RSA PRIVATE KEY-----

</key>

Put your key and crt and change host:port vars

and file auth.cfg

user
pasword

with this two files you can start client

Syncthing: How to add Relay Server URI

In the docs it says that it’s one of the listen addresses now
Thanks. It works to put URI in of config.xml.
URI like : relay://:22067/?id=EGIGXJZ-F7UOIQ2-KSYNJEB-XILHWP5-TKKIVLE-U……

Java8 in Debian

For starting we need install add-apt-repository

apt-get install software-properties-common python-software-properties

Then install java8

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

To automatically set up the Java 8 environment variables:

sudo apt-get install oracle-java8-set-default

or

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer

Syncthing

Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it’s transmitted over the Internet.

Нада потестити…..

Запуск VNC сервера через SSH

На клиентской стороне:

ssh 10.10.10.1 -L 5900:localhost:5900 "x11vnc -display :0 -noxdamage"

После чего в VNC клиенте подключаемся к localhost:5900

Mysql: duplicating a table

You need to do :

CREATE TABLE newtable LIKE oldtable; 
INSERT newtable SELECT * FROM oldtable;

This creates copy of existing Mysql table with indexes