Custom Search

Thursday, February 18, 2016

dnsmasq resolv.conf location

1)
$ sudo cat /var/run/dnsmasq/resolv.conf

nameserver 10.110.192.130

2)
$sudo cat /etc/dnsmasq.conf | grep ^[^#]

conf-dir=/etc/dnsmasq.d

3)
$ sudo cat /etc/dnsmasq.d/10-consul

server=/consul/127.0.0.1#8600








4)

Monday, February 8, 2016

neutron update quota


$openstack quota show a59965cc3e104fdeb6940712346


$neutron quota-update --floatingip 5 --tenant-id a59965cc3e104fdeb6940712346



Sunday, February 7, 2016

Sequence Diagram Editor sdedit

1)
http://sdedit.sourceforge.net/example/index.html

2)
Download
http://sourceforge.net/projects/sdedit/files/
http://liquidtelecom.dl.sourceforge.net/project/sdedit/sdedit/4.2/sdedit-4.2-beta1.jar

3)
Run
$java -jar sdedit-4.2-beta1.jar




Thursday, February 4, 2016

How to find certificate from a server


$ openssl  s_client -connect my.myservices.com:8774

OR

$openssl s_client -showcerts -connect my.myservices.com:8774 | openssl x509 > tempfile.txt


How to keystone v3 create project user and role

$openstack project create saju_project

$openstack user create saju

$openstack user set --password saju saju

$openstack role list

$openstack role add --project d633b3ca12ac48bcb3383d0edd05109f --user 823ecb2e783c48b6bd8ea022ace605eb Member

SSL exception connecting to https://keystoneservice.com:35357/v3/auth/tokens: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

SSL exception connecting to https://keystoneservice.com:35357/v3/auth/tokens: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

SSL exception connecting to https://keystoneservice.com:35357/v3/auth/tokens: [Errno 185090050] _ssl.c:344: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib

1)
Add new certificate to your ubuntu system:
a)
Remove old certificate
$sudo rm /usr/local/share/ca-certificates/selfsigned.cr

b)
Download new certificate
$sudo wget http://share/mycertificate.crt

OR
How to find certificate from a server
http://fosshelp.blogspot.in/2016/02/how-to-find-certificate-from-server.html

c)
Update new certificate
$sudo cp mycertificate.crt /usr/local/share/ca-certificates/selfsigned.crt
$sudo update-ca-certificates

d)
Optional:
If you have multiple *.crt files

* First download all *.crt files
* Then append its content to a "temp.crt" file
$cat mycert1.crt >>  temp.crt
$cat mycer2.crt >>  temp.crt

* Then copy that "temp.crt" file to  "/usr/local/share/ca-certificates/selfsigned.crt"
$sudo cp temp.crt /usr/local/share/ca-certificates/selfsigned.crt

*Then run
$sudo update-ca-certificates

2)
If you are using Python virtualenv, the copy this certificate to python "requests" module path.
$cp /usr/local/share/ca-certificates/selfsigned.crt myvenv/local/lib/python2.7/site-packages/requests/cacert.pem

* For more details check myvenv/local/lib/python2.7/site-packages/requests/certs.py

3)
Testing
a)
$source myvenv/bin/activate

b)
$python
>>import request
>>request.get(http://testsite.com)

Wednesday, February 3, 2016

How to search in log files

1)
Search in all log files under /var/log/contrail

$for x in $(sudo ls /var/log/contrail); do sudo cat /var/log/contrail/$x | grep "Search me"; done

OR

$sudo find /var/log/contrail -type f -exec grep 'Search me' {} \;

a)
Find file name
$sudo find /var/log/contrail -type f -exec grep -l 'Search me' {} \;

b)
Find line number
$sudo find /var/log/contrail -type f -exec grep -n 'Search me' {} \;

2)
Find all log files which are updated within last 2 minutes, then search for a pattern

$for x in $(sudo find /var/log/contrail *.log -mmin -2); do sudo cat $x | grep "Search me"; done

3)
Find all log files which are updated within last 2 minutes, then search for a pattern in las 100 lines

$for x in $(sudo find /var/log/contrail *.log -mmin -2); do sudo tail -n 100 $x | grep "Search me"; done

4)
How to read portion of huge file (from line number to line number)

$Y=359975 --- From line number
$X=359880 --- To line number
$tail -n +$X /var/log/contrail/contrail-api-0-stdout.log.10 | head -n $((Y-X+1))

5)







fatal: unable to access 'https://github.com Failed to connect to github.com port 443: Connection refused

How to fix if you are behind a proxy

$git config --list

$git config --global http.proxy http://10.160.192.110:3128

$git config --list