Compare commits

..

4 Commits

Author SHA1 Message Date
saundersp
41f4adbd47 README.md : Fixed ssh authorized keys 2024-08-24 19:22:23 +02:00
saundersp
06b1daf861 README.md : removed pythons commands 2024-08-24 19:22:07 +02:00
saundersp
d7f00c92da README.md : added Openssl self-signed certificate 2024-07-27 16:53:26 +02:00
saundersp
40e4edc574 README.md : changed codeblock type from bash to sh 2024-07-27 16:52:54 +02:00

View File

@ -14,18 +14,9 @@ Host \$HOST_NAME
Now you can just connect using ssh \$HOST_NAME
## Pythons commands
```bash
# Update every packages
pip freeze | cut -d = -f 1 | xargs -n1 pip install -U
# Uninstall every packages
pip freeze | cut -d = -f 1 | xargs -n1 pip uninstall -y
```
## Docker commands
```bash
```sh
# Remove every images
docker images --format="{{.ID}}" | xargs docker rmi
# Remove every containers
@ -50,7 +41,7 @@ for(lib in .libPaths()) lapply(my_packages$Package, remove.packages, lib = lib)
## Setup Git SSH key
```bash
```sh
# Generate a SSH key pair
ssh-keygen -t rsa -b 4096 -o -a 100 -C "email@example.com" -f ~/.ssh/$KEY_NAME
ssh-keygen -t ed25519 -a 100 -C "email@example.com" -f ~/.ssh/$KEY_NAME
@ -63,7 +54,7 @@ ssh -T git@github.com
git remote set-url origin git@github.com:username/your-repository.git
# Add key to SSH config file (~/.ssh/config)
echo -e "\n\nHost github.com\n\tIdentityFile ~/.ssh/$KEY_NAME" >> ~/.ssh/config
cat KEY_FILE | ssh REMOTE "cat >> ~/authorized_keys"
cat KEY_FILE | ssh REMOTE "cat >> ~/.ssh/authorized_keys"
```
## Font ligature test
@ -79,7 +70,7 @@ cat KEY_FILE | ssh REMOTE "cat >> ~/authorized_keys"
## QEMU cheat sheet
```bash
```sh
# Creating the disk image
qemu-img create -f qcow2 DISK_NAME.img 15G
@ -95,7 +86,7 @@ qemu-system-x86_64 $DISK_NAME.img \
### IP Host (eth1 has internet, eth0 is remote)
```bash
```sh
# Enable kernel port forwarding
sysctl -w net.ipv4.ip_forward=1
# Enable at reboot
@ -115,7 +106,7 @@ iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
### IP Remote
```bash
```sh
connmanctl
config <eth0> --ipv4 manual 192.168.137.2 255.255.255.0 192.168.137.1 --nameservers <DNS-SERVER>
```
@ -126,7 +117,7 @@ config <eth0> --ipv4 manual 192.168.137.2 255.255.255.0 192.168.137.1 --nameserv
In Windows you must have _Adobe Digital Editions_ and _Calibre_ using Chocolatey
```bash
```sh
choco install -y adobedigitaleditions calibre
```
@ -145,7 +136,7 @@ choco install -y adobedigitaleditions calibre
## Loop devices
```bash
```sh
# Create loop device to $BLOCK_PATH of 4G
dd if=/dev/zero of=$BLOCK_PATH bs=1M count=4096
# Create loop filesystem
@ -162,7 +153,7 @@ rm $BLOCK_PATH
## Install img.xz
```bash
```sh
xzcat $IMG_FILE | dd of=/dev/$DEVICE bs=64k oflag=dsync status=progress
```
@ -179,7 +170,7 @@ root hard nofile 64000
## Verify a PGP Signature
```bash
```sh
mkdir /home/$USER/.XDG/data/gnupg
chmod 700 /home/$USER/.XDG/data/gnupg
gpg --import $PUBLIC_KEY
@ -187,3 +178,14 @@ chmod 600 /home/$USER/.XDG/data/gnupg/$PUBLIC_KEY
gpg --verify $SIGNATURE.sig $FILE
```
### Self-signed OpenSSL
#### interactive
```sh
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365
```
#### non-interactive and 10 years expiration
```sh
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj '/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname'
```