Monday, October 2, 2017

Export / Import Putty All Settings :


Open cmd.exe (Command prompt). Execute below command in command prompt
regedit /e "%USERPROFILE%\Desktop\putty.reg" HKEY_CURRENT_USER\Software\SimonTatham

In Desktop you will see putty.reg (Exported)

To Import putty settings
Double-click on the *.reg file and accept the import.

Or from command prompt execute below command : 
regedit /i putty.reg

Thursday, September 21, 2017

Apache Configuration with Proxy in RHEL 7 / CentOS 7

Apache Web Server (httpd) in RHEL and CentOS are similar.

$ yum install httpd mod_proxy mod_ssl mod_proxy_html mod_rewrite  -y

httpd : httpd daemon install http server (web) apache
mod_proxy : This library usually comes by default. This helps for proxy setup (Forward / reverse) 
mod_ssl : This library helps for HTTPS connection support in mod_proxy (proxy) to do for HTTPS as well
mod_proxy_html : This library supports for rewrite rule to support html, images and other content loading in apache
mod_rewrite : This library helps for rewrite rule in apache configuration.

$ grep 'mod_proxy' /etc/httpd/conf.modules.d/00-proxy.conf

Above command will show you already the mod proxy libaries loaded (LoadModule) in apache (httpd) and in the same configuration you will see for ssl (LoadModule configuration) in different *.conf

In order for apache to achieve forward and reverse proxy create below configuration. 

Create reverse-proxy.conf file or your own file naming file and have the below configuration.

$ vi /etc/httpd/conf.d/reverse-proxy.conf

        # Below fields helps on forward proxy request and proxy time out
        ProxyRequests On
        ProxyVia On
        ProxyTimeout 60
# Below field helps to turn on HTTPS configurations (reverse / forward)
        SSLProxyEngine On

# Proxy servers permissions
       
                Require all granted
       

# Specify Forward proxy remote servers
        ProxyRemote "http" "http://proxy.ebiz.abccompany.com:80"
        ProxyRemote "https" "http://proxy.ebiz.abccompany.com:80"
# Specify no proxy servers
        NoProxy ".abccompany.com"

# Reverse proxy urls and connectiontimeout happens when there is no response from the url
        ProxyPass /foo http://www.webreference.com/html/tutorial2/2.html connectiontimeout=5
        ProxyPassReverse /foo http://www.webreference.com/html/tutorial2/2.html

        ProxyPass /bar https://vzweb2.abccompany.com connectiontimeout=5
        ProxyPassReverse /bar https://vzweb2.abccompany.com

        ProxyPass /geek https://www.ssllabs.com/ connectiontimeout=5
        ProxyPassReverse /geek https://www.ssllabs.com/


Restart 'service httpd restart' after configuration changes. 

You can add environment variables in file '/etc/sysconfig/httpd' if required.

Test it with :        curl http://localhost/foo

Best Article to know about forward-reverse proxy :
https://geekpeek.net/forward-reverse-apache-proxy-centos/ (The best forward and reverse proxy)

Reverse proxy well explained video link : https://www.youtube.com/watch?v=MQMIhAbPzb4

Saturday, July 22, 2017

AWS Tutorial: How to quickly set up an SSL certificate for use with Amazon Web Services ELB


View Java keystore information with "keytool list"
keytool -list -v -keystore privateKey.store

keytool executable comes in JDK/bin. You must configure $JAVA_HOME/bin in $PATH to use the command. Check the CN (CommonName) 

Article about Certificates Extensions and Encodings : http://info.ssl.com/article.aspx?id=12149

PKCS7 Decoder

Installing a SSL certificate on Amazon Web Services (AWS)

Use AWS Certificate Manager to upload SSL certificate (Import).
Certificate body : Provide the public certificate (PEM) provided by ssl team by converting .cer to pem
Certificate private key : Provide the private key (PEM) you used to generate CSR file
Certificate Chain : Provide the intermediate and Root certificate (PEM)

In order to verify the healthy of the file and port in https://

In order to verify the healthy of the file and port in http://

You also need to create keystore file and drop in tomcat 8443 port by combining keys.

Wednesday, July 19, 2017

Step by step instructions on self-signed certificate and configure Tomcat over SSL

Note : If you create self signed certificate from openssl then create keystore file also using openssl

1.1 Create a pair of PKI keys

openssl genrsa -out public-dns-name-private.pem 2048

Create a self-signed X509 certificate:

openssl req -new -x509 -key public-dns-name-private.pem -out public-dns-name-certificate.pem -days 365

Create a PKCS12 keystore and import (or export depending on how you look at it) the host certificate we just created:

openssl pkcs12 -export -out humkeystore.pkcs12 -in public-dns-name-certificate.pem -inkey public-dns-name-private.pem

2.2 Convert the PKCS12 keystore to Java keystore using Java keytool.

keytool -importkeystore -srckeystore humkeystore.pkcs12 -srcstoretype PKCS12 -destkeystore humkeystore -deststoretype JKS

Update Tomcat : In $CATALINA_HOME/CONF/server.xml


In Amazon Alexa Skill : "I will upload a self-signed certificate in X.509 format" open generated x509 certificate file and provide content : public-dns-name-certificate.pem


AWS Account Migration - Steps for some of the services to migrate from one AWS Account to other

1) Login into AWS account and go to BillingDashboard and find out list of services used.  

Note : There will be charge either 0$ or x$ for used services.

2) Go to VPC dashboard and understand VPC (custom), ElasticIps, Security Group, subnets and create the same in another account (target account you want to migrate)



Note : Only manual snapshot backup can be shared and restored.


Note : aws s3 sync s3://sourceBucket  s3://DestinationBucket  --profile AccountAAdmin --profile AccountBAdmin 
Please make sure the destinationBucket name is different as its unique. Sometimes we try to provide same assuming copy. 



6) ELB : Create LoadBalancer target Group and other details in new account from the existing account. 

7) Lambda, Lex, elasticBeanStack you need to configure the same in new account and copy the code from the old aws account.

Wednesday, February 22, 2017

Amazon - Alexa - Tips to start your own Skill Kit

Why Alexa ?

Alexa, the voice service that powers Echo, provides capabilities, or skills, that enable customers to interact with devices in a more intuitive way using voice. (Coolest IoT as well to integrate with lights and thermostat control through Amazon Echo)

Examples of these skills include the ability to play music, answer general questions, set an alarm or timer and more. Alexa is built in the cloud, so it is always getting smarter.

Official Amazon Pages about
Alexa : https://developer.amazon.com/alexa
Alexa Skill Kit : https://developer.amazon.com/alexa-skills-kit

Alexa Skill Kit (ASK) develop in an hour quick tour to get your hands dirty (JS) - Note : Alexa Skill Interaction Model creation was not updating in IE. Better use firefox / chrome.
6 Steps to build first Alexa Skill : https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/content/fact-skill-1

Steps Detailed to develop : https://developer.amazon.com/blogs/post/Tx3DVGG0K0TPUGQ/New-Alexa-Skills-Kit-Template:-Step-by-Step-Guide-to-Build-a-Fact-Skill

Alexa Skill kit Samples : https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/using-the-alexa-skills-kit-samples

Alexa Web Browser Testing tool (Works only in webRTC (RTC-RealTimeCommunication Browser)) : https://echosim.io/welcome?next=%2F

Alexa Skill Kit (ASK) forum : https://forums.developer.amazon.com/spaces/23/index.html

ASK Certification Requirements for Custom Skills : https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-submission-checklist

ASK custom skill using Web-Service - https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/deploying-a-sample-skill-as-a-web-service

Amazon 10 Minutes tutorial (Try tutorials in AWS) - https://aws.amazon.com/getting-started/tutorials/

Social Pages (YouTube) about Alexa to watch and learn :

ASK 101 by Amazon Developer : https://www.youtube.com/watch?v=31K4vse9Jmc

ASK Custom skill easy implementation step in more understandable with intents and slots includes nice examples and github sourceCode reference: https://www.youtube.com/watch?v=zt9WdE5kR6g&t=1s

Developing Alexa Skill (Explained in 1 to 6 chapter in more detail) : https://www.youtube.com/watch?v=QxgdPI1B7rg&list=PL2KJmkHeYQTO6ci5KF08mvHYdAZu2jgkJ


Find your icon for your custom app : https://www.iconfinder.com/icons/10930/badge_reddit_icon#size=128

In MSPaint open the image 512 and click -> re-size and re-size the image to size you need.

Client / Server Authentication using openssl

Steps to Create CSR (Certificate Signing Request) using OpenSSL and create JKS file to interact with Server

What is client authentication?
Client Authentication is the process by which users securely access a server or remote computer by exchanging a Digital Certificate.

#To create CSR and Private Key
openssl req -new -newkey rsa:2048 -nodes -out star_yourdomainname_com.csr -keyout star_yourdomainname_com.key -subj "/C=US/ST=New Jersey/L=Bedminster/O=Organization Name/OU=Organization Unit/CN=*.yourdomainname.com"

# Combine private key and public key file received from 3rd party
cat star_yourdomainname_com.key star_yourdomainname_com.pem_SIGNED.pem > projectName.pem

# Generate pkcs12 file from private + public key file
openssl pkcs12 -export -in projectName.pem -out projectNamekeystore.pkcs12 -name projectName -noiter -nomaciter

# Create jks File from pkcs12 file generated
keytool -importkeystore -srckeystore projectNamekeystore.pkcs12 -srcstoretype pkcs12 -srcalias projectName -destkeystore projectNameKeyStore.jks -deststoretype jks -deststorepass pass@123 -destalias projectName

# To list the keystore stored
keytool -v -list -keystore keystore

Write Java program using HttpClient to test this JKS file and Get / Post the data from 3rd party server

Curl : Through curl also same works and testing can be done

# Combine private key and public key file received from 3rd party
cat star_yourdomainname_com.key star_yourdomainname_com.pem_SIGNED.pem > projectName.pem

Curl Command :
curl -k -vvvv --request GET -H "Accept: application/json" -H "Content-Type: application/json" -a --cert projectName.pem "https://thirdpartydomainname.com/WebGateway/rest/Location/query/location?userId=1234"
// Below script tag for SyntaxHighLighter