Thursday, January 21, 2021

ssh - ssh config with multiple keys

 $ cat ~/.ssh/config

Host: github.com

      User git

      IdentityFile ~/.ssh.id_rsa


Host github.com-2ndhost

      HostName github.com

      User git

      IdentifyFiller ~/.ssh/my-pub.key

GPG - Generate gpg key to sign your commit on git/github

 How to sign your commit on github repo


1. Check if gpg is installed..

If not download from gnupg.org

# wget https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.27.tar.bz2


2. Verify if ppg is instaled

root@master ~]# gpg

gpg: directory '/root/.gnupg' created

gpg: keybox '/root/.gnupg/pubring.kbx' created

gpg: WARNING: no command supplied.  Trying to guess what you mean ...

gpg: Go ahead and type your message ...

^C

gpg: signal Interrupt caught ... exiting


3. Generate a certificate

[root@master ~]# gpg --full-generate-key

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.


Please select what kind of key you want:

   (1) RSA and RSA (default)

   (2) DSA and Elgamal

   (3) DSA (sign only)

   (4) RSA (sign only)

Your selection?

RSA keys may be between 1024 and 4096 bits long.

What keysize do you want? (2048) 4096

Requested keysize is 4096 bits

Please specify how long the key should be valid.

         0 = key does not expire

      <n>  = key expires in n days

      <n>w = key expires in n weeks

      <n>m = key expires in n months

      <n>y = key expires in n years

Key is valid for? (0)

Key does not expire at all

Is this correct? (y/N) y


GnuPG needs to construct a user ID to identify your key.


Real name: sam

Name must be at least 5 characters long

Real name: sam@gmail.com

Email address: sam@gmail.com

Comment: no coment

You selected this USER-ID:

    "sam@gmail.com (no coment) <sam@gmail.com>"


Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o

We need to generate a lot of random bytes. It is a good idea to perform

some other action (type on the keyboard, move the mouse, utilize the

disks) during the prime generation; this gives the random number

generator a better chance to gain enough entropy.

We need to generate a lot of random bytes. It is a good idea to perform

some other action (type on the keyboard, move the mouse, utilize the

disks) during the prime generation; this gives the random number

generator a better chance to gain enough entropy.

gpg: /root/.gnupg/trustdb.gpg: trustdb created

gpg: key DC882D52337328DE marked as ultimately trusted

gpg: directory '/root/.gnupg/openpgp-revocs.d' created

gpg: revocation certificate stored as '/root/.gnupg/openpgp-revocs.d/2FFE7EDE77C31A95FFE6DBAFDC882D52337328DE.rev'

public and secret key created and signed.


pub   rsa4096 2021-01-20 [SC]

      2FFE7EDE77C31A95FFE6DBAFDC882D52337328DE

uid                      sam@gmail.com (no coment) <sam@gmail.com>

sub   rsa4096 2021-01-20 [E]


Certificate is successfully created. now, using this certificate, you can create public/private key


4. Now, list the secret keys, since we have only one, so really does not matter.


[root@master ~]# gpg --list-secret-keys 2FFE7EDE77C31A95FFE6DBAFDC882D52337328DE

gpg: checking the trustdb

gpg: marginals needed: 3  completes needed: 1  trust model: pgp

gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u

sec   rsa4096 2021-01-20 [SC]

      2FFE7EDE77C31A95FFE6DBAFDC882D52337328DE

uid           [ultimate] sam@gmail.com (no coment) <sam@gmail.com>

ssb   rsa4096 2021-01-20 [E]


5. Now export the public key

[root@master ~]# wget https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.27.tar.bz2^C

[root@master ~]# gpg --armor --export 2FFE7EDE77C31A95FFE6DBAFDC882D52337328DE

-----BEGIN PGP PUBLIC KEY BLOCK-----


mQINBGAIPXsBEADAF4jVU4VU9yZ1+nR0Zwf+h4UccvcFVCtDPq/NR+ZWS0RorJNO

/bPZaz+WbAzXajs3UY2K/o4J5oJOAh5x5EtKunrztylD53Ttns8LXeDzf0Y1QULj

ODpfEbfYEzpsjtO5pvLhDTUFPpmN4gJz0vOnxrwMUPxps27G4q5lGAWUUy3JyBMp

MSno1FCHbeptIUT0QByixbwaRNBDV6SN+emG0U3qUasNcIy9w29iouT0napbtwUJ

0ZnNa2N0Zol50Zt5EOqeUuQD5kJpaKOLbNUaocJrQSWFrBrPnNaMcoEw/n0mXJLG

28f4ih3zYyFr2CsDOVJ9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eQv5GIN7HZRKcyTjyPMAEhSqs

0alCkRF8GGdKP0YKfiPoB3HA8dwTfP5CpZaOspbO1PExlmnR269wulg23Gvb1to/

24FEf8BU3iG13xTn3mot6IvoxMXGU5XxP7fF1HUC/P8froaYUlUpl5LS6TAZJs2f

WXD3GMjwFmri0ZnchbS8zEBQkqq6cLqYXbn15Xz0CxC9dLEqP0cOnhm8o99FdghS

KWM5RQ0GvyBNg6jOYeTSvT7LC0ESIw54BcuiTeft0UekVs2XGTseRuarojRz57G7

zatVl6Q+E9y/YR9hdG3vvQmsZI1zAqOAsWHqsU0vfFkxM711MJXNE/pG+ghVWjZR

Ctbi4/DhlkVrJ/b5dU+phERCVyKgc1tZlhfvKgHcIypw4OE03E3g4xI01yzEM8vn

5Y5djDJmFnnp8CN+kSb9i1YkYcT675ckFXEoIy+PmjMzKALSfypsRY53HOI6Riif

Bi9iNtZZ5BxmLq5pkySOTVVyglE34TkjnW2JK5x3swUHXokITEblOIYb7nUm/21y

RfjI+P8=

=Yl6x

-----END PGP PUBLIC KEY BLOCK-----

[root@master ~]#


We just exported our public key. Copy all the text as it is displayed. Do not add any space or delete any space or key.

ALl the text from --begin to end line.


- Goto github.com on your account, 

- Go to setting, and go to ssh and gpg keys

- Go to GPG key section and add your public key.

- After you add, you will see shorter keyid and subkeys.







Monday, January 18, 2021

Git - practice

 


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/c/Users/Sam/.ssh/id_rsa): c


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ bash


$ ssh-keygen.exe -t rsa -b 4096 -C "Acct for github"


$ pwd

/c/Users/Sam/.ssh


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ ls

id_rsa  id_rsa.pub  known_hosts


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCh8i43rkLfCnmjNS3dabppnnzEI0j6zYG/L4ovMK2vv+t3W4bPm6D90WcGfJKIKnJIuKi3unv1wXL0mzJ3IIIVV32TyY4UfkkL2dP+7W3ZrOttaUjdBS6J7xdcoVSVVPBmRXtt/1/pgNeIIV4ZGE8etlmTxueYvJDs5edGLSFX5W8l6NR81Kun/a/v4u6yTO8qdkH04LDANiNxYkZQpyVuDQAz1BqS0SvCmtghfd6le+Ux5gL4X+lGSTx6J/Jz4aaR5eoOjkI4nL5vMMboWXP1cBYc9wXm6fkQQmWg13sZIAJe3GND2QvjvQ+d+/m6HhTgJ5jQzqksXzZPWaAeGPphZ/b1oKlzChW1JWc4vPkRGr95fTy/D7DyIgdm+TSW4FOb7ljs5K82qVfWs048VtO2k4N+IZ8ZKBv0g8n5otl1rGQDN02oJWVXDKOo/IRwiJ6ogbFk1TM4Chzcmox9L+1oJP4h1lty9MHoHveUikglQC5sAONT0Pai2qrQo7mWvEsOdTwy2tmTfKGpuTtWwOtcLw7F8YyEbWA56bOE7DsHz83ODqyg0GalaZ/mgFvVNdjUV2oUfCKbu516RzDO06ZMjnE4sQI+5waN5ke4eCBEXxi4ngU51OgP8z0x4BDw+VPO5oj54foDiO2ebh7Un3crw9G+yqxpr/oAvQZ/B6CoQQ== Acct for github


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$

Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ git config --list

http.sslbackend=openssl

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

credential.helper=manager

diff.astextplain.textconv=astextplain

filter.lfs.clean=git-lfs clean -- %f

filter.lfs.smudge=git-lfs smudge -- %f

filter.lfs.process=git-lfs filter-process

filter.lfs.required=true

core.autocrlf=true

core.fscache=true

core.symlinks=false

user.name=Kay

user.email=samk@gmail.com

diff.tool=diffmerge

difftool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"

merge.tool=diffmerge

mergetool.diffmerge.trustexitcode=true

mergetool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

core.longpaths=true

:...skipping...

http.sslbackend=openssl

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

credential.helper=manager

diff.astextplain.textconv=astextplain

filter.lfs.clean=git-lfs clean -- %f

filter.lfs.smudge=git-lfs smudge -- %f

filter.lfs.process=git-lfs filter-process

filter.lfs.required=true

core.autocrlf=true

core.fscache=true

core.symlinks=false

user.name=Kay

user.email=samk@gmail.com

diff.tool=diffmerge

difftool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"

merge.tool=diffmerge

mergetool.diffmerge.trustexitcode=true

mergetool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

core.longpaths=true

~

~

~

~

~

~

~

~

~

~

~

~

~


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ git config --list

http.sslbackend=openssl

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

credential.helper=manager

diff.astextplain.textconv=astextplain

filter.lfs.clean=git-lfs clean -- %f

filter.lfs.smudge=git-lfs smudge -- %f

filter.lfs.process=git-lfs filter-process

filter.lfs.required=true

core.autocrlf=true

core.fscache=true

core.symlinks=false

user.name=Kay

user.email=samk@gmail.com

diff.tool=diffmerge

difftool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"

merge.tool=diffmerge

mergetool.diffmerge.trustexitcode=true

mergetool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

core.longpaths=true


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ git config --list

http.sslbackend=openssl

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

credential.helper=manager

diff.astextplain.textconv=astextplain

filter.lfs.clean=git-lfs clean -- %f

filter.lfs.smudge=git-lfs smudge -- %f

filter.lfs.process=git-lfs filter-process

filter.lfs.required=true

core.autocrlf=true

core.fscache=true

core.symlinks=false

user.name=Kay

user.email=samk@gmail.com

diff.tool=diffmerge

difftool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"

merge.tool=diffmerge

mergetool.diffmerge.trustexitcode=true

mergetool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

core.longpaths=true


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ git config --list

http.sslbackend=openssl

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

credential.helper=manager

diff.astextplain.textconv=astextplain

filter.lfs.clean=git-lfs clean -- %f

filter.lfs.smudge=git-lfs smudge -- %f

filter.lfs.process=git-lfs filter-process

filter.lfs.required=true

core.autocrlf=true

core.fscache=true

core.symlinks=false

user.name=Kay

user.email=samk@gmail.com

diff.tool=diffmerge

difftool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"

merge.tool=diffmerge

mergetool.diffmerge.trustexitcode=true

mergetool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

core.longpaths=true


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ ssh-keygen.exe -t rsa -b 4096 -C "Personal Account Key" -f ~/.ssh/personal-key

Generating public/private rsa key pair.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /c/Users/Sam/.ssh/personal-key

Your public key has been saved in /c/Users/Sam/.ssh/personal-key.pub

The key fingerprint is:

SHA256:ZuJ0VHJ6m4fyMytT0UPGF7Xepg0tHsQvQ/dLCtuOcok Personal Account Key

The key's randomart image is:

+---[RSA 4096]----+

|        . o.  .o.|

|         =  +.. .|

|        o .+ .+..|

|       . ..+oo.+o|

|      o S +o..*o*|

|     o = o..+.oX.|

|      .  .=..oo..|

|        oE *o    |

|         o+. .   |

+----[SHA256]-----+


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ ls -ltr

total 20

-rw-r--r-- 1 Sam 197121 2156 Jun  8  2020 known_hosts

-rw-r--r-- 1 Sam 197121 3381 Jan 18 22:58 id_rsa

-rw-r--r-- 1 Sam 197121  741 Jan 18 22:58 id_rsa.pub

-rw-r--r-- 1 Sam 197121 3389 Jan 18 23:12 personal-key

-rw-r--r-- 1 Sam 197121  746 Jan 18 23:12 personal-key.pub


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ touch -m 077 ~/.ssh/config


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ pwd

/c/Users/Sam/.ssh


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ ls -ltr

total 20

-rw-r--r-- 1 Sam 197121 2156 Jun  8  2020 known_hosts

-rw-r--r-- 1 Sam 197121 3381 Jan 18 22:58 id_rsa

-rw-r--r-- 1 Sam 197121  741 Jan 18 22:58 id_rsa.pub

-rw-r--r-- 1 Sam 197121 3389 Jan 18 23:12 personal-key

-rw-r--r-- 1 Sam 197121  746 Jan 18 23:12 personal-key.pub

-rw-r--r-- 1 Sam 197121    0 Jan 18 23:12 077

-rw-r--r-- 1 Sam 197121    0 Jan 18 23:12 config


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ chmod 077 config


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ ls -l config

-rw-r--r-- 1 Sam 197121 0 Jan 18 23:12 config


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ pwd

/c/Users/Sam/.ssh


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ pwd

/c/Users/Sam/.ssh


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.ssh

$ cd


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ pwd

/c/Users/Sam


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ ls

'3D Objects'

 AppData

'Application Data'

 best

'Cisco Packet Tracer 7.1.1'

 Contacts

 Cookies

 copy

 cracked.txt

 Desktop

 Doc-Root

 Documents

 Downloads

 Dropbox

 eclipse-workspace

 Favorites

 git

 GNS3

 gomata

 IdeaProjects

 IntelGraphicsProfiles

 kubectl.exe

 Links

'Local Settings'

 MicrosoftEdgeBackups

 Music

'My Documents'

 myproject

 NetHood

 NTUSER.DAT

 ntuser.dat.LOG1

 ntuser.dat.LOG2

 NTUSER.DAT{ac195edd-5478-11eb-9c89-8a42866465a2}.TM.blf

 NTUSER.DAT{ac195edd-5478-11eb-9c89-8a42866465a2}.TMContainer00000000000000000001.regtrans-ms

 NTUSER.DAT{ac195edd-5478-11eb-9c89-8a42866465a2}.TMContainer00000000000000000002.regtrans-ms

 ntuser.ini

 OneDrive

 Pictures

 PrintHood

 projects

 PycharmProjects

 Recent

 Roaming

 sam

'Saved Games'

 Searches

 SendTo

'Start Menu'

 Templates

 tf

 Tracing

 Untitled.ipynb

 Videos

'VirtualBox VMs'


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ cd .git

bash: cd: .git: No such file or directory


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ git init

Initialized empty Git repository in C:/Users/Sam/.git/


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ pwd

/c/Users/Sam


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ ls

'3D Objects'

 AppData

'Application Data'

 best

'Cisco Packet Tracer 7.1.1'

 Contacts

 Cookies

 copy

 cracked.txt

 Desktop

 Doc-Root

 Documents

 Downloads

 Dropbox

 eclipse-workspace

 Favorites

 git

 GNS3

 gomata

 IdeaProjects

 IntelGraphicsProfiles

 kubectl.exe

 Links

'Local Settings'

 MicrosoftEdgeBackups

 Music

'My Documents'

 myproject

 NetHood

 NTUSER.DAT

 ntuser.dat.LOG1

 ntuser.dat.LOG2

 NTUSER.DAT{ac195edd-5478-11eb-9c89-8a42866465a2}.TM.blf

 NTUSER.DAT{ac195edd-5478-11eb-9c89-8a42866465a2}.TMContainer00000000000000000001.regtrans-ms

 NTUSER.DAT{ac195edd-5478-11eb-9c89-8a42866465a2}.TMContainer00000000000000000002.regtrans-ms

 ntuser.ini

 OneDrive

 Pictures

 PrintHood

 projects

 PycharmProjects

 Recent

 Roaming

 sam

'Saved Games'

 Searches

 SendTo

'Start Menu'

 Templates

 tf

 Tracing

 Untitled.ipynb

 Videos

'VirtualBox VMs'


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ pwd

/c/Users/Sam


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ cd .git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.git (GIT_DIR!)

$ ls

config  description  HEAD  hooks  info  objects  refs


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.git (GIT_DIR!)

$ pwd

/c/Users/Sam/.git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/.git (GIT_DIR!)

$ cd ..


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ rmdir .git

rmdir: failed to remove '.git': Directory not empty


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ rm -ef .git

rm: unknown option -- e

Try 'rm --help' for more information.


Sam@LAPTOP-CJKC92UJ MINGW64 ~ (master)

$ rm -rf .git


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ mkdir git

mkdir: cannot create directory ‘git’: File exists


Sam@LAPTOP-CJKC92UJ MINGW64 ~

$ cd git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ ls

lab  Projects


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ ls -la

total 32

drwxr-xr-x 1 Sam 197121 0 Jan  3 22:26 .

drwxr-xr-x 1 Sam 197121 0 Jan 18 23:18 ..

drwxr-xr-x 1 Sam 197121 0 Jan  3 22:46 lab

drwxr-xr-x 1 Sam 197121 0 Jan  3 22:25 Projects


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ cd .git

bash: cd: .git: No such file or directory


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ pwd

/c/Users/Sam/git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ ls

lab  Projects


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ cd lab


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab (newbranch)

$ ls

a.txt  b.txt  c.txt  d.txt  e.txt  f.txt  g.txt


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab (newbranch)

$ more .git/

COMMIT_EDITMSG  description     index           objects/

config          HEAD            logs/           refs/


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab (newbranch)

$ more .git/^C


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab (newbranch)

$ pwd

/c/Users/Sam/git/lab


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab (newbranch)

$ cd ../Projects/


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/Projects (master)

$ ls

MySoftware


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/Projects (master)

$ ls -la

total 8

drwxr-xr-x 1 Sam 197121 0 Jan  3 22:25 .

drwxr-xr-x 1 Sam 197121 0 Jan  3 22:26 ..

drwxr-xr-x 1 Sam 197121 0 Jan  3 22:26 .git

drwxr-xr-x 1 Sam 197121 0 Apr 12  2020 MySoftware


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/Projects (master)

$ pwd

/c/Users/Sam/git/Projects


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/Projects (master)

$ cd ..


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ pwd

/c/Users/Sam/git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ mkdir lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ pwd

/c/Users/Sam/git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git

$ cd lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1

$ pwd

/c/Users/Sam/git/lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1

$ echo "Testing " >testme


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1

$ cat testme

Testing


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1

$ git add .

fatal: not a git repository (or any of the parent directories): .git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1

$ pwd

/c/Users/Sam/git/lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1

$ git init

Initialized empty Git repository in C:/Users/Sam/git/lab1/.git/


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ cat >> testme

This is just a testing page


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git status

On branch master


No commits yet


Untracked files:

  (use "git add <file>..." to include in what will be committed)

        testme


nothing added to commit but untracked files present (use "git add" to track)


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git add .

warning: LF will be replaced by CRLF in testme.

The file will have its original line endings in your working directory


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ pwd

/c/Users/Sam/git/lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ ls

testme


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git commit -m "Test commit"

[master (root-commit) bed2813] Test commit

 1 file changed, 2 insertions(+)

 create mode 100644 testme


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git log

commit bed281369c51e63a256c09ec88b2b98c7fabbe2e (HEAD -> master)

Author: Kay <samk@gmail.com>

Date:   Mon Jan 18 23:21:33 2021 -0500


    Test commit


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git config --list

http.sslbackend=openssl

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

credential.helper=manager

diff.astextplain.textconv=astextplain

filter.lfs.clean=git-lfs clean -- %f

filter.lfs.smudge=git-lfs smudge -- %f

filter.lfs.process=git-lfs filter-process

filter.lfs.required=true

core.autocrlf=true

core.fscache=true

core.symlinks=false

user.name=Kay

user.email=samk@gmail.com

diff.tool=diffmerge

difftool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"

merge.tool=diffmerge

mergetool.diffmerge.trustexitcode=true

mergetool.diffmerge.cmd=C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

core.longpaths=true

core.repositoryformatversion=0

core.filemode=false

core.bare=false

core.logallrefupdates=true

core.symlinks=false

core.ignorecase=true


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git remote add origin https://github.com/samkk/sam.git


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git status

On branch master

nothing to commit, working tree clean


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git log

commit bed281369c51e63a256c09ec88b2b98c7fabbe2e (HEAD -> master)

Author: Kay <samk@gmail.com>

Date:   Mon Jan 18 23:21:33 2021 -0500


    Test commit


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git push origin master

Enumerating objects: 3, done.

Counting objects: 100% (3/3), done.

Writing objects: 100% (3/3), 236 bytes | 236.00 KiB/s, done.

Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

To https://github.com/samkk/sam.git

 * [new branch]      master -> master


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ pwd

/c/Users/Sam/git/lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ gh repo clone harke--/notebook

bash: gh: command not found


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ pwd

/c/Users/Sam/git/lab1


Sam@LAPTOP-CJKC92UJ MINGW64 ~/git/lab1 (master)

$ git clone https://github.com/harke--/notebook.git

Cloning into 'notebook'...

remote: Enumerating objects: 32, done.

remote: Counting objects: 100% (32/32), done.

remote: Compressing objects: 100% (26/26), done.

Receiviremote: Total 3582 (delta 10), reused 23 (delta 6), pack-reused 3550

Receiving objects: 100% (3582/3582), 8.79 MiB | 6.83 MiB/s, done.

Resolving deltas: 100% (1781/1781), done.


Saturday, January 16, 2021

AWS - Configure Route 53 (VPC, Subnet, A record, PTR record, CNAME)

Lab -> DNS - Route 53


Private Hosted Zone

Create a VPC


1. Go to AWS console and search for VPC

2. On VPC dashboard, click on create VPC

3. On create VPC page, Name your vpc and specify the IP subnet

     Name: DC_VPC 

     IPv4 Block: 10.0.0.0/16

4. Click Yes, Create.

Now, we have to create subnet

5. Click on Create subnet

6. Specify subnet info (Tag) such as

    name: DC_Pub_VPC

    Specify your VPC from dropdown: DC_VPC

    Specify availibity zone: 

    IPv$ CIDR block: 10.0.10.0/24

7, Now click on Yes create



Since we need to connect to internet, we need to create an Internet Gateway,

8. Click on Inernet Gateway and click on Create internet Gateway

9. Tag your IGW

     Name Tag: DC_IGW

10. Click on Yes, create


OK, Now we just created IGW. We have to associate IGW to VPC.

11. Click on Attach to VPC

12. Select your IGW and click on Yes Attach,

13. Now, click on Route Tables on VPC Dashboard

14. R Click on your Route table and rename to DC_Public_route

15. Click on select the routable and click on Edit

16. Click on Add another route

17. Add default route 0.0.0.0/0 in DC_public_route table and select target as "IGW-*".

18. Now, click on Save.

19. Click on Subnet association tab, and click on Edit 

20. Select DC_public_subnet check box and click save



Now, create another instance. 

- Go to EC2 dashboard and follow standard procedure to create new instance,

- Select  Amazon Linux AMI or any linux flavor of your choice and click next

- Select General Purpose - T2.micro free tier and click next

- On configure instance page, select your VPC

   Network: DC_VPC

   Subnet: DC_Public_subnet

   Auto Assign Public IP: Enable

- Click next and next Add Tag: Name: Web Server

- On Security Group page, select create new security group

   Security Group Name: DC_Pub_Sec_Group

   Description: Public Security Group

- Click on Review and Launch and finally click on Launch,

- On Key pair page, either create a new one or use an existing key pair.

- Click Launch instance



Now, We will launch an Windows instance

- Click on Launch instance

- Select free tier Windows server 2016 base

- t2. Micro and click next. 

- Select Network: DC_VPC

  Subnet: DC_Public_Subnet

  Auto-assign Public IP: Enable and click Next

- Click next on Storage page

- Add tag  Name: Windows Server 2016 and click Next

- On Security Group Page, select new security group 

   security Group Name: DC_Pub_sec_group_Win

   Description: Windows security Group

- Click Next and click on Review and Launch,

- Use existing key or create a new key and click on Launch instances.


Now, Go to EC2 Dash Board and click on Your Linux instance

- Get the IP of the instance and login using putty. and type sudo -i at the prompt to become root


Now, we will install web server

# yum install httpd

# systemctl start httpd

# systemctl enable httpd



Now, using your windows machine, try to access web site. But you can't. The reason is that 

firewall (Security Group is blocking the access.


To enable the access, click on your linux instance and click on security group -> inbound

- Click on Edit and click on add the entry

   http 80 custom 0.0.0.0/0

and click save


Now, refresh the browser on your windows machine, you should be able to open it.


Now, fun part begins. We will be connecting the web server using fully qualified domain name

using windows machine. We will configure Route 53. 


Now, there are certain tasks we have to confgure.

Go to VPC dashboard,

- Select your VPC and Edit DNS Resolution

- It is selected to Yes and click on Save


Again,

R click on your VPC and click on Edit DNS Hostnames

- It is selected Yes and click Save



Now, Go to AWS Dash Board, and look for Route 53 under Networking and ocntent Delivery

- Click on DNS Management

- Click on Hosted Zone

- Click on Create Hosted Zone

  dommain: microinfosys.com

  Comment: DNS testing

  Type: Private Hosted Zone for AWS VPC

  VPC IP: Northern VA


- Now, Click on Create

- In microinfosys.com server, we have NS record and SOA record

- Select microinfosys.com NS line and click on Create Record Set


on Right side, add the following

   Name: aws.microinfosys.com

   Type: A - IPv$ address

    Value: (10.0.10.120) 

    Route Policy: Simple

- Click on create


We successfully created A record for aws.microinfosys.com


Now try to load this page from microsoft 2016 server browser. 

You should have access