SSMTP/Getmail how-to part I

This is a short how to for kicking sendmail in the buttocks and setting up a micro-replacement for send-only usage on a FreeBSD (post 5.x) system. Plus using the getmail utility to check for new messages. I spent long enough screwing with it after I miss-read some documentation (fbsd handbook/ssmtp).

The goal is to be able to use utilties such as mailx, mutt, and other MUA’s dependant on sendmail (or exteneral) MTA(s) and be able to check mail easy and automaticly. I assume you at least know how to setup a mail client such as Mozilla Thunderbird or Outlook Express (or can get the relivent info) and know how to edit files as root when needed.

First we have to kill sendmail. For this we need to edit the /etc/rc.conf file, since I’ve cleaned mine up to place various options in related ‘sections’ heres the relivent one from my rf.cofing. Note all the sendmail_* options at the bottom.

#########################################################################
# SERVICES #
#########################################################################


#cupsd_enable="YES"
#background_cupsd="YES"

samba_enable="YES"

ntpdate_enable="NO"
ntpd_enable="YES"
ntpd_falgs="-c /etc/ntp.conf -f /var/db/ntpd.drift"

# Completly kill sendmail
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

Save rf.config with those sendmail lines in it and we can stop sendmail from working. Sendmails probably the worlds most used Mail Transfer Agent but for a desktop we don’t really need it. While its well known for its history of security problems according to some OpenBSD people, at least they still patch it. Now with sendmail gone we have two problems.

  1. Daily run messages are usually mailed to root and this might break that a tad.
  2. MUA’s dependant on external MTA or utils dependant on sendmail may require configuration changes or stop working

Now to fix this we want some thing small that will allow us to send e-mail through some thing sendmail compatible’ish. I’ll assume that you have ports installed or know how – so go do it and update them. Personally I try to update my ports tree every few days or just before building a port if I rarly install stuff on the machine. I also prefer cvsup/csup 🙂

Ok, now that you have ports ready to go lets install some software. Open a shell (or use a GUI) to cd into /usr/ports/mail/sstmp/ so we can build it. Run the commands

make install replace clean

it shouldn’t take long to install so no need to go on coffee break 😛
In case your wondering what ssmtp is heres the pkg-descr:

A secure, effective and simple way of getting mail off a system to your
mail hub. It contains no suid-binaries or other dangerous things – no mail
spool to poke around in, and no daemons running in the background. Mail is
simply forwarded to the configured mailhost. Extremely easy configuration.

WARNING: the above is all it does; it does not receive mail, expand aliases
or manage a queue. That belongs on a mail hub with a system administrator.

WWW: http://packages.debian.org/testing/mail/ssmtp.html

Basically it doesn’t handle fetching or checking mail or reading it but it lets you send it. While some thing like sendmail, qmail, or postfix should at least provide send/recieve if you want to go bugger setting up a full blown mail server be my guest 🙂

sSMTP is really s send-only app that tries to emulate sendmail, most of the command line options to sendmail are accepted but many are just ignored. Some MUA’s can check mail for us, mutt springs to mind but I rather like using getmail so far. At first I thought I would use sendmail/fetchmail/ but I saw an app called ‘getmail’ in ports and checked it out. Its not as buggy as fetchmail is *said* to be, its got great documentation, and its really simple. So if your going to use getmail once ssmtp is done building start on /usr/ports/mail/getmail/ while we open another terminal to configure ssmtp while getmail compiles.

Using a shell or file manager like konqueror cd over to /usr/local/etc/ssmtp/ . We can ether use the .sample files here or create new ones from scratch. We to create a ssmtp.conf file that tells ssmtp how to send e-mail to our out going mail server. The config file syntax is a cake walk, its key=value and # for comments to end of line like many a language or file has.

# Your E-Mail _address_
root=email_username@isp.net
# Your outgoing mail server, normally the TLD is .net, .com, or .org
mailhub=mail.isp.topleveldomain
# Where mail looks like it came from, just stick in your e-mail address.
rewriteDomain=email_username@isp.net
# Your hostname, your e-mail address should be fine if your not a mail server
hostname=email_username@isp.net
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=YES

save as /usr/local/etc/ssmtp/ssmtp.config and that takes care of that. You might want to nuke sendmail or reboot of course for this to take effect. Now since we do want our daily run stuff to still work we will set up an alias so mail sent to our user account locally will actually be sent to our e-mail address. We’ll do this with the revaliases file in the same directory.

This ones a little bit og a bug but its not once you figure out how. Basically the syntax is like this

your_login_name_on_this_computer:your_email_address_to_send_to:the_out_going_mailhub_to_use

# Alias e-mail to the system root account to go to my private e-mail
root:myemailaddr@myisp.tld:mail.myisp.tld
# Alias my_username to my email address so I get my cron-job reports
my_username:myemailaddr@myisp.tld:mail.myisp.tld

This way the daily run and cron e-mail messages will still work and they will be in my e-mail rather then /var/mail/${USER} where I often forget to check 8=)

I’ve yet to figure out how to set up ssmtp for multiple outgoing mail servers but I’ll figure it out later & post it.

Ok, now lets get back to getmail

To do this week

My monster list in short form.
  • My normal work week
  • I have *GOT* to get a test out for school
  • Get my printer functioning over th enetwork (Vectra)
  • Get my E-Mail working again, probably move things over to Vectra and ssh in to use a CLI mail client. Best start telling peoople to stop sending me HTML E-Mail 8=)
  • Consolidate my data backups
  • Check for a WinSucks equiv to mount_smbfs or a more reliable method then Windows XP’s own handling of SMB
  • Set up a FTP server on my local LAN
  • Get a LDAP based Address Book solution going if at all possible
  • Clean up my system configurations, ssh, sendmail, cups, samba e.t.c.
  • Keep up with business as SSM, RvS Dept. 22nd [SAS] EVR
  • Deal with being an associate web master
  • Finish my coding project in C
  • Put together that thing for Shield
  • Boost my studies in PHP and JavaScript

broken bones

Well, since my USB flashdrive died for all intents and purpsoes today. Lucky I did get a full backup while I could still get it to mount on occasion.

I cracked the sucker open, yanked out the PCB (printed circuit board) from the looks of it. Nice little thing /w a few DIMM’ish things on it. Ones probably the 1gb of disk space and the other a *real* microprocessor. Maybe even a picoprocessor if you think about how big some desktop PC’s CPUs are with a heat sink on top of them.

The USB connector was just clipped on, with a few metal prongs coming out of it and into the board. Looked like they might slide out so I pulled it off, sure enough the things didn’t slide out and they broke off from the looks of it. Although I think I’d need a magnifer to be sure of 3 of them. One is clearly destroyed.

The funny thing, is when I stuck it all back together and put the tape back ’round the case. It sat just right, before it died. Well it got a bit bent at the port one day & started to split the case. Hence the tape…

I think assuming that I broke all 4 connectors instead of just 3. I might’ve been able to save the bloody thing. Oh well I got the data backup and thats what counts. Not to mention I got to have a look see just what is inside a USB Flash Drive 🙂

Now if only Windows could be trusted to access my SMB shares 24/7 and I could get a nice little 20GB PATA drive for Vectra I could complete the more Network Centric restructings I wanted to work on. Only I didn’t think I’d need to !.

Gonna have to start using ftpd to or find a winsucks == of mount_smbfs.

Well I found the anwser to my problem by kicking around rather then kicking my self.

(t_flag < 1) && (b_flag < 1) *not* ((t_flag) && (b_flag) < 1) *smacks self* sleepy idiot !

Well, I hit the point for destruction or construction….

ether go insane and smash stuff or do some thing useful. So I ripped apart my room probing for a rough idea of how to sor things and rearranged every thing.

GOD, I’ve been wanting to get that shelf out of here for years. Got things rearranged and even a little work station for me set up. After all I did start off trying to figure out how to get my self a little microcomputer lab going.

I also got to throw out a crap load of stuff, yeah I’m a pack rat…

I t hink I’msnapping..

I’ve tried switching to my laptop, practiclly locking my self in a room on the other side of the house.

Putting my laptops volume to the max with near max HW volume + 50+ % on Amarok & blasting music

Turning the TV volume as high as it goes and the Cable Box up so you not only can here me accross the house but probably in the next apartment and the apartment building !

AND I STILL CAN’T BE LEFT ALONE TO DO MY WORK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

For petes frigging sake I should make these people read K&R Cover to cover and write a bloody operating system kernel and see how they like torture !

Dying a mad mans death bit by bit.

Morning:

Can’t do shit, have to walk dogs, clean up, do stuff, deal with ma’s computer functional illiteracy.

Afternoon:

Lunch, forums, first login, web-chores. Can’t do shit – dog and bird driving me batty.

Evening:

Dinner followed by can’t do shit

Wee Hours of the morning:

Freedom, can work till I collapse.

If working – probably can’t do shit, have to get up early.

TRYING TO DO ANY THING IN THIS HOUSE IS LIKE TRYING TO STUFF MY PH|-||_|{|<1||6 HEAD IN THE STREET IN THE PATH OF A FRIGGING 18-WHEELER AND LIVING AFTER BEING RAN OVER !!! I’m going f***ing crazy here. Peopole get paid to work for then 60 fucking hours a week on this shit and they won’t even alot me a few hours a day to work in piece. Even if I switch to my room, use the laptop. Kick the TV up so you can here it outside put headphones on and blast heavy metal till my ears hurt. THEY WONT FUC@ING LET ME SIT THE FSCK DOWN AND THINK ABOUT WHAT THE F&CK I’M DOING !!!!!
Its intolerable ! and moving out is not even a frigging hope let along an option.

Force Building

An old hobby of mine, designing military hardware and organizing units. Maybe
its one of the reasons I got into the CBT (Classic BattleTech) side of things in
my MechWarrior career and love RTS (Real Time Strategy) games.

Any ways what I’ve been pondering over to night.

A simple ‘Element’ being the lowest level of the fighting force. Consisting of
ether 8 Infantry, 4 Land Vehicles, 2 Air/Sea/Space Craft under 500 Tons, or one
ship over 500 tons.

Two classes of infantry, soft armored and battle armored. Soft armored would be
more or less what we have to day. Using soft-body armor or hardened ceramic
armors (think Marines from ALIENS) and standard weapons. While battle armored
infantry would be fitted with a suit of armor. Figure avg trooper becomes
about 2 meters tall with a 3 meter jump height using the heating/cooling
management systems to assist the trooper. Armed with 6.2mm Rifles and 10mm
Pistols. And enough hard armor to shrug off a few standard rounds.

I remember reading that a round has to be > 22Cal but < 30Cal to really be
effective so I think a 6.2x48mm rifle round would be an interesting experiment.
As a trade off between 9mm and .45Cal pistols 10mm is also interesting in
concept. Instead of normal ammo the rifles would fire a special round. A 6.2mm
armor piecing round thats designed to explode when hitting hard objects. Like
walls or cars. Yet made to fragment instead of go kaboom when hitting soft
targets like people. If you figure the blast could have enough force to take
most of an arm off. Its much more humane to just kill the sap not blow them up.
And to have the balence that the micro HE stock is good reason for the enemy
to rethink how they armor their own troops while improving joe rifle mans
ability to hurt armored fighting vehicles 🙂

I think being centered around the idea of a Combined Arms Operations Company is
the best plan.

4 x Mechs, 1 Support unit, 1 Command unit, 2 Assaulter’s.
3 x Main Battle Tank
1 x Command/Control/Communications/Intelligence vehicle which can tow a pair of
field guns for use as part of an artillery unit.
1 x Self-propelled missile artillery or Infantry Fighting Vehicle (IFV).
8 x Infantry in battle armor or gun crews.
2 x Close Air Support units.

My ideal configuration would be. 8 Battle suited infantry supported by a
tracked or hover-craft driven IFV /w 4-tube Anti-Tank missile launcher & 45mm
Autocannon. Toss on a pair of 12.7mm Anti-Near-Anything fifty cals on the top
for balance.

3 Main Battle Tanks maybe 45-75 Tons each. 135-142mm rifled cannon with 40-60
shells. 3 12.7mm MG, two top mounted + one coax with about 1600 Rounds. A pair
of triple tube smoke discharges on the front of the turret plus a pair of
single shot recoilless anti-tank rocket tubes on the sides of it.

Yes I’m kind of a nut about packing in as many weapons as possible followed by
as much armor as she’ll hold without losing the desired level of agility/speed.
🙂 Hehehe

Two CAS units consisting of STOL (Short Take Off & Landing) capable strike
fighters powered with dual-engines. A pair of 25mm Vulcan cannons, pair of wing
tip mounted Air-To-Air medium range missiles al cine to real world AMRAAMs.
4 Internal bays for deploying two 3-tube micro-missile stations and two
stations holding two smart bombs or 3 air-to-ground missiles. (HRTSG-ATG) 2
Under wing stations (per wing) for 2x bombs or 3 x air-to-air /or air-to-ground
missiles + 1 more under wing stations (per wing) for an Air-To-Air missile. All
of these under wing stuff being at the cost of stealth that is. More or less a
pair of harrier jump jets on steroids !

Or even a pair of helicopters packing a 17mm chin gun slaved to the gunners
head. Dual 12.7mm electronically fired forward mounted machine guns for the
pilots use. Wing tip mounted 5-Tube rocket pods and two stations for 4x
Missiles on each stub wing. Where thers a mixture of TV guided wire controlled
fine stabilized anti-armor missiles and Hybrid Radar / Thermal Semi-self
Guiding Air-To-Ground (HRTSG-ATG) missiles. Now thats a painful combo hehe.

A ‘Mech element with a support unit with long range missiles, heavy cannon, or
long range weapons like a super long range sniper rifle/laser. Two general
battle configured ‘Mechs of the line, CQB Configurations, or Spec Ops Raiders.
Plus a Commanders ‘Mech.

Wheeled or Hovercraft based truck with AA ability to provide a mobile
command/control post with lots of communications and intelligence gathering
tools. Plus it could tow a few cannon for arty units.

8 Infantry in battle armor or a gun crew.

A Multiple Launch Rocket System (MLRS) like self-propelled missile artillery
unit for close’ish arty support on the go.

Total of about 4 mech, 3 tank, 1 MLRS, 1 command post, 8 infantry, 2 vtol/stol
units for air support.

A Lance Captain in charge backed by a lieutenant and a Gunnery Sergeant to run
the show. About 30 combat personal. Able to bring a lot of fire power to bear
on the enemy. Plus having enough combined arms to deal with most threats.

Now organize these CAOC into battalions of six + one company is full of
support personal and equipment. We have a big enough force to consider when one
counts armor and air power as the prime assets and infantry more so for close
in MOUT and Commando work.

24 ‘Mechs
18 Main Battle Tank
at least 6 pieces of missile artillery.
12 Attack Choppers / Fighter-Bombers
48 Infantry with battle armor
6 Command Trunks to provide logistics and communications.

Per battalion. Now if we organized the force into regional commands based on
Regiments of 2-4 Battalions where preferably we have a battalion capable of
operating on its own and a regiment capable of transporting itself any where in
or around the planet.

Organize logistics, support, and command systems around a Divisional level with
the Regimental Combat Teams making up the back bone of the military force. And
I think we might have a fun CBT style game to play, or a funky study in future
military tech.

Plus a naval unit to supply sea and space based operations. Plus air power like
what the USAF would be tasked with. You could say its my
battletech/gundam/macross loving background but I consider ‘Mechs and air power
the prime focus of a modular combined arms task force.

Hmm, if I had the time I think I’d write a TBS (Turn Based Strategy) game on
this…

UNIX Rules & DOS Drools !

In my cousre of trying to brush up on DOS CLI work I’ve come to a cacussion. Its a quick and dirty product that must have been written very fast or half hazardly. Because UNIX makes it look like a moronic idiot with 10bytes of RAM ! I just… can’t stand DOS give me a decent Unix any day… A real operating system.