Saturday, 25 June 2022

DES(Data Encryption Key) AWS

 DEKs (Data encryption keys AWS)

1)DEKs: stands for Data encryption keys in AWS. 

2)KMS(Key management service ) does not store DEKs in any case. 

3)Used for data size > 4KB 

4)KMS is regional service.

How does DEKs gets generated and used??

KMS generates 2 key  version of DEKs mentioned below:

    a)Plain text key : This key is used to encrypt data and once data is encrypted .It is discarded immediately.

   b)Cipher Text Key : This key is ciphertext of  key (a) and used later when data need to be decrypted.


Summary::

Encryption process: DEKs generates  2 keys and one is plain text and second one is encrypted key . Plain text is used to encrypt data and once data is  encrypted , plain key is discarded. Now when data need decryption we require plain key for decryption. So this plain key we can ask KMS to return by passing encrypted key and once we have plain text key we can do decryption directly.

S3 uses 

CMK at isolated at region level and never leave. Means CMK is not global nor alias are global. We can similar alias in different region but they can point to different stuff.

There are two types of keys 

    a)AWS managed :: Less flexible. Compulsory key rotation.

    b)Customer Managed keys:: More  flexible. More policy. Rotation is optional.


CMK has key policy which is resource policy.






Tuesday, 17 May 2022

OpenShift Jenkins Pipeline.

 

Various object present in OpenShift plugin to make Jenkins pipeline work in openshift container.

openshiftBuild,

 openshiftCreateResource, 

openshiftDeleteResourceByJsonYaml, 

openshiftDeleteResourceByKey, 

openshiftDeleteResourceByLabels, 

openshiftDeploy, openshiftExec, 

openshiftImageStream, openshiftScale, 

openshiftTag, openshiftVerifyBuild, 

openshiftVerifyDeployment, openshiftVerifyService, 

parallel, podTemplate, 

powershell,

 properties, 

publishBuildInfo,

publishHTML, 

pwd, 

readFile, 

readJSON, 

readManifest, 

readMavenPom, 

readProperties, 

readTrusted, 

readYaml, 

resolveScm, 

retry, 

script, 

sh, 

sha1, 

slackSend, 

sleep, stage, stash, step, svn, tee, timeout, tm, tool, touch, unarchive, unstash, unzip, validateDeclarativePipeline, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, writeJSON, writeMavenPom, writeYaml, ws, xrayScanBuild, zip] or symbols [all, allOf, always, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, authorizationMatrix, batchFile, bitbucket, booleanParam, branch, buildButton, buildDiscarder, buildParameter, buildingTag, caseInsensitive, caseSensitive, certificate, changeRequest, changelog, changeset, checkoutToSubdirectory, choice, choiceParam, cleanWs, clock, cloud, cobertura, command, configFile, configFileProvider, configMapVolume, containerEnvVar, containerLivenessProbe, containerTemplate, copyArtifacts, credentials, cron, crumb, default, defaultView, demand, disableConcurrentBuilds, disableResume, docker, dockerCert, dockerfile, downloadSettings, downstream, dumb, durabilityHint, emptyDirVolume, emptyDirWorkspaceVolume, envVar, envVars, environment, equals, expression, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, github, githubPush, globalConfigFiles, headRegexFilter, headWildcardFilter, hostPathVolume, hostPathWorkspaceVolume, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, isRestartedRun, jdk, jgit, jgitapache, jnlp, jobDsl, jobName, kubernetes, label, lastCompleted, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, lastSuccessful, latestSavedBuild, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, modernSCM, myView, never, newContainerPerStage, nfsVolume, nfsWorkspaceVolume, node, nodeProperties, nonInheriting, nonStoredPasswordParam, none, not, oc, onFailure, overrideIndexTriggers, paneStatus, parallelsAlwaysFailFast, parameters, password, pattern, permalink, permanent, persistentVolumeClaim, persistentVolumeClaimWorkspaceVolume, pipeline-model, pipelineTriggers, plainText, plugin, podAnnotation, podEnvVar, pollSCM, portMapping, preserveStashes, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, remotingCLI, run, runParam, schedule, scmRetryCount, scriptApprovalLink, search, secretEnvVar, secretVolume, security, shell, skipDefaultCheckout, skipStagesAfterUnstable, slave, sourceRegexFilter, sourceWildcardFilter, specific, sshUserPrivateKey, stackTrace, standard, status, string, stringParam, swapSpace, tag, text, textParam, tmpSpace, toolLocation, triggeredBy, unsecured, upstream, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, weather, workspace, zfs, zip] or globals [Artifactory, currentBuild, docker, env, fileLoader, openshift, params, pipeline, scm]

Tuesday, 26 April 2022

GIT Commands

 1)git config --get remote.origin.url : To know remote github branch url.

2)git rebase and squash : These are used to club multiple commits into one to make PR clean.

3)git stash : to save uncommitted change.

4)git stash apply : to restore changes which were stashed.

5)git switch branch-1 : to switch branch

6)git commit -m "Commit message"

7)git push origin branchName : push changes to branch

8)git diff filename fileName

9)git status:

10)git restore filename

11)git remote -v: will give remote details 

12)git reset --soft HEAD^:  To uncommit your changes in local branch in case you commit something by mistake.

13) git switch master : To switch to any branch

14)git branch -a : list all branches

15)git checkout branchname



Wednesday, 16 March 2022

Friday, 11 February 2022

Different services running on MAC or not.

 Check below services are running or not on MAC.

 1)Mongodb

      ps -ef | grep mongod | grep -v grep | wc -l | tr -d ' '

This will get you the number of MongoDB processes running, thus if it is other than 0, then you have MongoDB running on your system.

2)Elasticsearch 



Tuesday, 25 January 2022

Collection Classes and Interfaces in Java

Collection is an interface with generic methods like add, remove etc. Collection classes are iterable. Core interfaces of Collection framework are as follows:

1)List   2)Set  3)Queue

Map interface is not part of collection framework.Also map is not iterable.


Monday, 24 January 2022

ClassNotFoundException Vs NoClassDefFoundError

 ClassNotFoundException : This is checked exception and occurs when class is not found at runtime.The reason for this could be classpath is not updated with required jars. 

// Java Program to Illustrate ClassNotFoundException

public class Demo {


// Main driver method

public static void main(String args[])

{


// Try block to check for exceptions

try {


Class.forName("ApachePOI");

}


// Catch block to handle exceptions

catch (ClassNotFoundException ex) {


// Displaying exceptions on console along with

// line number using printStackTrace() method

ex.printStackTrace();

}

}

}


NoClassDefFoundError: This is unchecked exception and occurs when class was present during compile time but absent during runtime. This generally happens when no .class file is present at runtime.This is kind of LinkageError.