I do what I can

Random thoughts from Mauricio Teixeira…

Posts Tagged ‘fedora

Email to SMS gateway in Linux

with 17 comments

Updated on Jul/03 — Works on Fedora 13, a fix minor inconsistencies.

This is another one of my “quick and dirty” tutorials. This time I will show you how to build an email to SMS gateway.

Before we continue, bare in mind that I didn’t care to document details on system security (specially in what regards to spam filtering or SELinux configuration). The idea here is to show an overview on what needs to be done to have it working. I also won’t explain how to configure an MX entry in DNS, or how to make this integrate to your current email system. The details should be polished by whoever is going to implement, depending on their environment.

Tools I have used here:

  1. A regular PC
  2. Nokia phone running Symbian OS, connected to the USB port in “PC Suite” mode
  3. Fedora 13, with Postfix (personally, I don’t like Sendmail)
  4. SMS Server Tools 3 (installed from Fedora repository, using yum)

First thing I did was installing the SMS Server Tools application, Postfix and disabling Sendmail. I did that because I think Postfix is easier to configure and maintain. If you want to do this using Sendmail, and you find your way into it, please paste the necessary configuration lines on the comments below.

# service sendmail stop
# chkconfig sendmail off
# yum install smstools postfix

The package in Fedora 13 already adds a private user for the sms system, creates the necessary directories and sets the permissions. So we just go with what we get.

Now we need to configure smstools with the minimum parameters necessary for it to run.

# vi /etc/smsd.conf
+ devices = ACM0
+ loglevel = 5
+ group = dialout
+ infofile = /var/spool/sms/smsd.running
+ [ACM0]
+ device = /dev/ttyACM0
+ incoming = no

Important notes here. The device ttyACM0 exists because when I connected the Nokia I selected the “PC Suite” mode. If you select anything different, it will create a different device, but none of them work for sending messages. If you are doing this on a different distribution other than Fedora, check which group is the owner of this device, and set it on the smstools config file, otherwise the application won’t be able to write to the device.

Great. Now we can start the application, and run a basic test. Remember the accepted phone number format: XXYY99999999, where XX is the country code, YY is the region code, and the rest is the real phone number.

# chkconfig smsd on
# service smsd start
# su smstools -c "smssend 551199999999 'This is a short test.'"
# su smstools -c "echo -e 'To: 551199999999\n\nThis is a long test.\nWith multiple lines.\n' > /var/spool/sms/outgoing/test"

At this point, you should have received two messages. If you don’t, read back and double check your settings (or look at the logs). If all works, keep reading.

The final part is to make Postfix receive the messages, and route via smstools. The script that converts from email to SMS is this:

# cp /usr/share/doc/smstools-*/email2sms /usr/local/bin/
# chmod +x /usr/local/bin/email2sms

And here is how we make Postfix deliver to the script:

# vi /etc/postfix/main.cf
+ inet_interfaces = all
+ mailbox_transport = smstools
# vi /etc/postfix/master.cf
+ smstools  unix  -       n       n       -       -       pipe
+  flags=DORhu user=smstools argv=/usr/local/bin/email2sms
# chkconfig postfix on
# service postfix start

If you don’t set the inet_interfaces option, Postfix will only accept connections from localhost. If you need it to receive messages from anywhere in your network, better put something meaningful there.

Now we need to make Postfix understand what is considered to be a valid user on the server. For that, we keep the old /etc/aliases, and add our users:

# vi /etc/aliases
+ 551199999999: netmask
+ 551188888888: badnetmask
# newlaliases

Remember: for every SMS recipient there must be an entry in /etc/aliases. The name after the colon is mandatory because of the file format, but will make no difference to the delivery system, so just use something that will identify the user of that address.

At last, test it:

$ telnet smsgateway.example.com 25
Trying 10.1.1.100...
Connected to smsgateway.example.com (10.1.1.100).
Escape character is '^]'.
220 smsgateway.example.com ESMTP Postfix
helo netmask.example.com
250 smsgateway.example.com
mail from: netmask@example.com
250 2.1.0 Ok
rcpt to: 551199999999@smsgateway.example.com
250 2.1.5 Ok
data
354 End data with .
To: 551199999999@smsgateway.example.com
Subject: Test subject
Hello world!
.
250 2.0.0 Ok: queued as C52E620236

That’s it!

I hope this is useful for you. If you find any mistakes or you wish to suggest any different setup to our next readers, please feel free to comment below.

Have fun! 🙂

Written by netmask

março 11, 2010 at 11:48

Publicado em Uncategorized

Tagged with , , , ,

Convert from VirtualBox to KVM

with 7 comments

Quickest and dirtiest way to convert your VirtualBox machine into a KVM machine.

First of all, make sure you have enough space. If you have created a dynamically growth disk, the virtual disk has been defined as 20GB in size, but is only currently using 8GB, you will need 28GB extra (8 for the original file you already have + 20 for the temp file + 8 for the final file). If you’re using disks with pre-allocated size, you will need 2 times extra the space (20 original + 20 temp + 20 final, in this example).

1 – Convert the VirtualBox VDI file into a RAW image.

$ VBoxManage clonehd --format RAW MyTestVM.vdi MyTestVM.raw

2 – Convert the RAW image into a QCOW file.

$ qemu-img convert -f raw MyTestVM.raw -O qcow2 MyTestVM.img

3 – Voila. Go into virt-manager, create the machine, and use your newly created image.

Written by netmask

março 3, 2010 at 01:20

Publicado em Uncategorized

Tagged with , , ,

Utilizando o controle remoto da PixelView Play TV Pro Ultra no Fedora 12

with 2 comments

Recentemente reorganizei meu escritório em casa, e no meio disso, coloquei um sofá, para que eu pudesse assistir filmes confortavelmente (apenas uma segunda opção, já que tenho um Popcorn Hour na sala de estar). Enquanto olhava nas coisas velhas, encontrei o controle remoto que veio com minha antiga PixelView Play TV Pro Ultra, que eu não utilizo há um bom tempo, mas que está instalada do mesmo jeito. Já que eu tenho isso, decidi usar o controle remoto, para fica ainda mais confortável vendo meus filmes do sofá.

Itens utilizados nesse tutorial:

Visão rápida da instalação do hardware: espete a placa no slot PCI, conecte o receptor de infra-vermelho no pluge certo da placa, inicie o sistema. Você consegue… 🙂

Aparentemente o Fedora irá detectar a placa de TV, mas não vai reconhecer o modelo correto, portanto você precisa dizer exatamente qual placa está sendo utilizada. Você faz isso criando um arquivo que irá passar o modelo para o driver:

# cat /etc/modprobe.d/cx88xx.conf
options cx88xx card=27

Agora você tem duas opçẽos: reiniciar o sistema, ou recarregar o módulo. Para recarregar o módulo, execute os seguintes comandos:

# rmmod cx8800
# rmmod cx88xx
# modprobe cx88xx
# modprobe cx8800

Agora instale os pacotes necessários:

# yum install lirc totem-lirc

E aqui estão os passes de mágica: o controle remoto não funciona de primeira, então precisei dizer ao lirc onde encontrar o dispositivo correto, e criar um novo arquivo de configuração explicando a ele o que cada botão faz (bom, pelo menos a maioria deles).

Primeiro você precisa dizer ao lirc onde encontrar o dispositivo. Para isso edite o arquivo /etc/sysconfig/lirc e modifique-o conforme abaixo:

LIRC_DEVICE="name=cx88\?IR\?\(PixelView\?PlayTV\?Ultra"

Em seguida salve o text desta página para um arquivo chamado /etc/lirc/lircd.conf. Agora habilite o serviço do controle remoto:

# chkconfig lirc on
# service lirc restart

Depois disso, tudo o que você precisa fazer é abrir o Totem, ir para o menu Editar -> Plug-ins e habilitar o “Controle remoto infra-vermelho”.

Infelizmente não dá para abrir um arquivo novo, nem pular para o próximo arquivo na sua lista de reprodução, mas ao menos você pode executar, parar, finalizar, adiantar ou voltar o vídeo. Talvez depois eu dedique um tempo para habilitar mais recursos do controle (ou, se você já o fez, por favor fale como nos comentários dessa página).

Divirta-se! 🙂

Written by netmask

fevereiro 14, 2010 at 21:43

Publicado em Uncategorized

Tagged with , , , , ,

Using PixelView Play TV Pro Ultra remote control on Fedora 12

leave a comment »

I recently reorganized my home office, and when doing so, I added a couch so I could watch movies more comfortable (it’s a second option, since I already have a Popcorn Hour at the living room). While looking at some old stuff, I found the remote control that came with my ancient PixelView Play TV Pro Ultra, which I don’t use for a long while, but it’s still installed anyway. Since I have that, I decided to make the RC available, so I could be even more comfortable while pausing/fast-forwarding my movies from the couch.

Items used in this tutorial:

Quick overview about the hardware install part: place the card on the PCI slot, connect the IR receiver on the proper plug on the board, boot the system. You’ll find your way… 🙂

Apparently Fedora will detect the TV card, but it won’t recognize the proper model, so you need to tell it exactly which card is in use. You do so by creating a file telling the driver about it:

# cat /etc/modprobe.d/cx88xx.conf
options cx88xx card=27

Now you have two options: reboot, or reload the module. To reload the module, run the following commands:

# rmmod cx8800
# rmmod cx88xx
# modprobe cx88xx
# modprobe cx8800

Now install the necessary packages:

# yum install lirc totem-lirc

And here are the magic tricks: this remote control does not work out of the box, so I had to tell lirc where to find the IR input device, and create a new config file to make it understand what each button does (well, at least most of them).

First you need to tell lirc where to find the IR input device. You do so by editing /etc/sysconfig/lirc and editing the device line like this:

LIRC_DEVICE="name=cx88\?IR\?\(PixelView\?PlayTV\?Ultra"

Next, save the text of this page to a file named /etc/lirc/lircd.conf. Now enable the remote control daemon:

# chkconfig lirc on
# service lirc restart

After that, all you need to do is open Totem, go to menu Edit -> Plug-ins and enable the “Infra-red remote control” plug-in.

Unfortunately you can’t open a new file, neither skip to the next file on your play list, but at least you can play, pause, stop, fast forward and rewind. Maybe I’ll take some time later to enable more of the IR features (or, if you have done so, please add to the comments of this page).

Have fun! 🙂

Written by netmask

fevereiro 14, 2010 at 21:21

Publicado em Uncategorized

Tagged with , , , , ,

Público-Alvo do Projeto Fedora

with one comment

A diretoria do Projeto Fedora definiu quem é o público-alvo da distribuição.

É alguém que reune estas 4 características:

1) está migrando voluntariamente para o Linux,
2) tem familiaridade com computadores mas não necessariamente é um hacker ou programador,
3) tem probabilidade de colaborar de alguma maneira quando algo está errado com o Fedora, e
4) quer usar o Fedora para produtividade em geral – com aplicações no desktop ou em um navegador web.

Leia com mais detalhes no LWN.net (excerto em português kibado do br-linux.org).

Written by netmask

outubro 29, 2009 at 08:51

Publicado em anything

Tagged with , ,

Quote of the day

with 2 comments

Quote of the day from my co-worker Glommer.

“Ubuntu’s development release is called Fedora…”

Written by netmask

julho 30, 2009 at 13:18

Publicado em anything

Tagged with , , ,

Checking package dependencies (up and down)

with one comment

Today I was woking on updating one of the packages we maintain on our internal repos, and I was not sure exacly which packages required the one I was rebuilding. I had to check that, otherwise something could break if I did a mistake, and the best thing is to pre-check as much as possible.

So reading them Yum man page, I found the option “deplist”, which shows me all the packages which are required by a given package.

# yum deplist libsndfile
(…)
Finding dependencies:
package: libsndfile.i386 1.0.17-6.fc10
dependency: libm.so.6
provider: glibc.i386 2.9-2
provider: glibc.i686 2.9-2
provider: glibc.i686 2.9-3
provider: glibc.i386 2.9-3
dependency: libogg.so.0
provider: libogg.i386 2:1.1.3-9.fc9
(…)

Ok, that’s one part of the problem. But what would really impact this update would be any broken dependencies up, i.e. who depends on this given package.

The nice guys on #yum@freenode pointed me to pkg-provs-tree-view.py, which does exactly what I need.

# python pkg-provs-tree-view.py libsndfile
libsndfile-1.0.17-6.fc10.i386 [cmd line]
\_  Io-language-graphics-and-sound-20071010-6.fc10.i386 [2: libsndfile.so.1, libsndfile.so.1(libsndfile.so.1.0)]
\_  armstrong-0.2.6-6.fc10.i386 [2: libsndfile.so.1, libsndfile.so.1(libsndfile.so.1.0)]
|   \_  armstrong-devel-0.2.6-6.fc10.i386 [3: armstrong = 0.2.6-6.fc10, liblunarstd.so.0, libzzub.so.0]
|   \_  pyzzub-0.2.6-6.fc10.i386 [1: armstrong = 0.2.6-6.fc10]
|   |   \_  aldrin-0.13-1.fc10.noarch [1: pyzzub = 0.2.6-6.fc10]

And the best part is that it searches for any dependencies installed or not installed. This is way better than “rpm -q –whatrequires”. 😀

Written by netmask

junho 19, 2009 at 17:25

Publicado em anything

Tagged with , , ,