Заметки Александра Чернышева

Keep in mind!

OpenVPN 2.5 MD5 support

systemctl edit openvpn-client@
[Service]
Environment="OPENSSL_ENABLE_MD5_VERIFY=1 NSS_HASH_ALG_SUPPORT=+MD5"
 53   2022   centos

Настройка VNC сервера в Fedora

Возникла необходимость в организации удаленного подключения к рабочей станции по проьлколу VNC.
В процессе изучения вопроса выяснилось, что VNC сервер Vino, который установлен по дефолту, слушает порт 5900, который так же слушает демон Qemu и одновременная работа двух служб на одном хосте невозможна.
Решением данной проблемы станет изменение порта по умолчанию сервера Vino через gsettings.

gsettings set org.gnome.Vino use-alternative-port true
gsettings set org.gnome.Vino alternative-port 5901
gsettings set org.gnome.Vino network-interface lo
gsettings set org.gnome.Vino require-encryption false
gsettings set org.gnome.Vino lock-screen-on-disconnect true

В Fedora 35 VNC активируется так:

gsettings set org.gnome.desktop.remote-desktop.vnc encryption "['none']"
sudo firewall-cmd --permanent --add-service=vnc-server
sudo firewall-cmd --reload
sudo reboot now

Описание настроек VNC сервера Vino со значениями по умолчанию

prompt-enabled — Prompt the user before completing a connection

If true, remote users accessing the desktop are not allowed
access until the user on the host machine approves the
connection. Recommended especially when access is not password
protected.
default: true

view-only — Only allow remote users to view the desktop

If true, remote users accessing the desktop are only allowed to
view the desktop. Remote users will not be able to use the mouse
or keyboard.
default: false

network-interface — Network interface for listening

If not set, the server will listen on all network interfaces.
Set this if you want to accept connections only from some specific
network interface. For example, eth0, wifi0, lo and so on.
default: ’’

use-alternative-port — Listen on an alternative port

If true, the server will listen on another port, instead of the default
(5900). The port must be specified in the “alternative-port” key.
default: false

alternative-port — Alternative port number

The port which the server will listen to if the “use-alternative-port”
key is set to true. Valid values are in the range of 5000 to 50000.
default: 5900

require-encryption — Require encryption

If true, remote users accessing the desktop are required to
support encryption. It is highly recommended that you use a
client which supports encryption unless the intervening network
is trusted.
default: true

authentication-methods — Allowed authentication methods

Lists the authentication methods with which remote users may
access the desktop.
There are two possible authentication methods; “vnc” causes the
remote user to be prompted for a password (the password is
specified by the vnc-password key) before connecting and “none”
which allows any remote user to connect.
default: [’none’]

vnc-password — Password required for “vnc” authentication

The password which the remote user will be prompted for if the
“vnc” authentication method is used. The password specified by
the key is base64 encoded.
The special value of “keyring” (which is not valid base64) means
that the password is stored in the GNOME keyring.
default: ’keyring’

mailto — E-mail address to which the remote desktop URL should be sent

This key specifies the e-mail address to which the remote
desktop URL should be sent if the user clicks on the URL in the
Desktop Sharing preferences dialog.
default: ’’

lock-screen-on-disconnect — Lock the screen when last user disconnect

If true, the screen will be locked after the last remote client
disconnects.
default: false

icon-visibility — When the status icon should be shown

This key controls the behavior of the status icon. There are
three options: “always” — the icon will always be present; “client” —
the icon will only be present when someone is connected (this is the
default behavior); “never” — the icon will not be present.
default: ’client’

disable-background — Whether to disable the desktop background when a user is connected

When true, disable the desktop background and replace it with a single
block of color when a user successfully connects.
default: false

use-upnp — Whether a UPnP router should be used to forward and open ports

If true, request that a UPnP-capable router should forward and open the
port used by Vino.
default: false

disable-xdamage — Whether we should disable the XDamage extension of X.org

If true, do not use the XDamage extension of X.org. This extension does
not work properly on some video drivers when using 3D effects.
Disabling it will make Vino work in these environments, with slower
rendering as a side effect.
default: false

notify-on-connect — Notify on connect

If true, show a notification when a user connects to the system.
default: true

Дополнительные материалы

https://wiki.archlinux.org/index.php/Vino

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/using_the_desktop_environment_in_rhel_8/accessing-the-desktop-remotely_using-the-desktop-environment-in-rhel-8

Обновление таймзоны в Java

В настоящее время инструмент TZUpdater совместим только с форматом данных «арьергарда», который больше не имеет встроенных двоичных файлов. IANA никогда не публиковала их, и при попытке обновлении таймзоны появится следующая ошибка.

Failed: java.lang.Exception: Failed while parsing file '/tmp/ziupdater21715634709704541231626652501292559/srcdir/asia' on line 1865 'Rule	Japan	1948	1951	-	Sep	Sat>=8	25:00	0	S'

Для создания двоичный файлов необходимо проделать следующую процедуру

yum install lzip
mkdir ./tmp ; cd ./tmp
wget https://cdn.azul.com/tools/ziupdater1.0.2.2-jse8+7-any_jvm.tar.gz
tar -xzvf ziupdater1.0.2.2-jse8+7-any_jvm.tar.gz
wget https://data.iana.org/time-zones/releases/tzdb-2019b.tar.lz
lzip -d tzdb-2019b.tar.lz && tar xvf tzdb-2019b.tar && cd tzdb-2019b
make rearguard_tarballs
/usr/java/java8/bin/java -jar ../ziupdater-1.0.2.2.jar -v -l file:./tzdata2019b-rearguard.tar.gz

http://qaru.site/questions/18068758/update-to-tzdata2019b-is-failing

Добавляем цветной вывод в printf

printf "\033[0;31m"  //Set the text to the color red
printf "Hello\n"     //Display Hello in red
printf "\033[0m"    //Resets the text to default color

Escape is: \033
Color code is: [0;31m

CODE COLOR
[0;31m Red
[1;31m Bold Red
[0;32m Green
[1;32m Bold Green
[0;33m Yellow
[01;33m Bold Yellow
[0;34m Blue
[1;34m Bold Blue
[0;35m Magenta
[1;35m Bold Magenta
[0;36m Cyan
[1;36m Bold Cyan
[0m Reset

MTProto Proxy на CentOS7

Решил попробовать использовать вместо 3proxy вышедшей не так давно MTProto Proxy, собрал пакет для 7 CentOS. Из зависимостей требует zlib, openssl и curl. В процессе установки автоматически генерируется секретный ключ авторизации, загружаются список серверов и ключ для доступа.
Установка сводится к следующим действиям

yum localinstall mtproto-proxy-20824f5-1.el7.x86_64.rpm
systemctl enable mtproto-proxy
systemctl start mtproto-proxy
firewall-cmd --permanent --zone=external --add-service=mtproto-proxy

По умолчанию сервер запускается на порту 8443. Если это необходимо изменить, то основные настройки вынесены в /etc/sysconfig/mtproto-proxy. Так же придется отредактировать и /etc/firewalld/services/mtproto-proxy.xml.

Теперь для подключения, в приложении, необходимо перейти по ссылке.

https://t.me/proxy?server=<SERVER_IP>&port=<PORT>&secret=<SECRET_KEY>

где:

SERVER_IP - ip адрес сервера mtproto-proxy
PORT - порт на котором запущен mtproto-proxy
SECRET_KEY - секретный ключ, который был создан в процессе установки

Для страждущих паранойей src.rpm пакет, для самостоятельной сборки, можно скачать здесь.

Ранее Ctrl + ↓