Using cat,ssh and dd to copy ISOs

Hi!
After a long time without posting on the blog here I come again with a tiny command line that can speed up the usual method of copying large amounts of data.

Sometime ago a college gave me a DVD that I would like to keep to myself but that other 2 colleges wanted too. I used dd, cat and ssh for the task. Taking less that 5 minutes to do it all.

First I started the .iso creation with dd:

dd if=/dev/cdrom of=/home/pedro/my_new_iso.iso

In other console you may start the copy of the iso file even if the iso it’s fully copied to the hard drive (just give a few seconds to have some data copied to the drive):

(cat /home/pedro/my_new_iso.iso | ssh user@remote.host.local dd of=~/my_new_iso.iso) ; (cat /home/pedro/my_new_iso.iso | ssh user2@remote2.host.local dd of=~/my_new_iso.iso)

The only thing you need to guarantee is that the first command ends before the second one.
Cheers,
See you all next time

Kde 4.3 – Innovation or just patching?

Recently I upgraded my KDE version 4.2 to the 4.3 and I’ve been using it for a few days now. As said before I don’t mind using betas and do some testing, but as with everything there is an exception, in my case it was KDE, I used the first KDE4 betas and come back to 3.5 then used the 4.1 when it was stable, then 4.2 and tried the beta 4.3… once again came back to the 4.2, now that is stable I’m using version 4.3, and for the first time in KDE4 I can say it’s stable. In my opinion KDE4 was released way to early, and although usable it was needing serious work around it. I’m a Linux user with several years of experience and didn’t have much trouble using it, but for instance my wife would go crazy, so till KDE4.3 she was using KDE3.5.

What changed in this last version of KDE that made me upgrade all my machines to KDE4.3?

The KDE community has fixed over 10,000 bugs.

Implemented almost 2,000 feature requests in the last 6 months.

Close to 63,000 changes were checked in by a little under 700 contributors.

If you want to read more about it just check this link.

All this made KDE4.3 more user friendly, more reliable, more polished and prettier.

So, what more can I say about it? JUST INSTALL IT AND GIVE A TRY you won’t be disappointed.

In conclusion is there innovation or just patching in KDE 4.3? Definitely both, there’s hundreds of new features and even more bug fixes. Both are equally important and KDE really need this ultimate push to be the ultimate Desktop Manger.

Cheers and see you next time

Pedro Oliveira

ps – bellow there are the install instructions and a vid of kde4.3 in action.

If you need help to install it just check the install instructions (from www.kde.org):

Debian KDE 4.3.0 packages are available in the unstable repository.

  • Fedora
    • Rawhide development repository, however the packages there may depend on other Rawhide packages and are therefore not suitable for installation on previous releases.
    • Unofficial Fedora 11/10 packages are hosted at the kde-redhat project.
    • Kubuntu packages are available for 9.04. More details can be found in the announcement on Kubuntu.org.
    • Mandriva provide packages for
2009.0 i586 2009.0 x86_64 2009.0 SRPMS
2009.1 i586 2009.1 x86_64 2009.1 SRPMS

Please refer to README to more information.
For Mandriva Cooker ( development ) users, 4.3.0 is will be available at cooker repositories.

openSUSE packages are available for openSUSE 11.1 (one-click install), for openSUSE 11.0 (one-click install) and for openSUSE 10.3 (one-click install) and openSUSE Factory (one-click install). A KDE Four Live CD with these packages is also available.

Magic Linux KDE 4.3.0 packages are available for Magic Linux 2.5. See the release notes for detailed information and the FTP tree for packages.

QOS – Service with quality using MasterShaper

QOS – “Quality of service” – what a fancy name for somethings that will allow you to manage the available bandwidth for your servers/pcs/equipments. Usually setting up QOS is not “so fancy” to setup and manage. At work I had to setup a QOS for a custumer and didn’t want to be writing rules on my own so I searched a bit and found MasterShaper.

You can read more about it here.

Lets imagine that you want to allow p2p on your network but you don’t want to waste all your bandwidth on that kind of traffic, after all you still need bandwidth for your VOIP, http, and mail traffic.

To setup this I’ll be using CentOS and Mastershaper.

After installing a VMware virtual machine with CentOS (default install with 2 network cards), I’ve setup apache, this time I didn’t use virtualhosts or any other extras as I just wanted to create a single purpose system.

To start I’ve concufigured 2 network interfaces (internal/external)

eth0 192.168.251.249 (external)

eth1 192.168.252.249 (internal)

After downloading MasterShaper decompress it to:

/var/www/html

Install pear and pear modules as described in MasterShapper docs.

And finally create the mysql database to support the installation.

I won’t get into install details (just follow the documentation), but in the end you be able to define schedulers, hosts and services with higher or lower priority and in the end you’ll also be able to monitor all this in a pretty web interface with some graphics.

Just don’t forget to install mysql support in php, and pear, you’ll also have to configure sudo but in the end just read the documentation in mastershaper it’s very good.

Apache2 reverse proxy (with http https virtualhosting)

This weekend I was updating and reconfiguring my apache2 installation, I run a server with multiple domains both with http and https, they are sitting behind a firewall. I also had some tomcat installations running on port 8080 on my server. In my previous configuration in the firewall I had port 80,443 and 8080 forwarded to my apache server and it worked perfectly. but as you know it’s easy to educate users to use both http(port 80) and https(port443) but not that easy to tell them to write https://yourserver:8080/blabla to redirect them to the tomcat server.

Having this I decided to change the way things work but using a reverse proxy this way I can have all the users using just http and https and at the same time redirect the traffic to the t0mcat behind the the firewall.

How did I do it?

First you have to enable the following modules on your apache2 server (I won’t explain how to do it as you can do it multiple ways and even use your distro tools to help you):

proxy_module

proxy_http_module

rewrite_module

I also recommend you to use virtualhosts for doing this as you’ll be able to serve multiple domains with ease:

and edit your virtual host to look like this:

<VirtualHost *:80>
ServerAdmin xxx@yourdomain.com
ServerName www.yourdomain.com
DocumentRoot /srv/www/htdocs
ServerSignature On
DirectoryIndex index.php index.html index.htm
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://your.internalserver.local:8080/
ProxyPassReverse / http://your.internalserver.local:8080/
</virtualhost>
<proxy>
Order deny,allow
Allow from all
</proxy>

or if you are using https your virtualhost config file might look like:

<IfDefine SSL>
<IfDefine !NOSSL>
<VirtualHost *:443>
ServerName www.yourdomain.com
DocumentRoot "/srv/www/htdocs"
ErrorLog /var/log/apache2/error.log
TransferLog /var/log/apache2/access.log
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/apache2/certs/www.yourdomain.com.crt
SSLCertificateKeyFile /etc/apache2/certs/www.yourdomain.com.key
SSLCertificateChainFile /etc/apache2/certs/www.yourdomain.com_intermediate_bundle.crt
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/srv/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog /var/log/apache2/ssl_request_log   ssl_combined
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://www.your_domain.local:8080/
ProxyPassReverse / http://www.your_domain.local:8080/
</VirtualHost>
</IfDefine>
</IfDefine>

Well hope this is helpful to someone.

Cheers,

Pedro M. S. Oliveira

UPDATE:
Found this article about APACHE2 as a OWA proxy which I really liked 🙂 bellow there are some excerpts that I frequently use. I’m copying them for my reference:

<VirtualHost *:443>

DocumentRoot "/var/www/owa"
ServerName mail.mycompany.com:443
ServerAdmin support@mycompany.com
DirectoryIndex index.html index.php

SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key

SSLProxyEngine on

RewriteEngine On
RewriteRule	^/$	/exchange	[L,R]

RequestHeader set Front-End-Https On
ProxyRequests On
ProxyPreserveHost On
ProxyVia full

<Proxy *>
	Order deny,allow
	Allow from all
</Proxy>

    ProxyPass        /exchange https://mxbsas.example.local/exchange
    ProxyPassReverse /exchange https://mxbsas.example.local/exchange

    ProxyPass        /exchweb https://mxbsas.example.local/exchweb
    ProxyPassReverse /exchweb https://mxbsas.example.local/exchweb

    ProxyPass        /public https://mxbsas.example.local/public
    ProxyPassReverse /public https://mxbsas.example.local/public

    ProxyPass        /exchangerng https://mxrng.example.local/exchangerng
    ProxyPassReverse /exchangerng https://mxrng.example.local/exchangerng
    ProxyPass        /Microsoft-Server-ActiveSync https://mxbsas.example.local/Microsoft-Server-ActiveSync
    ProxyPassReverse /Microsoft-Server-ActiveSync https://mxbsas.example.local/Microsoft-Server-ActiveSync

</VirtualHost>