Saturday, March 29, 2025

Nexus Artifact Repository Quiz


1)  Advantages of Artifact includes __________.

        a. Reliability

        b. Security

        c. Composability

        d. Shareability

        e. All the above


2)  Artifacts cannot be used in the context of Risk Assessments.

        a. True

        b. False


3)  In which Default Port number does Jenkins run?

        a. 8081

        b. 8080

        c. 8082

        d. 7897


4)  File permission 777 indicates that file is __________.

        a. Readable, Writable and Executable by everyone.

        b. Readable by Owner only

        c. Readable by group only

        d. Writable by owner and group only


5)  Repository Manager helps in storing and retrieving Artifacts.

        a. True

        b. False


6)  Maven is a kind of __________.

        a. Build tool

        b. IDE

        c. Package Manager


7)  Which type of artifact is named with version and timestamp?

        a. Releases

        b. Snapshot


8)  Data directory contains the nested directories like bin, deploy and lib.

        a. True

        b. False


9)  Which of the following file contains the Project configuration details of the project?

        a. index.html

        b. json

        c. pom.xml


10)  PyPI repository is supported in Nexus 3.

        a. True

        b. False


11)  Which of the following file contains the Project configuration details of the project?

        a. version

        b. GroupID

        c. ArtifactID


12)  Nexus storage is in the form of __________ .

        a. Derby DB

        b. File System


13)  Nexus Repository Manager helps in saving __________ .

        a. Bandwidth

        b. Time

        c. All of the above

     d. None


14)  No. of Build Life cycle phases Maven has is __________ .

        a. 5

        b. 6

        c. 7


15)  Component is also called as __________.

        a. Artifact

        b. Archive

        c. All the Options

        d.  Bundle


16) Artifacts are stored in the structure of __________.

        a. GAF coordinate

        b. GAI coordinate

        c. GAV coordinate

     

17) Artifacts are stored in the structure of __________.

        a. PypI

        b. Maven

        c. NuGet

        d. R

e. None


18) Deployment to a repository is configured in the pom.xml for the respective project in the __________ .

        a. ID section

        b. DistributionManagement Section

        c. All the Options

d. None of the options


19)  Can Nexus 2 be migrated to Nexus 3?

        a. True

        b. False


20)  Which articfact type is work in progress

        a. Releases

        b. Snapshots


21)  In which Default Port number does Nexus run?

        a. 8081

        b. 8080

        c. 8082

        d. 7897


22)  POM stands for?

        a. Project Object Model

        b. Project Overview Model

        c. Planning Overview Model


23)  Nexus 3 supports docker format.

        a. True

        b. False


24)  Authenticity and Integrity is verified by the mechanism of __________.

        a. PGP signature

        b. Checksum

        c. All the Options

        d.  None of the options


25)  Which of the following type of repository can be connected with Remote Repository?

        a. Proxy Repo

        b. Hosted Repo

        c. Blob repo


26)  Nexus3 got tags named oss and pro.

        a. True

        b. False


27)  Default configuration of Central repository is stored in __________ .

        a. Pom.xml

        b. Settings.xml

        c. Style.css


28)  The Nexus Repository Manager application runs on the OSGi container.

        a. True

        b. False


29)  Which level does the tags gets applied?

        a. Component level

        b. Assest level


30)  The credentials used for the deployment are found in the __________ .

        a. Server Section

        b. DistributionManagement Section

        c. All the options


31)  Which of the following directory contains the application and other additional components like Java libraries and Configuration files?

        a. application Directory

        b. Data Directory


32)  Which coordinate of Maven helps in identifying the project uniquely across all other projects?

        a. Version

        b. GroupID

        c. ArtifactID


33)  Which Build Life cycle of Maven helps in ensuring the quality criteria?

        a. Deploy

        b. Package

        c. Verify

        d.  Install


34)  Sonatype work Directory is a __________ .

        a. Application Directory

        b. Data Directory


Terraform Commands

Workspace commands

terraform workspace new myworkspace



terraform workspace select default




terraform workspace delete default



terraform workspace delete myworkspace



Terraform Quiz : Question and Answers

 1) Format to define address in terraform is ________.

        a. Both “[10.0.0.0/16]” and [“10.0.0.0/16”] are valid

        b. “[10.0.0.0/16]”

        c. [“10.0.0.0/16”]

        

2)  A set of files which describe the infrastructure in terraform is called as __________.

        a. Terraform files

        b. Terraform description files

        c. Terraform details

        d. Terraform configuration


3)  Which of the following is the correct format to define type and name of resource of virtual network

        a. resource “azurerm_virtual_network”“vnet”

        b. resource "azurerm_virtual_network""vnet" & resource "azurerm_virtual_network" "vnet" are correct

        c. resource “azurerm_virtual_network” ”vnet”


4)  HCL Stands for?

        a. Hashicorp Connection Language

        b. Hashicorp Configuration Language

        c. Harshicorp Common Language


5)  Which is the command to initialize the plugins in terraform?

        a. terraform init

        b. terraform run

        c. terraform begin

        d. Terraform configuration


6) Terraform is an infrastructure provisioning tool.

        a. True

        b. False


7)  IaC is frequently referred as ____________.

        a. Normal code

        b. Programmable code 

        c. Programmable Infrastructure

        d. Normal Infrastructure


8)  What is the command to create a storage account of the name mystorageacct in Terraform?

        a. resource “azurerm_storage_account” “mystorageacct”

        b. resource “azure_Storage_account” “mystorageacct” 

        c. resource “azurerm_storage_acct””mystorageacct” and resource “azurerm_storage_acct” “mystorageacct” are correct

        d. resource “azurerm_storage_account””mystorageacct”


9)  Which of the following command helps in aligning the format of Terraform?

        a. terraform format

        b. terraform fmt

        c. terraform allign


10)  Which of the following parameter can be used to make the label sensitive?

        a. sensitive

        b. hide

        c. confidential

        d. optional


11)  Which of the following parameter can be used to make the label sensitive?

        a. CLI Flags DRY

        b. Remote state configurations DRY

        c. Keep terraform code DRY

        d. All the options


12)  Local values are defined in __________ blocks.

        a. local

        b. function

        c. main


13) Which of the following parameters are needed to create a backend for AWS using S3?

        a. bucket and key

        b. bucket, key and region

        c. bucket and region


14) Terraform Module registry makes the work easy to deal with ___________.

        a. modules

        b. Modues

        c.Modular Variables

        d. All the options


15) Which of the following option is used to combine two or more lists?

        a. concat

        b. combine

        c. merge


16) Terraform supports which of the cloud providers?

        a. Azure and AWS

        b. Azure 

        c.AWS

        d. Alicloud

        e. All the options


17) Which of the following feature is true about Terragrunt?

        a. It provides locking mechanism

        b. It redirects to the Terraform original commands

        c. It allows you to use remote state

        d. All the options


18) Which of the following syntax is used to assign a variable?

        a. terraform apply -var='name=test'

        b. terraform apply -var =name =test

        c. terraform apply -var="name =test"

        d. Both terraform apply -var="name =test" and terraform apply -var='name=test' are correct


19) Once the terraform apply is completed, the state file will go to ___________ state .

        a. Cannot be predicted

        b. locked

        c. unlocked

       

20) Which of the following function returns lexically sorted list of map keys?

        a. string(map)

        b. list(map)

        c. keys(map)


21) Current workspace is denoted by using ______________.

        a. $

        b. _

        c.-

        d. *


22) Which of the following option is used to configure the lock in AWS using terragrunt?

        a. DynamoDB

        b. VPC

        c. DB


23) Which of the following command is used to move the workspace with name stage?

        a. terraform workspace select stage

        b. terraform workspace choose stage

        c. terraform workspace switch stage

     

24) Which command should be run after deleting the backend?

        a. terraform taint

        b. terraform untaint

        c. terraform fmt

        d.  terraform init


25) Which type of resource is used to create storage account in Azure?

        a. azure_storage_account

        b. azurerm_storage_account

        c. azure_storage_accounts


26) Which of the following option is not a built-in function supported by Terraform?

        a. abs(float)

        b. compact(list)

        c. chomp(string)

        d. contains(map,element)


27) Interpolation syntax can be used to configure backends.

        a. False

        b. True

  

28) Which of the following command is used to list the workspaces?

        a. terraform workspace show

        b. terrform workspace details

        c. terrform workspace list

        d. terrform workspace view


29) Terraform manages the multiple clouds by using _____________.

        a. Specified Databases

        b. API Calls

        c. Storage accounts

        

30) Terragrunt helps in configuring the remote backend.

        a. True

        b. False


31) For AWS, the backend is ______________.

        a. VPC

        b. S3

        c. All the above


32) Backend supports which of the following features?

        a. State locking and consistency checking

        b. State locking 

        c. consistency checking


33) You can get the secondary access key from storage account by using which of the following command?

  a. azurerm_storage.storageaccount.secondary_access_key                          b. azurerm_storage_account.storageaccount.secondary_access_key

  c. azurerm_storage_account.storageaccount.secondary_key

  d. azurerm_storage.storageccount.secondary_key


34) Which of the following option is the configuration syntax for creating s3 bucket?

        a. aws_s3_bucket

        b. aws_bucket_s3

        c. aws_bucket

       

35) Terragrunt files are saved by using ______________.

        a. .terragrunt

        b. .terragruntfiles

        c. .terragrunt.tf

 

36) Which of the following syntax is used to define lookup?

        a. lookup(map,[default])

        b. lookup(map,key, [default])

        c. lookup(key,map,[default])

        d. None of the options


37) In Terraform, you can mask the value by using _______________ parameter.

        a. hide

        b. sensitive

        c. mask


38) Azure uses which of the following option to store its state file?

        a. Virtual machine

        b. Storage Account

        c. All the above


39) Terraform cannot perform which of the following actions?

        a. Plan

        b. Apply

        c. auto-intialise

        d. none of the options


40) What is the command to create a workspace in Terraform?

        a. terraform workspace prod

        b. terraform workspace new prod

        c. terraform prod workspace

        d. terraform workspace prod new


41) What is the resource type in Azure to create a storage container?

        a. azure_container

        b. azurerm_storage_container

        c. azure_storage_container

        d. azurerm_container


42) Which of the following workspaces cannot be removed?

        a. Prod

        b. Dev

        c. Test

        d. *default


43) Terraform supports which of the cloud providers?

        a. Azure and AWS

        b. Azure 

        c. AWS

        d. Alicloud 



Tuesday, March 25, 2025

Linux Commands

Below linux command will display the packges installed in linux


dnf list available package_name


dnf list available glibc-devel-* -- This will show package installed on server
ssh-keygen -t -rsa -b 4096 -C "loginemail@domain.com"  -- This Generates ssh key pair

Sunday, March 23, 2025

Linux Simple Shell Script to copy the content into file and replace text

 Below script is the simple bash script to create a dummy file and replace text in the script.



#!bin/bash
cd /tmp
mkdir Test_script
cd Test_script
touch -a -m -t $(date +"%Y%m%d%H%M.%S") dummyfile_$(date +"%Y%m%d%H%M%S%3N").txt
echo "ORACLE_HOME=/opt/sw/oracle/client/home" > dummfile.txt
sed -e 's:/opt/sw/oracle/client/home:/opt/sw/oracle/Oracle19c/client/home:g' dummyfile.txt > dummy2.txt
diff dummyfile.txt dummy2.txt
ls -lrt

Chef client cookbook to run from local system : Install Oracle 19c Client Software in Linux Machine

To Install Oracle Client we need to download and place this in Oracle Directory. 

First go to the chef cookbook location and create below directories

  cd cookbooks
  mkdir -p Oracle_Client_Install/recipes
  mkdir -p Oracle_Client_Install/files/default 

Once we create the default directories. We need to create a sh script in default directory and rb script in recipes directory.
our directory structure will now looks like this

  ~/cookbooks
     Oracle_Client_Install
        recipes
           OracleClientInstall.sh
        files
           default
           	OracleClientInstall.rb

Download the Oracle Client software and keep that in directory "/opt/sw/oracle". Then unzip the file. Add the below path in the client_install.rsp file

UNIX_GROUP_NAME=oracle
INVENTORY_LOCATION=/opt/sw/app/oraInventory
ORACLE_HOME=/opt/sw/oracle/Oracle19c/client/home
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
ORACLE_BASE=/opt/sw/oracle 

Copy the below content into the OracleClientInstall.sh.

#!/bin/bash
cd /opt/sw/oracle
mkdir -m 775 -p /opt/sw/oracle/Oracle19c/client/home/network/admin
mkdir -m 775 -p /opt/sw/app/oraInventory
export CV_ASSUME_DISTID = OLE7.8
unset ORACLE_HOME
unset TNS_ADMIN
unset ORACLE_SID
cd /opt/sw/oracle/Oracle19c/client
./runInstaller -silent -responseFile /opt/sw/oracle/Oracle19c/client/response/client_install.rsp

Copy the below content into the OracleClientInstall.rb
#recipes/display_certificates.rb
#Cook book : Oracle_Client_Install
#Recipe : OracleClientInstall.rb
execute 'Install Oracle Client' do
  command 'bash ~/cookbooks/Oracle_Client_Install/files/default/OracleClientInstall.sh
  user 'oracle'
  group 'oinstall'
  action :run
end
 
Save the files and run the chef client using the below code
chef-client -zr recipe[Oracle_Client_Install::OracleClientInstall]
It will install the Oracle Client Software

Thursday, March 20, 2025

Chef Client Cookbook to run from local system : Taking backup using tar command

 First go to the chef cookbook location and create below directories
cd cookbooks
mkdir -p backupfolder/recipes
create the cookbook backupfolder.rb
execute 'Backup Directory' do
	command 'tar -cvf /opt/sw/backup_$(date +"%Y%m%d%H%M%S%3N").tar /opt/sw/conf  /opt/sw/apps'
	action :run
end
the above code will take backup of conf folder and apps folder into a single tar file with datetime stamp. To run the chef client we use the below command
chef-client -zr recipe[backupfolder::backupfolder]

Sunday, March 16, 2025

Chef client cookbook to run from local system : Check validity of the certificates and remove expired certificates

To perform this activity using the chef client we will create new cookbook display_certificates.

First go to the chef cookbook location and create below directories

  cd cookbooks
  mkdir -p display_certificates/recipes
  mkdir -p display_certificates/files/default 

Once we create the default directories. We need to create a sh script in default directory and rb script in recipes directory.
our directory structure will now looks like this

  ~/cookbooks
     display_certifies
        recipes
           display_certificates.sh
        files
           default
           	display_certificates.rb 

Copy the below content into the display_certificates.sh. change keystore path and password as per keystore location. aliasname is certificatename which can be used to delete certificate from keystore.

   #!/bin/bash
  KEYSTORE_PATH="/opt/sw/keystore/keystore.jks"
  KEYSTORE_PASSWORD="changeit"
  keytool -list -v -keystore "$KEYSTORE_PATH" -storepass "$KEYSTORE_PASSWORD" | grep -E "Alias|Valid"
  keytool -delete -alias "aliasname" -keystore "$KEYSTORE_PATH" -storepass "$KEYSTORE_PASSWORD" 
Copy the below content into the display_certificates.rb
#recipes/display_certificates.rb
cookbook_file '/tmp/display_certificates.sh' do
  source 'display_certificates.sh'
  mode '0755'
  owner 'root'
  group 'root'
  action :create
end

execute 'display_certificates' do
  command 'bash /tmp/display_certificates.sh'
  live_stream true
end 
Save the files and run the chef client using the below code
chef-client -zr recipe[display_certificates::display_certificates]
It will display the certificates in the keystore file with certificatename and its expiry date.

Chef Client Cookbook to run from local system : Download File from artifactory

We can use chef receipes to download the files from artifactory 

To verify current chef client version we can use the below command
Chef-shell --version
We will get output like 
Chef Infra Client :  18.4.12 
1. Go to cookbooks
cd ~/cookbooks/
2. Create a directory for cookbook and recipe using the following structure.
mkdir -p downloads/recipes
3. Go to the directory
 cd downloads/recipes
4. Create a below file to download file
vi FileDownload.rb
5. Paste the below content in the file Filedownload.rb
#Cookbook : downloads
#Recipe : FileDownload.rb
#To Download the file from artifactory using the curl script
execute 'Download File'
user 'root'
command 'curl -o ~/cookbooks/downloads/recipes/File.txt -O https://artifactory.srv.mytest.com.au/application/env/File.txt'
live_stream true
action : run
end

6. Save the file using esc+:wq and run using the below command

chef-client -zr recipe[downloads::FileDownload]



7.  Alternatively we can run the chef cookbook using below command

chef-client --local-mode --runlist 'recipe[downloads::FileDownload]'

8. We can use native chef resource to download the file


#Cookbook : downloads 
#Recipe : FileDownload.rb
#To Download the file from artifactory chef resource and keep in required folder

remote_file '/tmp/File.txt' do
source 'https://artifactory.srv.mytest.com.au/application/env/File.txt'
owner 'root'
group 'root'
action :create
end

execute 'move file' do
command 'mv /tmp/File.txt ~/cookbooks/downloads/recipes/File.txt'
action :run
not_if {::File.exist?('~/cookbooks/downloads/recipes/File.txt')}
end

Sunday, December 22, 2024

Oracle Meta Data Queries

This post explains the queries related to Oracle Metadata tables which is useful for finding the database and tables or user information.

1. Query to find particular table in a database.

SELECT *
FROM sys.all_tables
WHERE table_name LIKE 'STG_D%
The above query will get the all tables which is starting with STG_D. This table contains num of rows for each table etc.
2. Query to find particular column in a table database.
SELECT *
FROM sys.all_tab_columns
WHERE column_name LIKE 'NAME%'
The above query will get the all columns where column name starts with NAME. This table contains information like what is the data type of the column, precision, nullable or not, default value enabled or not, what is the low value of that column and what is the highest value of the column value etc
3. Query to find all view in a database
SELECT *
FROM sys.all_views
WHERE view_name LIKE '%NAME%'
The above query will get the all views in a database. It contains text columns where we can see entire view definition.
4. Query to find all data modifications on a table
SELECT *
FROM sys.all_tab_modifications
WHERE table_name LIKE '%TABLE1%'

The above query will show how many inserts, deletes, updates and trucates happened on that table. It shows the partitions that has been truncated.

5. Query to find all synonyms for a table

SELECT *
FROM sys.all_synonyms
WHERE table_name LIKE '%TABLE1%'

The above query will show all synonyms of TABLE1. Synonyms are using when we have table name is quite lengthy or want to read the table from different schema or restrict access to read only.

6. Query to find trigger on a table


SELECT *
FROM sys.all_triggers
WHERE table_name LIKE '%TABLE1%'


The above query will show if there is any trigger on the table TABLE1.


7. Query to find procedures, functions and packages in a database.

SELECT *
FROM sys.all_procedures
WHERE object_type = 'FUNCTION'

The above query will fecth all the functions in the database. For procedure we can use 'PROCEDURE' filter for packages we can package 'PACKAGE'.
8. To find the locked objects by users we can use the below command to identify users and take action accordingly.
SELECT doj.object_name
,vlo.oracle_username
,vlo.os_user_name
,vlo.process
,vlo.locked_mode
,vs.STATUS
,vs.machine
,vs.port
,vs.terminal
,vs.program
,vs.type
,vs.module
FROM dba_objects doj
JOIN v$locked_object vlo ON doj.object_id = vlo.object_id 
JOIN v$session vs ON vs.sid = vlo.session_id
The above query will fecth the objects that are locked.


Friday, November 8, 2024

Informatica domain Certificate Installation process

Informatica requires SSL certificate from 10.2 to enables secure communication between client and server machines.

1. Download the certificate in pfx (PKCS12) format from your organisation portal if trust chain is issued by org or create trust chain.

Import the certificate 

keytool -importkeystore -srcstoretype JKS -srckeystore privatecertificate.pfx 
-deststoretype PKCS12 -destkeystore infa_keystore.pkcs12

2. convert pfx to pem format

openssl pkcs12-in infa_keystore.pkcs12 -nodes -out infa_keystore.pem

3. convert pkcs12 to jks

keytool -importkeystore -srcstoretype PKCS12 -srckeystore infa_keystore.pkcs12
-deststoretype PKCS12 -destkeystore infa_keystore.jks

4. Import the root certificate into infa_truststore.jks. Below command will create theinfa_truststore.jks. file with root inside it . Trust the certififcate with yes when it is prompted.

keytool -import -alias root -keystore infa_truststore.jks -trustcerts -file "Root.crt"

5. Import the intermediate certificate into infa_truststore.jks. Below command will create theinfa_truststore.jks. file with root inside it . Trust the certififcate with yes when it is prompted.


keytool -import -alias root -keystore infa_truststore.jks -trustcerts -file "Intermediate.crt"

6.Import the public certificate into infa_truststore.jks. Below command will create theinfa_truststore.jks. file with root inside it . Trust the certififcate with yes when it is prompted.

keytool -import -alias root -keystore infa_truststore.jks -trustcerts -file "Cert.crt"

7. convert jks into pkcs12 format

keytool -importkeystore -srcstoretype JKS -srckeystore infa_truststore.jks
-deststoretype PKCS12 -destkeystore infa_truststore.pkcs12

7. convert pkcs12 into pem format

openssl pkcs12 -in infa_truststore.pkcs12 -nodes -out infa_truststore.pem


We have keystore and trust store in jks and pem format. We can use these trust chain for admin console and SSL connections.

to avoid confusion for domain and admin cosole keystore. We will copy the infa keystore to default keystore.

8. Copy infa keystore to default keystore.

cp infa_truststore.jks default.keystore


9. Copy these certificates into informatica default path which is below path.

cp   infa_*  $INFA_HOME/services/shared/

10. Go to ISP config and nodemeta.xml

cd $INFA_HOME/isp/config

cat nodemeta.xml | grep https

11. Shutdown the domain. Verify that no process running before proceed further step

./stopinfa.sh stop  

12. Get the https port and setup the node with the https port using infa setup command.

cd $INFA_HOME/isp/bin

./infasetup.sh updategatewaynode -dn Domain_ISP -hs httpsportnumber -kf keystorefile -kp keystorepassword -nk pathofthekeystore -nkp truststorefilepassword -nt truststore -ntp trusstorepassword

then run the default path also

./infasetup.sh updategatewaynode -hs httpsportnumber -kf defaultkeystorefile  -kp password


13. start the services

./startinfa.sh start

14. To check whether services are running fine

cd $INFA_HOME/logs/node

tail -50f catalina.out


15. Check all init methods called successfully  from cataline.out file.

Verify admin console running fine by using the file node.log

tail -50f node.log

16. Copy these truststore files into client machine and place in Informatica installed directory/shared and connect from client machine..