06 November 2018

systemctl

Kek mano systemctl baco konpig pail?

list all service

$ systemctl -a | grep "myservice"



$ systemctl show "mycervice"  | grep -i path

29 June 2018

mount LVM2 dalam vmdk


verified vmdk has lvm partition (8E)
# vmware-mount -p .vmdk
Nr      Start       Size Type Id Sytem
-- ---------- ---------- ---- -- ------------------------
 1         63     401562 BIOS 83 Linux
 2     401625   10072755 BIOS 8E Unknown


mount vmdk
# vmware-mount -f .vmdk 
# ls 
flat


Get offset of lv partition
# fdisk -lu /mnt/ROOT/flat

You can do this from the extra functions menu.

Disk /mnt/ROOT/flat: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0006a266

         Device Boot      Start         End      Blocks   Id  System
/mnt/ROOT/flat1   *          63      401624      200781   83  Linux
/mnt/ROOT/flat2          401625    10474379     5036377+  8e  Linux LVM


Calculate the offset
offset = 401625 * 512      #   >> 205632000   [1 sectors is 512 bytes]

mount to loop device
# losetup -o 205632000 /dev/loop0 /flat


display info
# pvdisplay /dev/loop0
  --- Physical volume ---
  PV Name               /dev/loop0
  VG Name               VolGroup00
  PV Size               4,80 GB / not usable 22,34 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              153
  Free PE               1
  Allocated PE          152
  PV UUID               MUKx5v-ukpq-fJis-GjpB-Z7dE-nIsI-Xr4bYd


# lvscan
  ACTIVE            '/dev/vg1/isos' [111,79 GB] inherit
  ACTIVE            '/dev/vg0/root' [10,00 GB] inherit
  ACTIVE            '/dev/vg0/swap' [8,00 GB] inherit
  ACTIVE            '/dev/vg0/home' [50,00 GB] inherit
  ACTIVE            '/dev/vg0/data' [164,41 GB] inherit
  inactive          '/dev/VolGroup00/LogVol00' [4,00 GB] inherit
  inactive          '/dev/VolGroup00/LogVol01' [768,00 MB] inherit


incase not active, need to activate the lv
# lvchange -ay /dev/VolGroup00/LogVol00

then, can mount
# mount /dev/VolGroup00/LogVol00


to deactivate lv
# lvchange -an /dev/VolGroup00/LogVol00

to release loop device
# losetup -d /dev/loop0


unmount vmware disk
# vmware-mount -d 



ref: https://xliska.wordpress.com/2010/09/29/access-lvm2-partition-on-vmware-virtual-disk/

20 June 2018

dnssec


 1- dnsclient send recursize query  request domain www.DLB.net

2- dns caching server send query ke root



3- dns caching tanya net zone



4- dns caching server tanya DLB zone



5- dns caching server hantar jawapan ke client.


ref:
https://www.youtube.com/watch?v=_8M_vuFcdZU

https://www.first.org/resources/papers/auckland2016/aucklandtc-20160221-edward_lewis-dns_root_zone_dnssec_operations.pdf

Tandatangan Digital



Digital Signing guna asymetric keys(private/public key)

Penghantar:
1- hantar dokumen asal dan digest yg telah diencryptkan.


Penerima:
2- hashkan dokumen utk hasilkan digest.
3- decryptkan(guna public key penghantar)  'encrypted digest'.
4- bandingkan 2 dan 3, jika sama, sah.


Teknologi Priviate/Public key:
- Jika encrypt guna PrivateKey, hanya PublicKey yg boleh decrypt.
- Jika encrypt guna PublicKey, hanya PrivateKey yg boleh decrypt.
(Hebatankan Matematik..)





ref: https://www.youtube.com/watch?v=_8M_vuFcdZU (3:31)

13 June 2018

tukar id teamviewer

1- tukar macc address network kad
2 tukar /etc/machine-id


ref: https://theitbros.com/reset-teamviewer-id/



additional
edit:
 Modify /etc/systemd/system/teamviewerd.service:
add:
  ExecStartPre= /sbin/ifconfig eth0 hw ether aa:bb:cc:dd:ee:ff


ref: https://askubuntu.com/questions/423314/how-to-change-teamviewer-id-after-cloning

07 June 2018

virtualenv guna python3

1- link python ke python3

update-alternatives --remove python /usr/bin/python2
update-alternatives --install /usr/bin/python python /usr/bin/python3 1

pastikan python --version paparkan python3


2-  link pip ke pip3

  -install
    apt-get install python3-pip
  which pip3

  - link kan
  ln -s /usr/bin/pip3 /usr/bin/pip
  pip -V


3- install virtualenv
  pip install virtualenv

  - setup virtual env for flask(eg)
    virtualenv --python=python3 flask_env

4- enter into flask_env
  source/flask_env/bin/activate

  - prompt will be change
   # (flask_env) mycert@my_dir:

5- nak keluar virt env
   deactivate




ref:
1- https://www.howtoforge.com/tutorial/how-to-install-django-1-10-on-ubuntu-16-04/
2- https://www.howtoforge.com/tutorial/how-to-install-django-on-ubuntu/