Sunday, March 21, 2021

Do the JSON keys have to be surrounded by Double quotes?

https://stackoverflow.com/a/949469/2413870

https://medium.com/@alifabdullah/never-confuse-json-and-javascript-object-ever-again-7c32f4c071ad


 Yes, JSON Keys are to be surrounded by Double Quotes
 JavaScript objects do not contain single or double quote marks around the keys when no spacing is used in the key name.
var person= {first name: “Depp”, address: “earth”}; //invalid// To prevent this error:
var person= {“first name”: “Depp”, "address": “earth”};

Linux Unix Redhat Tutorial VirtualBox, Install Ubuntu/Redhat on Virtualbox

ifCommand1Suceeds && RunCommand2

RunCmd1 ; IrrespectiveOfResultRunCmd2 ;

IfCommand1DoesNotRun || ThenRunCmd2


For those users who are switching from Fedora to Ubuntu, the yum tool is replaced with another great tool apt-get.
http://www.geekinterview.com/question_details/49964


-----------------Unix-------------------

https://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/
BEST BEST BEST



CD's and DVDs are using ISO9660 filesystem
https://www.linuxnix.com/how-to-mount-dvd-or-cdrom-in-linux/


I have gnome Desktop etc
Install XWindows
Resolution A: Install the desktop related package groups after system install (Recommended)
Resolution B: Select "Desktop" mode (Server with a GUI in RHEL 7) as the default installation mode in Anaconda

https://access.redhat.com/solutions/5238  [Imp]
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/sn-switching-to-gui-login.html



https://blog.paranoidpenguin.net/2017/08/red-hat-7-4-virtualbox-guest-additions-issues/
sudo mount -o loop ~/VBoxGuestAdditions_5.1.27-117460.iso /mnt/vboxguest
mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions


etc/yum.repos.d/

yum install firefox
yum repolist all


x window System
startkde gnome-session xfce

http://www.faqs.org/docs/lnag/lnag_xwindows.html
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Reference_Guide/ch-x.html
https://en.wikipedia.org/wiki/Comparison_of_X_Window_System_desktop_environments

dnf vs yum vs apt
dnf??
https://www.linux.com/learn/what-you-need-know-about-fedoras-switch-yum-dnf



3
down vote
You can redirect output and run the ls process in the background.

ls > myls.txt &


VBoxManage.exe setextradata "Redhat 7.3" CustomVideoMode1 1366x768x32

/dev/disk/by-label/VBOXADDITIONS

https://access.redhat.com/solutions/253273
subscription-manager register --username (username used in RH web registration) --password (password in RH web login) --auto-attach

https://www.digitalocean.com/community/tutorials/how-to-set-up-and-use-yum-repositories-on-a-centos-6-vps

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/chap-Subscription_and_Support-Registering_a_System_and_Managing_Subscriptions.html

https://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/


https://blog.paranoidpenguin.net/2017/08/red-hat-7-4-virtualbox-guest-additions-issues/

https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html-single/rhsm/index

subscription-manager register --username kawkaran --password FxsxED97 --auto-attach


RESET FORGOTTEN Password - Emergency Mode - Single User Mode

https://linuxconfig.org/recover-a-forgotten-root-password-on-redhat-7-linux-selinux-system

JSON Comment Example — How to Comment in JSON Files

https://www.freecodecamp.org/news/json-comment-example-how-to-comment-in-json-files/


If you’re having trouble adding comments to your JSON file, there’s a good reason: JSON doesn’t support comments.

“I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability,” writes Douglas Crockford, who popularized the text-based data format.

However, there’s a workaround. And that’s what this article is about: how to add comments to your JSON file.

Add Data as Comments

A way to skirt around the comments issue is to add data to your JSON file that function as comments.

Let’s go through an example, starting with this information in our JSON file:

{
   "sport": "basketball",
   "coach": "Joe Smith",
   "wins": 15,
   "losses": 5
}


Now let’s add another key-value pair to serve as our comment, which you can see in the first line in the code below:

{
   "_comment1": "this is my comment",
   "sport": "basketball",
   "coach": "Joe Smith",
   "wins": 15,
   "losses": 5
}

Here’s another example. This time, we use two underscores at the start and end of the key:

 "__comment2__": "this is another comment",

The underscores help to differentiate the comment from the rest of the data in our file.

Friday, March 19, 2021

Babel? Gulp? Webpack? ES6 to ES5? CommonJS vs AMD

What is difference transpiler vs compiler? 

Compiling is the general term for taking source code written in one language and transforming into another.Compiler produces executable (machine code) as output.

Transpiling is a specific term for taking source code written in one language and transforming into another language that has a similar level of abstraction.
Transpilers are also known as source-to-source compilers.
For example : "Babel"

What is the difference between npm install and npm run build?

How to convert ES6 Code to ES5 using Babel?

Why we use gulp/ webpack? 


What is CommonJS


What is a CSR? Where is private Key? Where is public key?

  •  In CSR generation, We explicitly get .csr File and a .key - Private Key. 
  • While generating csr,  we specify key algorithm - eg "rsa"
  • Public Key is implicitly added in. csr file itself 
  • We can retrieve Public key from .csr file and .key (private key) 

https://www.sslshopper.com/what-is-a-csr-certificate-signing-request.html

https://security.stackexchange.com/questions/111136/where-in-the-csr-is-the-public-key

What is a CSR (Certificate Signing Request)?


What is a CSR? A CSR or Certificate Signing request is a block of encoded text that is given to a Certificate Authority when applying for an SSL Certificate. It is usually generated on the server where the certificate will be installed and contains information that will be included in the certificate such as the organization name, common name (domain name), locality, and country. It also contains the public key that will be included in the certificate. A private key is usually created at the same time that you create the CSR, making a key pair. A CSR is generally encoded using ASN.1 according to the PKCS #10 specification.

certificate authority will use a CSR to create your SSL certificate, but it does not need your private key. You need to keep your private key secret. The certificate created with a particular CSR will only work with the private key that was generated with it. So if you lose the private key, the certificate will no longer work.

What is contained in a CSR?

NameExplanationExamples
Common NameThe fully qualified domain name (FQDN) of your server. This must match exactly what you type in your web browser or you will receive a name mismatch error.

*.google.com
mail.google.com

OrganizationThe legal name of your organization. This should not be abbreviated and should include suffixes such as Inc, Corp, or LLC.Google Inc.
Organizational UnitThe division of your organization handling the certificate.Information Technology
IT Department
City/LocalityThe city where your organization is located.Mountain View
State/County/RegionThe state/region where your organization is located. This shouldn't be abbreviated.California
CountryThe two-letter ISO code for the country where your organization is location.US
GB
Email addressAn email address used to contact your organization.webmaster@google.com
Public KeyThe public key that will go into the certificate.The public key is created automatically

What does a CSR look like?

Most CSRs are created in the Base-64 encoded PEM format. This format includes the "-----BEGIN CERTIFICATE REQUEST-----" and "-----END CERTIFICATE REQUEST-----" lines at the begining and end of the CSR. A PEM format CSR can be opened in a text editor and looks like the following example:

-----BEGIN CERTIFICATE REQUEST-----
MIIByjCCATMCAQAwgYkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMR8w
HQYDVQQLExZJbmZvcm1hdGlvbiBUZWNobm9sb2d5MRcwFQYDVQQDEw53d3cuZ29v
Z2xlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApZtYJCHJ4VpVXHfV
IlstQTlO4qC03hjX+ZkPyvdYd1Q4+qbAeTwXmCUKYHThVRd5aXSqlPzyIBwieMZr
WFlRQddZ1IzXAlVRDWwAo60KecqeAXnnUK+5fXoTI/UgWshre8tJ+x/TMHaQKR/J
cIWPhqaQhsJuzZbvAdGA80BLxdMCAwEAAaAAMA0GCSqGSIb3DQEBBQUAA4GBAIhl
4PvFq+e7ipARgI5ZM+GZx6mpCz44DTo0JkwfRDf+BtrsaC0q68eTf2XhYOsq4fkH
Q0uA0aVog3f5iJxCa3Hp5gxbJQ6zV6kJ0TEsuaaOhEko9sdpCoPOnRBm2i/XRD2D
6iNh8f8z0ShGsFqjDgFHyF3o+lUyj+UC6H1QW7bn
-----END CERTIFICATE REQUEST-----

How do I generate a CSR and private key?

You need to generate a CSR and private key on the server that the certificate will be used on. You can find instructions in your server documentation or try the instructions from one of these certificate authorities:

Comodo CSR Generation Instructions
DigiCert CSR Generation Instructions
Entrust CSR Generation Instructions
GeoTrust CSR Generation Instructions
Thawte CSR Generation Instructions

Once you have your CSR generated, you can use our SSL Wizard to find the best SSL certificate that will meet your needs. If you are familiar with OpenSSL you can use the following command to generate a CSR and private key:

openssl req -new -newkey rsa:2048 -nodes -out servername.csr -keyout servername.key

How do I decode a CSR?

You can easily decode your CSR to see what is in it by using our CSR Decoder. In order to decode a CSR on your own machine using OpenSSL, use the following command:

openssl req -in server.csr -noout -text

What is a CSR/Private Key's bit length?

The bit-length of a CSR and private key pair determine how easily the key can be cracked using brute force methods. As of 2016, a key size of less than 2048 bits is considered weak and could potentially be broken in a few months or less with enough computing power. If a private key is broken, all the connections initiated with it would be exposed to whomever had the key. The Extended Validation guidelines that SSL certificate providers are required to follow, require that all EV certificates use a 2048-bit key size to ensure their security well into the future. Because of this, most providers encourage 2048-bit keys on all certificates whether they are EV or not

Where in the CSR is the public key?

https://security.stackexchange.com/a/111221/179388

 I do not see any public key being "attached" into the CSR.

It's there. Here's where:

When you generate your key like so

$ openssl genrsa -out server.key 1024
Generating RSA private key, 1024 bit long modulus
....................................++++++
......++++++
e is 65537 (0x10001)

And you generate your CSR like so:

$ openssl req -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:dummy.example.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Then the public key will be inside the both the:

  1. Private Key file:

    $ openssl rsa -in server.key -pubout
    writing RSA key
    -----BEGIN PUBLIC KEY-----
    MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4IPFCBOLLyJWtx37bibBKhKvE
    9MbfD0MV8bXU544dVXvWZwLQwluyrsYebpl+4K1aLNmh01qUwBsm4GxESZo4mF3L
    13Yki7Xlw95KJVgDBN0i1j96LgaxV/4K8z4RQ1MryGw+EHYFK/5pwtLxGN7Rn7kB
    L9HOPEkwfwWbenUikQIDAQAB
    -----END PUBLIC KEY-----
    
  2. CSR file:

    $ openssl req -in server.csr -noout -pubkey
    -----BEGIN PUBLIC KEY-----
    MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4IPFCBOLLyJWtx37bibBKhKvE
    9MbfD0MV8bXU544dVXvWZwLQwluyrsYebpl+4K1aLNmh01qUwBsm4GxESZo4mF3L
    13Yki7Xlw95KJVgDBN0i1j96LgaxV/4K8z4RQ1MryGw+EHYFK/5pwtLxGN7Rn7kB
    L9HOPEkwfwWbenUikQIDAQAB
    -----END PUBLIC KEY-----

"Linux Directories Explained in 100 Seconds" on YouTube

 https://youtu.be/42iQKuQodW4

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass