Monthly Archives: December 2013

Debian Squeeze: Configuring Sendmail to relay through your Provider’s SMTP

If you have a home server and you need a functionality of sending an email from that server like for example: you forgot your password of a php website and you want to request an access (a new password) using an external email address. This task is almost impossible if you have a server without dedicated IP address. In this example I have a Faxserver on my home server and I want to set a new password. But if I click on “Forgot your Password?”, put my email address in and click send. Checked my email and nothing happened.

avantfaxThe reason for that is the remote mailserver will reject any email from my home server.

After some reading (from this link) and trial I managed to make it working to relay sendmail through my provider’s SMTP server. Here’s how I did it:

1. From Synaptic, install “sendmail-bin” and “sendmail” (if they are not already installed):

sendmail_012. Using your favorite editor put the following line into “/etc/mail/auth/client-info”:

AuthInfo:<your-smtp-server> "U:root" "I:<your-email-address>@<your-provider>" "P:<your-password>"

3. Create database hash from that file:

cd /etc/mail/auth
sudo makemap -r hash client-info.db < client-info

4. Change file permission of both files to 600:

sudo chmod 600 *

5. Change “/etc/mail/auth” directory permission to 700:

cd ..
sudo chmod 700 auth

6. Add following text to the end of file “/etc/mail/sendmail.mc”:

define(`SMART_HOST',`<your-smtp-server>')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')
define(`confCACERT_PATH', `CERT_DIR')
define(`confCACERT', `CERT_DIR/CAcert.pem')
define(`confSERVER_CERT', `CERT_DIR/mycert.pem')
define(`confSERVER_KEY', `CERT_DIR/mykey.pem')
define(`confCLIENT_CERT', `CERT_DIR/mycert.pem')
define(`confCLIENT_KEY', `CERT_DIR/mykey.pem')

7. Create certificate directory:

sudo mkdir /etc/mail/certs
cd /etc/mail/certs

8. Create SSL certificate:

sudo openssl dsaparam 1024 -out dsa1024 -out dsa1024.pem
sudo openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out /etc/mail/certs/mycert.pem -keyout /etc/mail/certs/mykey.pem
sudo ln -s /etc/mail/certs/mycert.pem /etc/mail/certs/CAcert.pem
sudo openssl req -x509 -new -days 3650 -key /etc/mail/certs/mykey.pem -out /etc/mail/certs/mycert.pem

9. Change file permission of all files to 600:

sudo chmod 600 *

10. Change “/etc/mail/certs” directory to 700:

cd ..
sudo chmod 700 certs

11. Run “make”:

sudo make

12. Reload “sendmail”:

sudo /etc/init.d/sendmail reload

13. That’s it!

Fluxbox menu: open two programs at once

Sometimes we need to open always two programs at once. For example I always need to open “navit” and restart “gpsd” at the same time in order to make navit receives gps signal from gps-bluetooth-dongle (if gps dongle is turned on at a later time).

Fortunately this can be easily done in fluxbox. Just modify the existing navit menu line in “~/.fluxbox/menu” from:

[exec] (navit) {/usr/bin/navit} </usr/share/pixmaps/navit.xpm>

to:

[exec] (navit) {/usr/bin/navit & sudo /etc/init.d/gpsd restart} </usr/share/pixmaps/navit.xpm>

By using ampersand (&) you can add another command to start different program.

That’s it!

Reset user password on Debian Squeeze

Sometimes as an IT Administrator you are requested to reset a user password. Here is how I did it:

1.  Boot grub and choose recovery mode and do not press enter.

resetpwd_012. Press “e” key, go to the end of line “linux /boot/vmlinuz-…” and add a space (press spacebar once) and type “init=/bin/bash” and press “Ctrl-x” to boot.

resetpwd_023. After finished booting, type “mount -rw -o remount /” and press enter.

resetpwd_034. Type “passwd <username>” and press enter. Replace <username> with the real username whose his/her password needs to be resetted.

resetpwd_045. Type in a new password and press enter.

6. Type in the same password for confirmation and press enter.

7. Type “reboot”.

8. That’s it!

Capacitive battery charger

Disclaimer: Electricity is dangerous. High voltage and high current can kill you! Do not try to build this circuitry if you don’t have enough knowledge in electricity. If you still want to build this circuit, do it at your own risk! I don’t take any responsibility of what you do and its consequence. This article is intended for informational purpose only.

capcharger01

Not long ago I built a battery charger that uses capacitor as current limiter and voltage devider. Despite of simple schematic, this circuit has very good performance. It charged my 6 Volt 235AH dead battery from ~1 Volt to over 6 Volt within 15 minutes! But the charging process is kind of scary because of the (hydrogen and oxygen) bubbles crackling sound created during the process. Do not charge a battery in a closed (non-ventilated) room. Do it outside your house.

capcharger02

Here is the picture with the box opened:

capcharger03

Here is a picture of my test circuit:

capcharger04Here is the capacitor that I use (AC capacitor must be used):

capcharger05This is my schematic:

capcharger_scm_cutThe function of the switch is to change the total capacitance value of capacitor. The higher the capacitance value, the higher the charging current, which also means faster charging rate but with more heat generation.

And here is my explanation of how this circuit works:

capcharger_expl01_scm_cutcapcharger_expl02_scm_cutAnd here is the simplified explanation:

capcharger_expl03_scm_cut