Sphoorti JoglekarJekyll2017-07-09T01:15:42+00:00http://sphoorti.github.io/Sphoorti Joglekarhttp://sphoorti.github.io/sphoorti.joglekar@gmail.comhttp://sphoorti.github.io/blog/moVirt_32015-02-21T12:08:50+00:002015-02-21T12:08:50+00:00Sphoorti Joglekarhttp://sphoorti.github.iosphoorti.joglekar@gmail.com
<h3 id="installing-cacert-certificates-as">Installing CAcert certificates as</h3>
<ul>
<li>
<p><strong>‘user-trusted’ certificates</strong> is very easy, however, it has one limitation. Use of ‘User-trusted’ certificates forces the user to implement additional safety measures like using a PIN-code or pattern lock or a password to unlock the device.</p>
</li>
<li>
<p><strong>‘system-trusted ‘ certificates</strong> is slightly tedious. The user needs to have root access to the android device. But with this approach, the user can get rid of the lockscreen requirement.</p>
</li>
</ul>
<h3 id="on-the-android-device">On the Android device</h3>
<ul>
<li>
<p><strong>‘user-trusted’ certificates</strong> - are found in <strong>Settings -> Security -> Certificates -> ‘User’</strong> section. Using a file manager, you can find them at ‘/data/misc/keychain/certs-added’ as read-only files.</p>
</li>
<li>
<p><strong>‘system-trusted ‘ certificates</strong> - are found in <strong>Settings -> Security -> Certificates -> ‘System’</strong> section. Using a file manager, you can find them at ‘/system/etc/security/’ as files with read-only format.</p>
</li>
</ul>
<h3 id="user-trusted-certificate">‘user-trusted’ certificate:</h3>
<ol>
<li><strong>root.crt</strong> and <strong>class3.crt</strong>. Download them onto the internal flash storage ( /sdcard/ folder ).</li>
<li>Browse to the directory using a file manager and click on the root.crt.The file will be opened by the Certificate Manager and prompt you for the name of the newly imported certificate.</li>
<li>At this juncture, the Android Security Model will propmt you to use a lock-screen mechanism if it is the first time that you are using a’user-trusted’ certificate.</li>
<li>Once the root.crt is installed, follow the same steps for class3.crt.</li>
<li>Confirm that both the certicates are successfully installed on your device.</li>
<li>Reboot your device.</li>
</ol>
<h3 id="system-trusted-certificate">‘system-trusted’ certificate:</h3>
<ol>
<li>Apart from overcoming the limitation of a lock-screen, ‘system-trusted’ certificates help you protect your device from tampering by malicious applications.</li>
<li>A rooted android device or temporary root access to your device and a system with openssl software installed on it.</li>
<li>Get the CAcert root certificates from the <a href="https://www.cacert.org/index.php?id=3"> cacert.org website.</a> Download the root certificate PEM format (root.crt) and the Class 3 PKI key in PEM format (class3.crt)</li>
<li>
<p>Get the hash of the root.crt certificate:</p>
<div class="highlighter-rouge"><pre class="highlight"><code> openssl x509 -inform PEM -subject_ hash_ old -in root.crt | head -1
cat root.crt > <i>hashValue</i>.0
openssl x509 -inform PEM -text -in root.crt -out /dev/null >> <i>hashValue</i>.0
</code></pre>
</div>
</li>
<li>Follow the same steps for class3.crt.</li>
<li>Check the md5sum of the newly created Android compatible certificate files using the md5sum command.</li>
<li>
<p>Once done, use adb shell to create the ‘system-trusted’ certificates.</p>
<div class="highlighter-rouge"><pre class="highlight"><code> su
mount -o remount,rw /system
cp /sdcard/<i>hashValue</i>.0 /system/etc/security/cacerts/
cp /sdcard/<i>hashValue</i>.0 /system/etc/security/cacerts/
cd /system/etc/security/cacerts/
chmod 644 5ed36f99.0
chmod 644 e5662767.0
reboot
</code></pre>
</div>
</li>
<li>After reboot, verify that the certificates are successfully installed on your device.</li>
</ol>
<p> If things dont go well in this approach, make sure no user certificates are installed (Settings -> Security -> Clear certificates) and also "Clear/delete credentials" (in Settings -> Security). </p>
<h5 id="note-that-the--subject_-hash_-old-parameter-will-depend-on-the-openssl-software-version">Note that the -subject_ hash_ old parameter will depend on the openssl software version.</h5>
<p>For <strong>Android GingerBread and Froyo</strong> follow this comprehensive guide <a href="http://wiki.cacert.org/FAQ/ImportRootCertAndroidPreICS">Import CAcert root certificate into Android pre-Ice Cream Sandwich</a>.</p>
<p><a href="http://sphoorti.github.io/blog/moVirt_3/">Importing CAcert Certificates in Android.</a> was originally published by Sphoorti Joglekar at <a href="http://sphoorti.github.io">Sphoorti Joglekar</a> on February 21, 2015.</p>
http://sphoorti.github.io/blog/moVirt_22015-01-06T12:08:50+00:002015-01-06T12:08:50+00:00Sphoorti Joglekarhttp://sphoorti.github.iosphoorti.joglekar@gmail.com
<p>A list of shortcuts to get started with Android Studio.</p>
<ol>
<li>
<p><strong>CTRL + Space Bar</strong> - Useful for autocompletion.</p>
</li>
<li>
<p><strong>CTRL + ALT + B</strong> - When the cursor is on class or interface, tells who is implementing / inheriting the class / interface.</p>
</li>
<li>
<p><strong>CTRL + Click</strong> - Takes the cursor to the declaration of the thing that is clicked.</p>
</li>
<li>
<p><strong>CTRL + F12</strong> - Lists the methods defined in the class.</p>
</li>
<li>
<p><strong>CTRL + N</strong> - Opens the class / interface according to the name entered in dialog box. One can write only the subparts of the name in there.</p>
</li>
<li>
<p><strong>CTRL + SHIFT + N</strong> - Opens a <em>resource</em>. The resource could be a .xml file or property file or generated code.</p>
</li>
<li>
<p><strong>SHIFT + SHIFT</strong> - The <em>Search Everywhere</em> option. It literally searches everywhere :D</p>
</li>
<li>
<p><strong>CTRL + ALT + O</strong> - Organize imports. This also removes the imports not used in the class and introduces the ones you need.</p>
</li>
<li>
<p>Highlight some code block and press <strong>CTRL + ALT + L</strong> - Reformats the code.</p>
</li>
</ol>
<p>Following are a couple of shortcuts useful while debugging the code.</p>
<ol>
<li>
<p><strong>CTRL + F8</strong> - Introduce a breakpoint.<br />
The red dot with a down arrow indicates the debugger is connected with the app.</p>
</li>
<li>
<p><strong>F8</strong> - Evaluate and continue debugging.</p>
</li>
<li>
<p><strong>ALT + F8</strong> - Evaluate the expression.</p>
</li>
<li>
<p><strong>F9</strong> - Continue</p>
</li>
<li>
<p><strong>F7</strong> - Step in</p>
</li>
<li>
<p><strong>SHIFT + F8</strong> - Step out</p>
</li>
</ol>
<p>Watch out for this space. I shall keep updating this list with shortcuts that will simplify use of Android Studio.</p>
<p><a href="http://sphoorti.github.io/blog/moVirt_2/">Android Studio 101.</a> was originally published by Sphoorti Joglekar at <a href="http://sphoorti.github.io">Sphoorti Joglekar</a> on January 06, 2015.</p>
http://sphoorti.github.io/blog/moVirt_12014-12-09T12:08:50+00:002014-12-09T12:08:50+00:00Sphoorti Joglekarhttp://sphoorti.github.iosphoorti.joglekar@gmail.com
<p>My journey with moVirt began in the first week of October when I saw oVirt as a mentoring organization on the <a href="http://www.gnome.org/opw/">Gnome OPW</a> page.The moVirt project caught up my interest and I immediately contacted the project mentor Tomas Jelinek asking questions regarding how I should proceed with the application process.A long journey setting the development environment up and creating the first contribution started. Here is how it went</p>
<h4 id="my-opw-project--enhancements-to-movirt">My OPW project:- <em>Enhancements to moVirt.</em></h4>
<p>moVirt is an android application to manage and monitor oVirt’s datacentres.</p>
<h4 id="my-first-contribution-">My first contribution:-</h4>
<p>Since my OPW project is making enhancements to moVirt, I needed the development environment up and running and because there was no description how to do it, I decided that documenting the process of setting it up would be a good first contribution.I had Eclipse Kepler with android SDK installed on my machine, so I imported the cloned project in Eclipse.However, things went a little awry with this development environment.The .apk file on the github repository worked fine for me as against the one generated in my eclipse environment. My mentor asked me to compare both the .apk files. On comparison, we found that the Android Annotations framework was missing and I needed to configure it. Even after setting up the framework, the project would always break. After a discussion with the moVirt devels I decided to try using Android Studio and things worked for me. On deeper analysis, I realized that moVirt is a Gradle project and I hadn’t configured the right environment on Eclipse for it to work. Android Studio being gradle based, makes moVirt development easier.<br />
Once I had the entire development setup functional, I made my <a href="https://github.com/matobet/moVirt/blob/master/README.md">first contribution</a>.</p>
<h4 id="tools-i-learned-about-">Tools I learned about:-</h4>
<ol>
<li><a href="http://www.adventuresofanentrepreneur.net/creating-a-mobile-appsgames-company/how-to-unpack-pack-an-apk-file">APKTool.</a> This tool is used to unpack/pack the apk files.</li>
<li><a href="https://developer.android.com/sdk/installing/index.html?pkg=studio">Android Studio.</a> The development IDE used for moVirt.</li>
<li><a href="it is a live image which contains everything you need to start playing around with oVirt">oVirt_Live.</a> It is a live image which contains everything you need to start playing around with oVirt.</li>
<li><a href="https://git-scm.com/">Git Basics.</a> Helps understanding git better.</li>
</ol>
<h3 id="get-in-touch">Get in Touch</h3>
<p>Contribute to <a href="https://github.com/matobet/movirt">moVirt on github</a><br />
Stay updated with news. Follow <a href="https://twitter.com/mobileOvirt">@mobileOvirt</a> on Twitter.<br />
Find <em>tjelinek</em>, <em>mbetkak</em> or <em>sphoorti</em> on <em>#ovirt</em> on <em>irc.oftc.net</em> and have a chat :)</p>
<p>Looking forward for an amazing OPW experience with Tomas and oVirt community.</p>
<p><a href="http://sphoorti.github.io/blog/moVirt_1/">moVirt, OPW and me.</a> was originally published by Sphoorti Joglekar at <a href="http://sphoorti.github.io">Sphoorti Joglekar</a> on December 09, 2014.</p>
http://sphoorti.github.io/blog/devstack_setup2014-03-29T12:08:50+00:002014-03-29T12:08:50+00:00Sphoorti Joglekarhttp://sphoorti.github.iosphoorti.joglekar@gmail.com
<p>Devstack is an All-In-One shell script widely used by OpenStack-devs to build a complete OpenStack development environment. It is advisable to install DevStack on a
virtual machine and take periodic snapshots of the VM. When things go messy, you can easily revert back to a working snapshot!</p>
<h4 id="prerequisites-">Prerequisites :</h4>
<ol>
<li><a href="https://www.virtualbox.org/wiki/Linux_Downloads">Install VirtualBox</a></li>
<li>Download the <a href="http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/mini.iso">minimal ubuntu iso</a> for Ubuntu 12.04. All other
additional dependencies will be installed during DevStack setup.</li>
<li>Create a new VM having a minimum requirement of 2 GB RAM and 20 GB of storage.</li>
<li>After the VM is successfully created, run the following commands in terminal :-
<ol>
<li>$ sudo apt-get update</li>
<li>$ sudo apt-get install git</li>
</ol>
</li>
</ol>
<h4 id="after-the-initial-setup-its-time-to-install-devstack-">After the initial setup, its time to install DevStack !</h4>
<ol>
<li>Clone the DevStack repository :-$ git clone git://git.openstack.org/openstack-dev/devstack</li>
<li>Switch to the cloned devstack directory :- $ cd devstack</li>
<li>Run the following command :- devstack$ cp /samples/local.conf local.conf</li>
<li>
<p>Open the local.conf file and edit the password fields and add neutron to enabled services</p>
<p>ADMIN_PASSWORD=password<br />
MYSQL_PASSWORD=password<br />
RABBIT_PASSWORD=password<br />
SERVICE_PASSWORD=password<br />
SERVICE_TOKEN=password</p>
<p>disable_service n-net<br />
ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron</p>
</li>
<li>Now run the shell script to setup DevStack development environment. devstack$ ./stack.sh<br />
<em>The script takes a while to complete.</em></li>
</ol>
<h5 id="if-stacksh-fails-with-following-error-">If stack.sh fails with following error :</h5>
<div class="highlighter-rouge"><pre class="highlight"><code>2014-03-28 20:39:57.007 | E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
2014-03-28 20:39:57.009 | E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
2014-03-28 20:39:57.016 | ++ err_trap
2014-03-28 20:39:57.018 | ++ local r=100
2014-03-28 20:39:57.019 | stack.sh failed: full log in /opt/stack/logs/stack.sh.log.2014-03-28-203740
</code></pre>
</div>
<p>This error usually occurs when the ubuntu package manager is running in background. A workaround for this is :- <br />
$ sudo fuser -v /var/lib/dpkg/lock</p>
<h5 id="on-successful-installation-you-ll-be-prompted-to-relevant-urls-accounts-and-passwords">On successful installation, you ll be prompted to relevant URLs, accounts and passwords!</h5>
<h4 id="running-unit-tests-for-neutron-">Running unit tests for neutron :</h4>
<p>The tests folder can be found at /opt/stack/neutron/neutron/. The tests are categorized mainly as :-</p>
<ol>
<li>
<p>Unit Tests - The source code is divided into small modules and each module is tested independently to ensure that the module conforms to its intended behavior.
Mock objects are used to test the modules in isolation.<br />
You could take a look at the <a href="http://python-mock.sourceforge.net/">Python Mock Module</a>.</p>
</li>
<li>
<p>Functional Tests - These tests describe <em>what</em> the software <em>structure</em> actually does by validating the output based on the given input.</p>
</li>
</ol>
<p>The tests can be run using the ./run_tests.sh script or using tox or nose . Tox creates a virtual environment for running the tests cases. It uses <code class="highlighter-rouge">Testr</code>_ for
managing the running of the test cases.</p>
<ol>
<li>
<p>/opt/stack/neutron/$ :- ./run_tests.sh -V<br />
The script runs all the tests from the root source directory.</p>
</li>
<li>
<p>/opt/stack/neutron/$ :- tox -e py27<br />
This runs all the unit tests for python 2.7 version dependencies.</p>
</li>
</ol>
<p>These tests take a lot of time to run!</p>
<h5 id="-individual-tests-can-also-be-run-using-the-following-syntax--em"><em><i> Individual tests can also be run using the following syntax. :-</em></i></em></h5>
<p>./run_tests.sh neutron.tests.unit.test _wsgi</p>
<h5 id="using-tox--">Using tox :-</h5>
<p>tox -e py27 neutron.tests.unit.test_wsgi</p>
<p>The <i>pep8</i> tests can be run using tox as follows:</p>
<p>tox -e pep8 neutron.tests.unit.test_wsgi</p>
<p><a href="http://sphoorti.github.io/blog/devstack_setup/">Setting up DevStack with Neutron</a> was originally published by Sphoorti Joglekar at <a href="http://sphoorti.github.io">Sphoorti Joglekar</a> on March 29, 2014.</p>
http://sphoorti.github.io/blog/BBB_netaccess2014-02-27T12:08:50+00:002014-02-27T12:08:50+00:00Sphoorti Joglekarhttp://sphoorti.github.iosphoorti.joglekar@gmail.com
<p>I had a hard time connecting the BeagleBone Black to the internet while I was working from Fedora 19. The tutorials for other Linux distros were pretty straight forward. After having pondered over it for a day or two I finally managed to access internet from the Black. Special credits to <a href="http://www.linkedin.com/pub/gaurav-jain/1b/125/2b3">Gaurav Jain</a> :D.</p>
<p>So here is what I did,</p>
<p>SSH to your Black using <em>ssh root@192.168.7.2</em>. Once this is done run the following commands from the beaglebone shell.</p>
<ol>
<li>root@beaglebone:/ # /sbin/route add default gw 192.168.7.1</li>
<li>root@beaglebone:/ # echo “nameserver 8.8.8.8” » /etc/resolv.conf</li>
</ol>
<p><strong>On the host Linux Machine except Fedora:</strong></p>
<ol>
<li>
<p>sudo iptables -A POSTROUTING -t nat -j MASQUERADE</p>
<p>This instruction enables the masquerading option allowing any device in the subnet to act on behalf of the host machine.</p>
</li>
<li>
<table>
<tbody>
<tr>
<td>sudo echo 1</td>
<td>sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null</td>
</tr>
</tbody>
</table>
<p>This instruction enables the ipv4 forwarding providing the beaglebone with access to the internet.</p>
</li>
</ol>
<p><strong>On a Fedora machine instead of above two intsructions:</strong></p>
<ol>
<li>
<p>Open Firewall settings.</p>
</li>
<li>
<p>Select zone as public.</p>
</li>
<li>
<p>In the side tab panel select masquerading</p>
</li>
<li>
<p>Enable Masquerade zones.</p>
</li>
</ol>
<p><strong>Switch back to the BeagleBone Black terminal</strong> <br />
root@beaglebone:/ # ping google.com <br />
<em>A successful ping implies beaglebone black now has internet access.</em></p>
<p><strong>Go ahead and update your Black!</strong> <br />
root@beaglebone:/ # opkg update <br />
<em>(opkg is the package manager for the BeagleBone Black.)</em></p>
<p>Also here is one nice tutorial for getting a hands on with the BBB <a href="https://github.com/anujdeshpande/BBB-workshop">BBB-Workshop by Anuj Deshpande</a></p>
<p><a href="http://sphoorti.github.io/blog/BBB_netaccess/"> Connecting the BeagleBone Black to the internet</a> was originally published by Sphoorti Joglekar at <a href="http://sphoorti.github.io">Sphoorti Joglekar</a> on February 27, 2014.</p>