Posts Tagged Inne

Dec 14 2021

Resize mounted partition in Linux

You can resize only last partition at runtime

 

fdisk / gdisk

  • Run sudo fdisk /dev/sda
  • press p to list the partitions. Make note of the start cylinder of /dev/sda1 ex. 2048
  • press d to delete existing partition
  • press n to create new partition it is critical that the new partition starts at the same block as the old
  • do not remove the signature
  • press a and set boot flag

Reboot or use partprobe / kpartx to see new partition’s size

Resize filesystem

sudo resize2fs /dev/sda1

 

Oct 27 2021

OpenVPN + Google Authenticator MFA

apt install libqrencode3 libpam-google-authenticator

addgroup gauth
useradd -g gauth gauth
mkdir /etc/openvpn/google-authenticator
chown gauth:gauth /etc/openvpn/google-authenticator
chmod 0700 /etc/openvpn/google-authenticator

add line in /etc/openvpn/server.conf

plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so openvpn

create /etc/pam.d/openvpn

with content:

auth required /usr/lib/x86_64-linux-gnu/security/pam_google_authenticator.so secret=/etc/openvpn/google-authenticator/${USER} user=gauth forward_pass

-t : Set up time-based (TOTP) verification

-d : Disallow reuse of previously used TOTP tokens

–r3 : Limit logins to N per every M seconds

-R30 :

-f : Write file without first confirming with user

-l : Override the default label in “otpauth://” URL

-i: Override the default issuer in “otpauth://” URL

-s : Specify a non-standard file location

replace <username> with certificate_name

google-authenticator -t -d -r3 -R30 -f -l “<username>” -i “Company VPN” -s /etc/openvpn/google-authenticator/username

chown gauth:gauth /etc/openvpn/google-authenticator/username

Sep 7 2021

RRDTools

./configure –enable-perl-site-install

Sep 5 2021

Cpan – Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xed00080, needed 0xeb00080)

Move the folder /usr/local/lib64/perl5 to /usr/local/lib64/BADperl5

Move the folder /usr/local/share/perl5 to /usr/local/share/BADperl5

 

Jun 6 2021

OpenVPN – don’t change route

add

pull-filter ignore redirect-gateway

to client.ovpn file

Aug 8 2020

Mount partition and chroot in rescue mode

Run linux from Linux Live (debian.ubuntu, slackware tec.)

Determine what is your main partition

fdisk -l

Example output:

Disk /dev/md2: 9.77 GiB, 10495328256 bytes, 20498688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md3: 221.88 GiB, 238236860416 bytes, 465306368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md1: 9.77 GiB, 10495328256 bytes, 20498688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md0: 3.91 GiB, 4203020288 bytes, 8209024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

create mount point and mount root partition

mkdir /mnt/md0

mount /dev/md0 /mnt/md0

Mount the necessary file system directories by running the following commands:

mount -t proc /proc /mnt/md0/proc

mount –rbind /sys /mnt/md0/sys

mount –rbind /dev /mnt/md0/dev

Mount /usr and /var partition if necessary

mount /dev/md1 /mnt/md0/usr

mount /dev/md2 /mnt/md0/var

Chroot to md0

chroot /mnt/md0

Jan 15 2014

clamdscan

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

Oct 22 2013

CellPipe 7130 – hasło admina

Ściągnięte z wątku: CellPipe 7130 – hasło admina
Wystarczy wyeksportować ustawienia (http://10.0.0.1/backupsettings.html) i przeczytać :).
Hasło w pliku jest zakodowane w base64.
Dekodowanie hasła w linuksie
echo “password” | base64 -d

Jun 27 2013

RX Signal Strength dla MikroTik

/interface wireless registration-table print oid

Pozycja strength=.1.3.6.1.4.1.14988.1.1.1.2.1.3.0.12.66.102.90.117.18 daje nam poszukiwany OID – czyli dostęp do wartości siły sygnału odbieranego na danym (numer 0) interfejsie radiowym. Zapamiętujemy ten ciąg znaków.

Polecenie:
snmpget -v 1 -Cf -c password 192.168.100.110 .1.3.6.1.4.1.14988.1.1.1.2.1.3.0.12.66.102.90.117.18

zwróci nam siłę sygnału.

Sep 28 2012

Wykrywacz kłamstw PL