backup

Submitted by lepton on Wed, 04/07/2021 - 12:44

backup system disk with boot disk  using zstd

tar cpf /mnt/data/gentoo.tar.zst --zstd  /boot/ --exclude /var/lib/docker/ --exclude /var/db/repos/ --exclude /var/cache/ --exclude /var/log/ --one-file-system /

tar xpf  gentoo.tar.zst --zstd -C /

ca sign cert

Submitted by lepton on Wed, 07/29/2020 - 14:18

 

openssl genrsa -out cakey.pem 2048

openssl req -new -x509 -days 3650 -key cakey.pem -out cacert.pem

openssl genrsa -out c1.key 2048

openssl req -new -key c1.key -out c1.csr

#commonName = optional
openssl ca -in c1.csr -out c1.crt -days=3650 -create_serial

openssl pkcs12 -export -clcerts -in c1.pem -out c1.p12

time machine backup to samba

Submitted by lepton on Tue, 07/14/2020 - 11:53

1. make a sparseimage or sparsebundle file using Disk Utility
 //hdiutil create -size 1000g -type SPARSEBUNDLE -nospotlight -volname "Name" -fs "Journaled HFS+" -verbose file.sparsebundle

2. copy the file to a samba dir

3. mount the disk image file

4. sudo tmutil setdestination /Volumes/DiskImageMountPoint

5. now the disk is available in time machine

gentoo simple install

Submitted by lepton on Mon, 06/22/2020 - 17:07

download stage3

tar xpvf stage3-*.tar.bz2 --xattrs-include='*.*' --numeric-owner
###copy whole system to another disk
###
tar cpf - --exclude=="/mnt/" --one-file-system  / | tar xpf - --xattrs-include='*.*' --numeric-owner

GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo/"

cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

mount --types proc /proc /mnt/gentoo/proc

mount --rbind /sys /mnt/gentoo/sys

mount --make-rslave /mnt/gentoo/sys

WireGuard connect

Submitted by lepton on Tue, 05/26/2020 - 15:39

wg genkey | tee server.key | wg pubkey > server.pub


PEER_A_PUB=key_string
PEER_Endpoint="endpoint ip:9902" #maybe empty
PEER_A_IP=10.1.0.2
MY_IP=10.1.0.1/24
MY_PORT=9901
ip link del wg0 ip link add dev wg0 type wireguard
ip addr add $MY_IP dev wg0
wg set wg0 listen-port $MY_PORT private-key /etc/wireguard/server.key
wg set wg0 peer $PEER_A_PUB $PEER_Endpoint allowed-ips $PEER_A_IP/32
ip link set wg0 up

in dir /etc/wireguard