2021/02/17

wsl exec run ubuntu

wsl --list
wsl -d ubuntu -u root -e bash /tmp/test
wsl -d ubuntu -u root -e cat /etc/sudoers

2021/01/24

kubernetes service port & targetPort differnt

apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376

2020/10/26

SSH Encryption & Decryption


  #### Credential ####
# cat << EOF > src.txt
This is sercret message.
That will be encrypted.
And decrypted.
EOF
# openssl enc -aes-256-cbc -in src.txt -out file.txt -pass pass:mysecret
# openssl enc -aes-256-cbc -d -in file.txt -out res.txt -pass pass:mysecret
# cat src.txt
# diff res.txt src.txt


# openssl enc -aes-256-cbc -in src.txt -out file.txt -pass file:cred.txt
# openssl enc -aes-256-cbc -d -in file.txt -out res.txt -pass file:cred.txt

# openssl enc -aes-256-cbc -salt -a -in src.txt -out file.txt -k password
# openssl enc -aes-256-cbc -salt -a -d -in file.txt -out res.txt -k password
# openssl enc -aes-256-cbc -a -d -in file.txt -out res.txt -k password

#### Keypair ####
# ssh-keygen -f app -t rsa -b 2048
# cat << EOF > test.txt
This is sercret message.
That will be encrypted.
And decrypted.
EOF
# ssh-keygen -f app.pub -e -m pkcs8 > app.pkcs8
# cat test.txt |openssl rsautl -encrypt -pubin -inkey app.pkcs8 >secret.txt
# cat secret.txt | openssl rsautl -decrypt -inkey app

#### trip ####
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-4} | head -n 1
echo odYJaGVsbG8K |cut -b4- |base64 -d

2020/05/07

stop an automatic redirect from “http://” to “https://” in Chrome

  1. Go to chrome://net-internals/#hsts. Enter 3rdrevolution.com under Delete domain security policies and press the Delete button.
  2. Now go to chrome://settings/clearBrowserData, tick the box Cached images and files and press click the button Clear data.
from: https://superuser.com/questions/565409/how-to-stop-an-automatic-redirect-from-http-to-https-in-chrome