Sunday, October 10, 2021

Can anyone explain about liveness and readiness probe in kubernetes for springboot java ?


Kubernetes Liveness and Readiness Probes
Kubernetes uses liveness probes to know when to restart a container. If a container is unresponsive—perhaps the application is deadlocked due to a multi-threading defect—restarting the container can make the application more available, despite the defect. It certainly beats paging someone in the middle of the night to restart a container.[1]
Kubernetes uses readiness probes to decide when the container is available for accepting traffic. The readiness probe is used to control which pods are used as the backends for a service. A pod is considered ready when all of its containers are ready. If a pod is not ready, it is removed from service load balancers. For example, if a container loads a large cache at startup and takes minutes to start, you do not want to send requests to this container until it is ready, or the requests will fail—you want to route requests to other pods, which are capable of servicing requests.
At the time of this writing, Kubernetes supports three mechanisms for implementing liveness and readiness probes: 1) running a command inside a container, 2) making an HTTP request against a container, or 3) opening a TCP socket against a container.
A probe has a number of configuration parameters to control its behaviour, like how often to execute the probe; how long to wait after starting the container to initiate the probe; the number of seconds after which the probe is considered failed; and how many times the probe can fail before giving up. For a liveness probe, giving up means the pod will be restarted. For a readiness probe, giving up means not routing traffic to the pod, but the pod is not restarted. Liveness and readiness probes can be used in conjunction.


From discussion board

Thursday, September 23, 2021

Prep - Better to learn these technologies ..

 Laundry list of crapps that you need to master on,


1. Git/GitHub

2. AWS Access

3. CF - Cloud Foundry

4. SAP CLI tools 

5. Cockpit

6. Concourse

7. Gardener

8. ISA

9. SAP Repos

10. Route 53 for BAS

11. Click@palletsprojects

12. kontrolle

13. Consul @hashi corp

14. Git Lab

15. Monit, 

16. BOSH

17. Ansile

18. Terraform



Thursday, July 22, 2021

interview with B. P. Koirala

http://annapurnapost.com/news/144138

Sunday, March 14, 2021

How to open GUI application on Docker

Install GUI application on Docker

# docker run it --net=host --env=DISPLAY --volume="$HOME/.Xauthority:/root/.Xauthority --name myOS cientos:latest

Your docker instance will be created and you will also login to the instance

# yum install firefox gedit httpd

# firefox 

Browser opens. Just type localhost

You will see default page.

Saturday, February 13, 2021

SAN Switch - Disabling the Telnet service on Brocade SAN switches - STIG finding

 

SAN Switch - Disabling the Telnet service on Brocade SAN switches

Disabling the Telnet protocol on Brocade SAN switches

By default, telnet is enabled on Brocade SAN switches. As part of security hardening of the devices it need to be disabled. In order to implement the change, you have to modify IP Filter policy to disable inbound connectivity to tcp port.

1. Login to your SAN switch
2. By default, IP filter policy can not be changed, so first clone the default policy.
> ipfilter --show
                2              any         tcp          23           permit

> ipfilter --clone Block_Telnet_ipv4 -from default_ipv4
> ipfilter --clone Block_Telnet_ipv6 -from default_ipv6
> ipfilter --show

3. Now, you have to remove the existing rule to permit connectivity on tcp service port 23.
   Run ipfilter-show to find out the current rile number which permits the connectivity.

> ipfilter --delrule Block_Telnet_ipv4 -rule 2
> ipfilter --delrule Block_Telnet_ipv6 -rule 2

4. Now, add rule to deny inbound connectivity to the fabric switch on tcp service port 23
> ipfilter --addrule Block_Telnet_ipv4 -rule 2 -sip any -dp 23 -proto tcp -act deny
> ipfilter --addrule Block_Telnet_ipv6 -tule 2 -sip any -dp 23 -proto tecp -act deny

5. Now, save and apply the policy
> ipfilter --save Block_Telnet_ipv4
> ipfilter --save Block_Telnet_ipv6
> ipfilter --activate Block_Telnet_ipv4
> ipfilter --activate Block_Telnet_ipv6
> ipfilter --show

you should see
2              any         tcp          23           deny

So, in summary
> ipfilter --show
> ipfilter -clone Block_telnet_23 -from default_ipv4

> ipfilter -delrule Block_telnet_23 -rule 2
> ipfilter -delrule Block_telnet_23 -rule 2 -sip any -dp 23 -protp tcp -act deny

> ipfilter -save Block_telnet_23
> ipfilter -activate Block_telnet_23

> ipfilter --show

Git - Survival Commands - Become zero to Hero - git in 5 minutes

 

git - survival commands - become zero to hero - git in 5 minutes

 git survival commands - zero to hero

Terms to understand
Working Directory
 - The directory where you will be creating, modifying files or directories.
Staging area:
 - The location where files are ready to be saved (Committed). First files are stored in staging area and then we commit.
Repo:
  - Files/direcotries that are saved/committed. It can be local or remote repo.
  - Local repo is your local PC, and remove it like github, gitlab.

OK, Lets get started ...

1. Open account on github

2. download git bash or MobaXterm and install it
   # yum install git
   $ git version

3. Open your program and initilize git
   $ mkdir gitws; cd gitws
   $ git init
   .git dir is created which contains config info

4. Add your identity so that you can download/upload your files
   $ git config --global user.name "Sam"
   $ git config --global user.email "sam@linuxtab.com"

5. Add your remote repo
   $ git remote add origin <URL-TO-GitHub>

6. Pull the content or update your local repo with remote to sync
   $ git pull

7. To select or to go to a particular branch
   $ git checkout <branch_name>
   $ git checkout ws_task2
   $ git checkout master    # you can switch between the branches

8. Create a new branch and switch to it to make changes to the contents
   $ git checkout -b <branch_name>
   $ git checkout -b <ws_task3>
   $ cat > index.html
     Welcome to the club !!!

4. Show the status if there is anything changed/modified at staging area.
   $ git status

5. Add changed contents to the staging area
   $ git add <file or dir>
   $ git add mydir
   $ git add index.html
   $ git add .     # add everything

6. Save any changes make to the file in your branch. This is commit area.
   $ git commit -m <Detail what is changed>
   $ git commit -m "initial changes are made for login module"
   $ git commit -m "My first commit" index.html
   $ git log index.html    # shows all version of file with commit id
   $ git help log  # get help on subcommand
   $ git show commitid    # shows the detail log
   $ git diff commit_id_1 commit_id_2    # show the difference in two versions
   $ git ls-files

7. Switch to your master (origin) branch
   $ git checkout master

8. Lets merge the branch ws_task3 with master
   - All the changes in ws_task3 will be added to master (fast forward merge)
   $ git merge ws_task3
   $ git branch -d ws_task3    # remove the branch you created

9. Push the change to your remote repo
   $ git push -u origin <branch name>

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

28f4ih3zYyFr2CsDOVJ9Oykk3EEwwlvqjCRFFcQDhWjtYkD3SBxSjUFSaL04irGy

UDcxzfVwodcjL1GbxrFKGKAZ4eTv4Zvc4hZp/Ix9iq/tzKIe0KCLNPYEMJBOvWPU

0TGeqTBysskJ7Z6CVz8rUT2DV35PP02eqQAEQYKs/tVyvasxB1j/FO9dhnqyoFEp

YOxfEuQn0wqKWIqQF/v0XRWEZLP/mRH7miLqXp5TRc1UFm5GiheTmiB4VcrxjZlt

sF3QNSGiOrZwovDJ337DT0FeVXU5CVf72J8hJ7Q/azS4IFovhw6+9FmS9sdIhSXi

1sMsy2QjQgEXaJtVZh25QrbNwjXelBhn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

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