<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text" xml:lang="en">Guillermo Garron Linux posts</title>
    <link type="application/atom+xml" href="http://garron.me/linux/atom.xml" rel="self"/>
    <link type="text" href="http://garron.me" rel="alternate"/>
    <updated>2012-01-18T11:32:14-04:00</updated>
    <id>http://garron.me</id>
    <author>
        <name>Guillermo Garron</name>
    </author>
    <rights>Copyright (c) 2010-2011 Guillermo Garron</rights>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <entry>
        <title>Convert PDF files to JPG using imagemagick</title>
        <link href="http://garron.me/linux/convert-pdf-to-jpg.html"/>
        <updated>2012-01-12T16:10:00-04:00</updated>
        <id>http://garron.me/linux/convert-pdf-to-jpg.html</id>
        <summary type="html">&lt;p&gt;A friend of mine called me today telling me he had to open a file that ended in PDF, but he was not able, I guided him to install Adobe reader on his Windows XP computer, but it was not easy as I was not watching the same screens he was, so I preferred to convert his PDF to JPG.&lt;/p&gt;

&lt;p&gt;He sent me the file via email, and with this simple line on my Arch Linux computer I converted the three pages PDF file into three JPG files.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;convert -density 300 file.pdf file.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You will have to install imagemagick first on you system, in Arch Linux was as simple as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pacman -S imagemagick
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I'll visit my friend this weekend to install Adobe PDF readers in his computer.&lt;/p&gt;
</summary>
    </entry>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <entry>
        <title>How to create a VPN using OpenVPN and Linux</title>
        <link href="http://garron.me/linux/openvpn-server-client-linux-how-to.html"/>
        <updated>2012-01-07T09:33:00-04:00</updated>
        <id>http://garron.me/linux/openvpn-server-client-linux-how-to.html</id>
        <summary type="html">&lt;p&gt;Today I'll write about OpenVPN, and how to establish a VPN between two computers.&lt;/p&gt;

&lt;h2&gt;The scenario&lt;/h2&gt;

&lt;p&gt;There are two offices.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The headquarters&lt;/li&gt;
&lt;li&gt;The branch office&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In this scenario the administrator wants all traffic of the branch office to be routed via the headquarters Internet router.  This can be desirable for example if you have your branch office in a country where you suspect the Internet provider or the government may be sniffing your traffic, or just because you want to have full control of the pages and sites the workers at the branch office can access.&lt;/p&gt;

&lt;p&gt;In this scenario, we'll establish the VPN over the Internet, so both the headquarters and the branch office should have their own access to Internet.&lt;/p&gt;

&lt;p&gt;*Server info - At headquarters - *&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux distribution: Arch Linux&lt;/li&gt;
&lt;li&gt;Public IP: 12.34.56.78&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;*Client info - At the branch office - *&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux distribution: Arch Linux&lt;/li&gt;
&lt;li&gt;Public IP: 23.45.67.89&lt;/li&gt;
&lt;li&gt;Private IP range: 10.1.0.0 / 255.255.0.0&lt;/li&gt;
&lt;li&gt;Private IP: 10.1.1.1&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;Server Configuration&lt;/h2&gt;

&lt;p&gt;First we will install all needed software.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pacman -S openvpn openssl
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we need to create the server and client certificates, so the VPN can be encrypted.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd /usr/share/openvpn/easy-rsa/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then set the variables:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;vim vars
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Be sure to locate and set this values, here are the defaults, change accordingly.&lt;/p&gt;

&lt;pre&gt;
export KEY_COUNTRY=&quot;US&quot;
export KEY_PROVINCE=&quot;CA&quot;
export KEY_CITY=&quot;SanFrancisco&quot;
export KEY_ORG=&quot;Fort-Funston&quot;
export KEY_EMAIL=&quot;me@myhost.mydomain&quot;
export KEY_EMAIL=mail@host.domain
export KEY_CN=changeme
export KEY_NAME=changeme
export KEY_OU=changeme
export PKCS11_MODULE_PATH=changeme
export PKCS11_PIN=1234
&lt;/pre&gt;


&lt;p&gt;Now run these commands&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;. ./vars
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./clean-all
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;then&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./build-ca
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;follow the instructions, and once finished create the server key&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./build-key server
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once again, follow the instructions and create the client key&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./build-key client1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally run:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./build-dh
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now copy the the needed files to where the server is going to look for them:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cp ca.crt /etc/openvpn/

cp server.crt /etc/openvpn/

cp dh1024.pem /etc/openvpn/

cp server.key /etc/openvpn/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, let's create the &lt;code&gt;/etc/openvpn/server.conf&lt;/code&gt; file, here is an example:&lt;/p&gt;

&lt;pre&gt;
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-config-dir ccd
route 10.1.0.0 255.255.0.0
push &quot;redirect-gateway def1&quot;
keepalive 10 120
# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
;cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 3
mute 20
&lt;/pre&gt;


&lt;p&gt;This is a very simple example, you may want to check the example file and read the comments, it may be found at: &lt;code&gt;/usr/share/openvpn/examples/server.conf&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;Configure the client&lt;/h2&gt;

&lt;p&gt;The client configuration, starts by copying the key and other files from the server. &lt;code&gt;ca.crt&lt;/code&gt;, &lt;code&gt;client1.crt&lt;/code&gt; and &lt;code&gt;client1.key&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And finally create the configuration file, here is an example:&lt;/p&gt;

&lt;pre&gt;
client

dev tun

proto udp

remote 23.45.67.89 1194
resolv-retry infinite

nobind

user nobody
group nobody

persist-key
persist-tun

ca ca.crt # Use full paths
cert home.crt # Use full paths
key home.key # Use full paths
comp-lzo
verb 3

mute 20
&lt;/pre&gt;


&lt;h2&gt;Start the VPN&lt;/h2&gt;

&lt;p&gt;First start the server side:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;openvpn /etc/openvpn/server.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then the client side:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;openvpn /etc/openvpn/client.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If everything was OK, you should have the vpn up and working.&lt;/p&gt;
</summary>
    </entry>
    
    
    
    <entry>
        <title>Find out what is the model of your video card in Linux</title>
        <link href="http://garron.me/linux/find-out-the-model-video-card-linux.html"/>
        <updated>2012-01-07T08:30:00-04:00</updated>
        <id>http://garron.me/linux/find-out-the-model-video-card-linux.html</id>
        <summary type="html">&lt;p&gt;This happens to me every time I want to install a new distribution of Linux in my Desktop PC, I just can't remember what is the model of my video card so I can install the correct drivers. Fortunately Linux has enough tools to help you, and this time the tool is &lt;code&gt;lspci&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let's see how simple it is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;lspci | grep VGA
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And you will get an output like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;00:02.0 VGA compatible controller: Intel Corporation 82865G Integrated Graphics Controller (rev 02)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That was simple and easy.&lt;/p&gt;
</summary>
    </entry>
    
    
    
    
    
    <entry>
        <title>Nginx, Logrotate and Gentoo: Infinite loop problem and solution</title>
        <link href="http://garron.me/linux/Nginx-logrotate-infinite-loop-problems.html"/>
        <updated>2011-12-25T18:03:00-04:00</updated>
        <id>http://garron.me/linux/Nginx-logrotate-infinite-loop-problems.html</id>
        <summary type="html">&lt;p&gt;Today I've found that my CPU was throttling at 100%. The culprit was &lt;code&gt;logrotate&lt;/code&gt;, or at least that was what I thought when I took a look at &lt;a href=&quot;http://www.go2linux.org/htop-linux-command-line-to-monitor-linux-systems&quot;&gt;htop&lt;/a&gt; and saw that &lt;code&gt;logrotate&lt;/code&gt; had been running at 100% for 10 hours straight.&lt;/p&gt;

&lt;p&gt;I then used &lt;a href=&quot;http://www.go2linux.org/how-to-list-files-directories-in-size-order&quot;&gt;du&lt;/a&gt;, in the &lt;code&gt;/var/log/&lt;/code&gt; folder to find which was the folder that was so big to have logrotate so busy, it happened to be &lt;code&gt;nginx&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After reading the configuration files, I found the problem. In the file &lt;code&gt;/etc/logrotate.d/nginx&lt;/code&gt; that was the default installed by Nginx I could see this contents:&lt;/p&gt;

&lt;pre&gt;
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.logrotate,v 1.2 2011/04/08 08:32:20 hollow Exp $

/var/log/nginx/* {
    missingok
    sharedscripts
    postrotate
        test -r /var/run/nginx.pid &amp;&amp; kill -USR1 `cat /var/run/nginx.pid`
    endscript
}

&lt;/pre&gt;


&lt;p&gt;Now, the problem was in this line &lt;em&gt;/var/log/nginx/*&lt;/em&gt; that was causing that all files enter into the rotation routine, even the already rotated ones, and after some months running there were enough files there to send my CPU to throttle to 100% use.&lt;/p&gt;

&lt;p&gt;I have changed that line to: &lt;code&gt;/var/log/nginx/*.log&lt;/code&gt; and in the &lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt; file I made sure that all log files have a &lt;code&gt;.log&lt;/code&gt; in the end.&lt;/p&gt;

&lt;p&gt;Hope this may help someone sometime.&lt;/p&gt;
</summary>
    </entry>
    
    
    
    
    
    
    
    <entry>
        <title>4 Reasons to Have Live Linux at Home</title>
        <link href="http://garron.me/linux/4-reasons-to-have-linux-live-cd-home.html"/>
        <updated>2011-10-10T23:30:00-04:00</updated>
        <id>http://garron.me/linux/4-reasons-to-have-linux-live-cd-home.html</id>
        <summary type="html">&lt;h2&gt;4 reasons to have Live Linux at home&lt;/h2&gt;

&lt;p&gt;Linux became real part of our lives. You can meet anywhere... in your appliances, mobile phones, internet servers, desktops and laptops.&lt;/p&gt;


&lt;p&gt;In most cases this is either &quot;embedded&quot; or &quot;installed&quot; version of Linux. But there is another type of Linux operating systems which you should also consider. And I recommend you to have at least one at home... Why?&lt;/p&gt;


&lt;p&gt;Live Linux is operating system which can be booted directly from removable media: CD, DVD or USB stick. It does not require installation. In most cases it only uses RAM to store all the data, not touching hard disk of your computer.&lt;/p&gt;


&lt;p&gt;Pioneer of Live Linux was &lt;a href=&quot;http://www.knoppix.org/&quot;&gt;Knoppix&lt;/a&gt;. This is Live distribution created by Klaus Knopper back in 2000. It is based on Debian distribution and features lots of different applications which can help you in your computer life. Since Knopper has shown the way, lots of other distributions followed the lead.&lt;/p&gt;


&lt;p&gt;How can you use Live Linux at your own computer?&lt;/p&gt;


&lt;ol&gt;&lt;li&gt;Distro hopping when old distro gets out of its way.&lt;/li&gt;
&lt;p&gt;Yes, sad but true Linux distributions sometimes change the direction of their development, and new version is not something you would like to stick to. Remember Ubuntu with Unity, Fedora with GNOME 3. Even if you are happy with current distribution, sometimes it is stopped in development and even security patches are no longer available. Inevitably, the best choice is to switch distro. But which one to choose? There are hundreds of them, if you look at &lt;a href=&quot;http://distrowatch.com/&quot;&gt;distrowatch.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Live Linux can be real help here! You can download and burn ISO image to CD or DVD, or &lt;a href=&quot;http://linuxblog.darkduck.com/2011/06/different-methods-to-create-live-usb.html&quot;&gt;create Live USB&lt;/a&gt;. Then you can run new Linux distribution without installation. This will let you feel the flavour, get your hands just a little bit dirty with configuration and so on. Of course, in most cases all your changes will be gone after reboot, but that is enough for quick distro hopping.&lt;/p&gt;
&lt;li&gt;Fall-back solution if something has gone wrong.&lt;/li&gt;
&lt;p&gt;Your computer goes mad. Or... crash-boom-bang and there is an issue with hard disk. In other words, your beloved computer does not want to boot from hard disk. Operating system has failed.&lt;/p&gt;
&lt;p&gt;Live Linux can help you to save your data. You can still boot your computer without touching hard drive, and then try to mount partitions. If you are lucky, you should be able to copy important data to external media and thus save it from destruction.&lt;/p&gt;
&lt;p&gt;When data are saved, you can think what to do with your failed OS and hard drive: scrap, put it on the wall in the frame, or just attempt to re-install the OS. Of course, this should be Linux this time!&lt;/p&gt;
&lt;li&gt;Secure financial transactions.&lt;/li&gt;
&lt;p&gt;Are you obsessed with privacy and security? You don't like your personal and financial data to be stored on computer which is always on-line?&lt;/p&gt;
&lt;p&gt;True. It is very difficult to steal personal or financial data if their media is disconnected from network, or even electricity.&lt;/p&gt;
&lt;p&gt;Live Linux can help you here too. Create Live USB with &lt;a href=&quot;http://www.slax.org/&quot;&gt;SLAX&lt;/a&gt;, &lt;a href=&quot;http://porteus.org/&quot;&gt;Porteus&lt;/a&gt;, &lt;a href=&quot;http://www.puppylinux.com/&quot;&gt;Puppy&lt;/a&gt; or any similar Linux distribution which can store &quot;persistence&quot; file on the media, preferrably USB. Create your own environment with all the necessary browsers, patches, bookmarks and so on. Then, lock the USB with all the configuration you like. Either physically (there are some USB sticks to allow this) or via default boot parameters.Now you can boot into this Live Linux when you need to logon to internet bank, make some financial transaction or make some other operations with sensitive data. Log off and disconnect media immediately after. This should minimise security risks.&lt;/p&gt;
&lt;li&gt;One-off tasks.&lt;/li&gt;
&lt;p&gt;There are different Linux distributions designed for specific tasks, like multimedia (&lt;a href=&quot;http://dynebolic.org/&quot;&gt;DyneBolic&lt;/a&gt;, &lt;a href=&quot;http://puredyne.org/&quot;&gt;PureDyne&lt;/a&gt;, &lt;a href=&quot;http://www.musix.org.ar/en/&quot;&gt;Musix&lt;/a&gt;), security (&lt;a href=&quot;http://www.backtrack-linux.org/&quot;&gt;BackTrack&lt;/a&gt;, &lt;a href=&quot;http://www.caine-live.net/&quot;&gt;Caine&lt;/a&gt;) and so on. You may wish to install all the necessary software for your permanent Operating System. But if you don't want to clutter it, why not use Live Linux where all the necessary programs are gathered in one place? Boot it, do what you need, disconnect and forget.&lt;/p&gt;
&lt;/ol&gt;


&lt;p&gt;As you can see, Live Linux can be very helpful in many cases. Do you think of any more? Or maybe you have your own experience of using Live Linux?&lt;/p&gt;




&lt;p&gt;&lt;span style=&quot;background-color: #efefef;&quot;&gt;DarkDuck is author and owner of blog &lt;a href=&quot;http://linuxblog.darkduck.com/&quot;&gt;Linux Notes from DarkDuck&lt;/a&gt; and site &lt;a href=&quot;http://www.buylinuxcds.co.uk/&quot;&gt;Buy Linux CDs&lt;/a&gt;, where you can read more about different Linux operating systems and then order CDs with your favourite distribution.&lt;/span&gt;&lt;/p&gt;



</summary>
    </entry>
    
    
</feed>