http://www.freesoftwaremagazine.com/node/1266/issue_pdf

Page 1

Issue 14



Issue 14

Table of Contents Issue 14................................................................................................................................................................1 .................................................................................................................................................................1 Editorial..............................................................................................................................................................3 On “making it”........................................................................................................................................3 GNU/Linux and WiFi........................................................................................................................................5 WiFi maniac needs aspirin and emotional support.................................................................................5 Firefox extensions: fun and games...................................................................................................................7 Or several ways to waste time................................................................................................................7 Personal privacy: on the web..........................................................................................................................13 Keep your privacy on the web with a technologically advanced onion...............................................13 Flying high with FlightGear............................................................................................................................17 A realistic experience............................................................................................................................17 Writing documents with OpenOffice.org Writer..........................................................................................23 ...because using a word processor isn’t enough....................................................................................23 Baby steps with The GIMP.............................................................................................................................31 Making a web banner using The GIMP................................................................................................31 Free Open Document label templates............................................................................................................39 Using the right tools to save time and effort.........................................................................................39 Managing users in Ubuntu..............................................................................................................................57 A short, practical guide to user management in Ubuntu and GNU/Linux............................................57 Creating a managed website—Part 1.............................................................................................................63 Focus on the message not the tools. Set up a content management system to deliver your site..........63 Spiff up your website with KImageMapEditor.............................................................................................67 A brief tutorial to a small application that can save you a large amount of time.................................67 Secure email servers from scratch with FreeBSD 6.1 (part 1).....................................................................75 Build a secure email server with FreeBSD, Postifx, ClamAV, Spamassasin, and MySQL.................75

i


Issue 14

ii


Issue 14 By Tony Mobily Free Software Magazine presents another collection of great articles for its issue 14. Alan Berg takes us soaring with his review "Flying high with FlightGear" and Anthony Taylor shows us some curious Firefox extensions in "Firefox extensions: fun and games". In "Creating a managed website — Part 1" Graham Oakes reveals a lot about content management systems. And, while we're talking about websites, Terry Hancock will "Spiff up your website with KImageMapEditor". As always, there's a lot more too... Source URL: http://www.freesoftwaremagazine.com/issues/issue_014

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

Issue 14

1


Issue 14

2


Editorial On “making it” By Tony Mobily Before starting Free Software Magazine I talked to John, a friend of mine nearly twice my age. He sometimes has a rather bleak view of the world, and we disagree on many things. However, I always take pay great attention when people I generally don’t agree with turn out to be right. When I told him about the idea of creating Free Software Magazine, he said “it will take a long time to make it successful. Magazines take a while because people, readers, need to build up trust in them; and that, Tony, is not easy. You need to be consistent, and consistently good. Not easy. Not easy at all”. Some two years later (!), and after a lot of personal and professional “events”, here we are. A few similar magazines have come and gone, but we are still here. We are approaching 1 million page views per month (and that’s real, human page views!), we are consistently ranking in the top three most popular Drupal sites, and yes, we have become a point of reference for the free software world. To quote John’s words, we were consistent, and consistently good—or, to be a little more modest, at least good enough. We had the courage to change the magazine according to our readers’ requests (and sometimes demands!), which is not an easy task. We gave the magazine a much more practical approach (in fact, from this issue on the section “Mind Set” is gone) and moved the more philosophical articles to the web site. Plus, the web site itself has changed drastically twice: today, it is now a hub for well known bloggers who talk about freedom and free software. Advertising sales are finally starting (some two years later!), and we are receiving media kit enquiries more and more often. The core members of the Free Software Magazine team (myself, Dave, Gianluca and Alan) now all feel that we “made it”. Here, “making it” means that we are one of the few publication projects that lasted this long, and managed to provide free (as in freedom!) information for an extended period of time. And, things are looking bright right now. We have learned a lot in the process about the free software world, the community, marketing (!), system administration, ourselves, and another few hundred other things. But, this success would have been impossible without the fantastic help of the people who supported us along the way. Amongst those people, there are: the contributors who stuck with us since day 1; the other non-writers who kept us going; the angels at Open Hosting who gave us a fantastic deal before we were famous, and who helped us administer the server more than once for free; the established people in the free software world, who kept on sending us kind words of encouragement; the publishers, who believed in us and sponsored us before we had made it, hence giving us the possibility to get this far; and our readers, who supported us, helped us market the site, and gave a meaning to this whole project. There certainly are hurdles and challenges ahead of us. But, right now we will just sit back for a second—just for a second—and enjoy our achievements. Thank you all.

Biography Tony Mobily (/user/2" title="View user profile.): Tony is the founder and the Editor In Chief of Free Software Magazine

Copyright information Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. Source URL: http://www.freesoftwaremagazine.com/articles/editorial_14

Editorial

3


Issue 14

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

4

On “making it”


GNU/Linux and WiFi WiFi maniac needs aspirin and emotional support. By Alan Berg The idea was simple: why not build my own little GNU/Linux based wireless network in a spare five minutes?

WiFi Maniac needs aspirin and emotional support Upstairs at my place there’s a play computer with lots of development tools, and... ok, a few games too, along with a WiFi router; downstairs there’s the study and an old laptop. Installing Fedora (http://fedora.redhat.com/) downstairs and Ubuntu (http://www.ubuntu.com/) upstairs was quick and painless. With a few clicks on the wizards and a sudden surge in adrenalin as I formatted the disk partitions, lots of package names whizzed by at great velocity and *puff* finished. Yes, an anticlimax of simplicity and stability. Just one small, tiny, insignificant task left, the WiFi connections. No problem, I’m not stupid. I have the power: I know how to Google. So five pages later, I need ndiswrapper (http://ndiswrapper.sourceforge.net/) for the laptop and the Zd1211 module for the gam... um, I mean development machine. After an hour of looking at the Ubuntu machine, prodding it to see if it was still breathing, walking up and down, and nodding profoundly to my family as if I knew what I was doing, I realized the obvious: Ubuntu has the Zd1211 (http://zd1211.sourceforge.net/) driver already installed. With loud rounds of sarcastic applause ringing in my ears, I followed the readme instructions (for non root users). sudo ifconfig wlan0 sudo iwconfig wlan0 essid Sitecom key xxxxxxxxx sudo dhclient wlan0

The actions worked. And, being GNU/Linux, the actions always work. I was connected. I was the master of my WiFi universe upstairs and it only cost me two hours and a couple of dents to my ego. Luckily or perhaps not, my family hadn’t changed their collective opinion of my humanity, being a caveman I bluffed well. However, if I’d started with the black magic recipe or had read the right documents in the correct order in the first place, then the cost in real time for installation would have been less than a minute. But no one else knew that did they? Shh... it’ll be our little secret! If I’d started with the black magic recipe or had read the right documents in the correct order in the first place, then the cost in real time for installation would have been less than a minute Next the big challenge, Fedora Core 5. Core 5 sounded like a nuclear reactor and the WiFi turned out to require some real science. First, I tried the Zd1211 trick, but Zd1211 wasn’t installed. No Wlan0 interface would come up. So back to Google, which, in minutes, had turned up a tantalizing hint: ndiswrapper is a rather excellent utility that allows Windows drivers to work under GNU/Linux. The problem was that I needed to compile the wrapper. To compile you need the header files of the installed kernel. I dutifully downloaded both the 586 and 686 header files. Informed the compiler where to find the interfaces and then compiled. The code compiled cleanly and, with a highly motivated yelp of delight, I deployed the youthful binary. The wrapper didn’t work. What next? The wrong header files perhaps? Being of strong will—hardened by the day-to-day competition for food at the breakfast table—I sought out an ndiswrapper package and installed it. Failed dependencies! Finally, brute force won over intelligence, as it often does with me. I updated the kernel and installed the kernel source code and headers. Compilation worked, but guess what? I had the wrong Windows drivers. One and a half hours later finally all was good, everything works predictably, stably, and will do so until an asteroid hits the earth or my younger son decides to finger paint the internals of the hard drive. Even better, I have that feeling of killing the prey, climbing to the top of the mountain and looking down victoriously. And only for eight hours work. Or ten minutes if I did the same actions in the correct order a second time around. The moral of this story is clear. WiFi is standard functionality. GNU/Linux is shaping up as a desktop competitor against Microsoft. Tools such as Zd1211 and ndiswrapper are essential for that competition. I

GNU/Linux and WiFi

5


Issue 14 therefore welcome advances in the WiFi configuration field and I am happy to see that this is already occurring (http://www.devicescape.com/news/releases/release_05-01-06_opensource.php).

Notes and resources Fedora (http://fedora.redhat.com/) Fedora Update (http://download.fedora.redhat.com/pub/fedora/linux/core/updates/) Header files (http://en.wikipedia.org/wiki/Header_file) ndiswrapper (http://ndiswrapper.sourceforge.net/) Ubuntu (http://www.ubuntu.com/) Zd1211 (http://zd1211.sourceforge.net/)

Biography Alan Berg (/user/8" title="View user profile.): Alan Berg Bsc. MSc. PGCE, has been a lead developer at the Central Computer Services at the University of Amsterdam for the last seven years. In his spare time, he writes computer articles. He has a degree, two masters and a teaching qualification. In previous incarnations, he was a technical writer, an Internet/Linux course writer, and a science teacher. He likes to get his hands dirty with the building and gluing of systems. He remains agile by playing computer games with his kids who (sadly) consistently beat him. You may contact him at reply.to.berg At chello.nl

Copyright information This article is made available under the "Attribution-NonCommercial" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc/2.5/. Source URL: http://www.freesoftwaremagazine.com/wifi_maniac

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

6

WiFi maniac needs aspirin and emotional support.


Firefox extensions: fun and games Or several ways to waste time By Anthony Taylor Firefox is more than just a web browser. It’s also a cross-platform arcade machine. No quarters necessary.

An ode to Ralph H. Baer I owe much of my life to Ralph H. Baer. Oh, he doesn’t know it. He doesn’t even know me. But that’s how it goes in these days. Much of life is owed to strangers. If you want a measure of success, I will give you a yardstick: wasted time. Or rather, leisure time. Ralph H. Baer has given many of us a legacy of time spent in front of a television, twiddling white squares around with a paddle. So it is Ralph H. Baer is a very successful man. In 1969, Ralph H. Baer invented Pong [1]. Doing so, he invented video games. I’ve sacrificed months of my life on the alter of video games since Dad and Mom purchased the family’s first Pong game back in 1977, a Sears model with detachable paddles. Blame the rainy Thorne Bay winters. Blame my budding geekness. Wherever blame may be placed, I wasted hours of my life irretrievably to those little white squares and the harsh electronic ping of the square ball. I’m obviously not the only one. There is a dictum among developers that the first program written for any new platform is “Hello, World”. There is a second dictum that the second program written must be Pong. These mandates are ignored at the programmer’s peril, though nobody really likes Pong. It’s just how things are done. Maybe we are simply trying to recapture the wonder of our childhood. If so, there’s entirely too much nostalgia in the world.

The Firefox extensions window Aside: installing Firefox extensions 1. Start Firefox. 2. Click the “Tools” menu item. 3. Select “Extensions”. 4. Down at the way-bottom-right of the “Extensions” window, click the “Get More Extensions” link. 5. Choose from the vast number of useful, semi-useful, and useless extensions. All the extensions reviewed here are in the Entertainment (https://addons.mozilla.org/search.php?cat=6&app=firefox&appfilter=firefox&type=E) category.

Firefox extensions: fun and games

7


Issue 14

The games Pong! In the world of Firefox, there are not one, but two versions of Pong. Both offer the same great gameplay. One has the added advantage of using a square ball. The other includes the ability to play against others in an on-line Pong deathmatch. Eduardo Garcia Lopez is responsible for PingPong 0.7 (https://addons.mozilla.org/firefox/1724/), a simple implementation of the classic game, replete with nostalgic touches such as the square ball and hard-to-control paddles. I bow to you, Eduardo. Your love of old games surpasses mine. Eduardo is not the only one to turn my more-or-less modern computer into the 1969 equivalent of a wooden box full of a handful of tubes and a pound of copper wire. Captain Caveman has devoted hours of his or her life to develop the finely-crafted PONG! Multiplayer 2.2 (https://addons.mozilla.org/firefox/554/). The good Captain’s effort has turned out a slightly more modern version of the game, with an octogon of a ball, and sound, and smoother paddle movement. There is ostensibly an on-line component of the game, but tales of my mad, mad PONG! skillz precede me. I have yet to find a challenger in the two times I checked the lobby. In the end, they are still just Pong. Both games attempt to take up residence in that empty pit where my childhood innocence once stood, wide-eyed with a paddle in its hand. Those times are passed, though, and now Pong just doesn’t suit. It’s like playing Aztec on an Apple ][ emulator. The memory of Pong is stronger than Pong itself. In the end, they are still just Pong Pacman In the long-ago, far-away years of the video arcade, no game captured the hearts and quarters of boys and girls like Pacman. Part of it was the mystery—who was this man of the Pac? Represented by a chomping circle of yellow, Pacman wore an eternal expression of mild amusement as he alternately ran from, and then toward, the evil quartet of ghosts. He typified the American dream: scarf pills and fruits while running from impossible fears, until the terrifying moment when he is touched by a ghost and the wedge of his mouth eats his own head. I still have nightmares. There are two Firefox options for this classic game. The first is Ingo Oppermann’s Pacman 1.1.0 (https://addons.mozilla.org/firefox/2053/). Mr. Oppermann has gone for the 286-era computer game feel, rather than the realistic arcade experience. The graphics are rudimentary, the gameboards lack the tunnels of the original game, and the sound effects are present but elementary. This was a wise decision on his part. Arcades were highly overrated. The game has a simple, clean feel to it, and is quite playable. The second is the manlier PagMan 1.0 (https://addons.mozilla.org/firefox/2160/), by mackers. Mackers has given a silent but sturdy reproduction of the original arcade game. The movement is a little choppy, but the game is both visually appealing and true to the original. I do miss the intermission chase scenes, though, and the tinny, synthetic music that has been emulated by the likes of Ms. Pacman, The Postal Service, and that guy who did Pacman Fever. All-in-all, both Pacman variants are worth a good ten minutes of playtime, at a minimum. Card tricks Want to know what I hate? Among other things, I really don’t like computerized card games that play themselves for me. A three-by-five pack of cards is probably a bit more convenient to tote around than a six-pound laptop, and the physical cards have the added benefit of not playing themselves.

8

Or several ways to waste time


Issue 14 Mr. Stephen Clavering has produced a very-complete Cards 0.98 (https://addons.mozilla.org/firefox/1562/) extension for Firefox. It suffers only from one great problem: clicking on a card causes it to automatically move to an appropriate stack. This leads me to wonder: What’s the point? There is nothing so patronizing as a game that won’t let you play it yourself. Randomly clicking on cards causes them to fly about the gamefield willy-nilly, not allowing you the chance to not notice the black queen that could go on the red king. Except for that complaint, Cards is an excellent extension with 39 games, the majority to which nobody knows the rules. There is nothing so patronizing as a game that won’t let you play it yourself Rocks Remember Asteroids, the cool game in which you destroy space rocks by striking them with your spaceship? Mackers, fresh from the PagMan victory, has given to the world Mozteroids (https://addons.mozilla.org/firefox/2157/), an impossible-to-control variant of the old vector-graphics classic. Don’t get me wrong, Mozteroids looks pretty, in a pixelated sort of way. But the ship either spins too slowly, or too quickly, and moves as if it has been blindfolded and spun around until it cried, and its brothers teased it and called it a crybaby. It blows up nicely, though. So do the rocks. The ship either spins too slowly, or too quickly, and moves as if it has been blindfolded and spun around until it cried, and its brothers teased it and called it a crybaby

Look out for the alligators! Amphibious delight Mackers, mackers mackers. You have given us PagMan and Mozteriods. Who could ask for more? And yet you insist. Your piece de resistance? Froggr (https://addons.mozilla.org/firefox/2165/). A subtle, strange game in which you push a hapless frog in front of a convoy of tankers carrying toxic chemicals, or perhaps under the wheels of the never-ending stream of fast-moving sports cars. Or perhaps the poor beast is eaten by a hungry, grinning alligator. In all the various ways the frog can die, none is more satisfying than pushing it into a cave at the far end of the field, where it is turned to stone in a wide-mouthed monument to traffic-avoiding, alligator-starving amphibians everywhere. This is perhaps my favorite game of all.

Or several ways to waste time

9


Issue 14 Falling-block puzzles Mr. Stephen Clavering has done it again, in a good way. His Blockfall (https://addons.mozilla.org/firefox/1403/) game is an aestheticly pleasing version of Tetris. It starts off slowly, but increases speed at an adequate rate. The blocks are pleasantly shaded, with excellent hues. In a fit of madness or genius, Stephen has included two additional modes: hexagonal blocks, or triangular blocks. Both are substantially more difficult than the regulation square block. If you think you are a tetris master, you might consider this a challange. Mackers provides an excellent Tetris entry with Xultris 2.2 (https://addons.mozilla.org/firefox/2155/). Although this is a more prosaic rendition of Tetris, the gameplay is quite traditional and quite fun. The animated blue-flame background is a nice touch. Also-rans There are other games available for Firefox, as well. There’s a really nifty car race game called Xoom (https://addons.mozilla.org/firefox/2159/) (by none other than the prolific mackers). There’s a Minesweeper-like game called Mines (https://addons.mozilla.org/firefox/1049/). There are more, many more. Explore the Entertainment (https://addons.mozilla.org/search.php?cat=6&app=firefox&appfilter=firefox&type=E) section of the Firefox extensions repository (https://addons.mozilla.org/firefox/extensions/). These are all quite fun little games. As tastes vary, you may find you enjoy some I didn’t, and despise some I enjoyed. This is the spice of life.

Why games? With all the high-tech, attention-grabbing, CPU-sucking, highly-graphical games in the world, it’s difficult to understand the goodness and fun of these silly little games written in the least-efficient manner possible. Firefox was never designed as a gaming platform, and yet its extensibility has drawn a few adventurous game programmers. Why is this important? In the install instructions, there is no distinction between OS X and MS-Windows, GNU/Linux or *BSD. These are the first games, the trials and experiments. With a little luck, we’ll see bigger, more advanced games written in a truly platform-independent manner, downloadable and playable with the ease of Firefox extensibility, with no question of your platform-of-choice. And if we don’t, these games are still fun diversions, enjoyable in the most fundamental video game tradition: the tradition of Pong and Pacman. I give thanks to Ralph H. Baer. Smiling at me from the bottom of my Firefox window, Abe Vigoda seems to amiably agree.

Notes and resources [1] Winter, David “PONG-Story” (http://www.pong-story.com/),

Biography Anthony Taylor (/user/9" title="View user profile.): Tony Taylor was born, causing his mother great discomfort, and has lived his life ever since. He expects to die some day. Until that day, he hopes to continue writing, and living out his childhood dream of being a geek.

Copyright information This article is made available under the "Attribution-Sharealike" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-sa/2.5/.

10

Or several ways to waste time


Issue 14 Source URL: http://www.freesoftwaremagazine.com/articles/firefox_extension_fun_games

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

Or several ways to waste time

11


Issue 14

12

Or several ways to waste time


Personal privacy: on the web Keep your privacy on the web with a technologically advanced onion By Robin Monks With internet privacy being invaded more and more by governmental agencies, advertising programs and statistical systems (not to mention ISPs gone bad), personal privacy would seem to be a lost cause. But all is not lost! Thanks to some great free software you can make your online presence private once again.

Tor: The onion router An onion router is the most effective way to be anonymous on the internet; it allows you to: • protect your location (that is, your IP address) from websites; • mask the destination of packets you send; • mask the origin of packets from sites and other nodes; • protects the packet’s contents via encryption; It works by “routing” your traffic through various nodes like the layers of an onion. Each node has no idea where the packet came from; also, nobody (except the exit node) actually knows where your traffic will end up. The exit nodes change constantly, which means that you might appear to be from Spain one minute, and from France the next. This makes requests to sites, for all general purposes, untraceable. Each Tor client also has the option of becoming a node or exit node in the network; since traffic from all (except the exit nodes) is encrypted, donating some of your bandwidth to become a node will actually increase your security: even if somebody logs all of your traffic, they will be unable to determine if the logged traffic is yours or if it’s just being routed through your system. This way, deciphering data is as hard as taking the eggs out after you baked the cake! Thanks to Tor’s encryption, routing and constant path switching, Tor is an asset to any surfer. Tor baffles tracking software, crackers and traffic loggers, not to mention being a pretty cheap way to get some extra security over Wi-Fi or on public PCs. On top of all that, Tor also provides a feature called “hidden services” that allows you to run a webserver and get a Tor address (eg: http://6sxoyfb3h2nvok2d.onion/ leads to the Tor “hidden wiki”, you’ll need a version of Tor installed and running in order to view that link) for other uses. A Tor *.onion URL, for all extensive purposes, cannot be traced back to the host machine. (You’d need to ensure that the server is secured, error pages don’t give out your IP, etc.) This makes Tor hidden services a perfect tool for government change groups in countries like China.

Installing Tor There are two methods of getting Tor easily. The first, and easiest, method of connecting to the anonymous Tor network is with the prepackaged TorPark (a Tor and Firefox combination). TorPark is also great on a flashdisk while traveling. The second method, which also allows you to run a Tor node as well as a client, is the official Tor distribution, which is available for most any OS and comes with a nice installer for Windows. Both of these methods use entirely free software; TorPark’s launcher is released under the GPL, Firefox is MPL/LGPL/GPL tri-license and Tor itself is free software under the 3-clause BSD license. I’ll walk though the installation via of both of these methods below.

Personal privacy: on the web

13


Issue 14 TorPark

TorPark running the Harvard Tor test, and passing. TorPark (http://torpark.nfshost.com/) is by far the easiest way to get up and running with Tor. TorPark comes pre-assembled in a zip file. Just download the zip, extract it to a folder and run. TorPark doesn’t require any pre-configuration, the handy launcher configures Tor and launches a bundled copy of Firefox with some handy privacy extensions pre-installed.

TorPark’s startup screen. There are some downsides to TorPark though. Firstly, it only enables Tor on the bundled Firefox. Second, it only runs on Windows (although the author seems willing to develop a version (http://torpark.nfshost.com/faq.html) for Mac). TorPark’s real power shines though when it is used on a USB flashdrive. You can take TorPark to a public library or traveling and not have to worry about privacy; plus, you can take your favorites and extensions with you. The official installer

14

Keep your privacy on the web with a technologically advancedonion


Issue 14

The official Tor installer. Installing Tor with the official installer takes around five minutes and requires only moderate technical knowledge. First, you’ll need to download the installer from the Tor website (http://tor.eff.org/download.html.en) (for this article I used the “Windows development” branch 0.1.1.19-rc). The Tor installer configures Tor, Vidalia and Proxify automatically. The Tor installer is designed to be simple to use. Just answer a few questions, and Volia! Tor’s installed. There is no need to change the default settings unless you know what you are doing, or just want to tinker around with Tor. After the wizard is complete launch Tor. The next step is to go into the browser of your choice and to change the connect settings and set up your proxy to point to Proxify, in most cases that’s 127.0.0.1 and port 8118. Firefox users can download the FoxyProxy extension (https://addons.mozilla.org/firefox/2464/) which sets up Tor with Firefox automatically.

Tor’s server configuration screen. Tor’s UI also makes it easy to set up your own Tor node. Just right-click on the Onion icon in the system tray, select “Configure” and click the “Server” tab. You can also view traffic reports by clicking “Bandwidth Graph” in the system tray menu.

Conclusion I hope this meager article has opened your eyes to a new level of privacy on the web. But don’t stop here! There are many other ways to protect yourself with free software too, many of which you’ll find in the Free Software Magazine Archives (http://www.freesoftwaremagazine.com/search/node/privacy+OR+security) (chances are whatever you’re looking for is in there, somewhere...) And also be sure to check out resources like FreshMeat (http://freshmeat.com) and SourceForge (http://sf.net). Now that your internet surfing is private again, it’s time to work on those pesky neighbors...

Keep your privacy on the web with a technologically advancedonion

15


Issue 14

Biography Robin Monks (/user/35" title="View user profile.): Robin Monks is a volunteer contributor to Mozilla (http://mozilla.org), Drupal (http://drupal.org), GMKing (http://gmking.org) and Free Software Magazine and has been helping free software development for over three years. He currently works as an independent contractor for CivicSpace LLC (http://civicspacelabs.org)

Copyright information This article is made available under the "Attribution-NonCommercial-NoDerivs" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc-nd/2.5/. Source URL: http://www.freesoftwaremagazine.com/node/1508

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

16

Keep your privacy on the web with a technologically advancedonion


Flying high with FlightGear A realistic experience By Alan Berg FlightGear is a top notch and highly accurate free software flight simulator. The software has no kill or be killed situations. Don’t expect arcade like dogfights and precision bombing. Such features are not included. However, with a large range of planes to choose from and with most of the world covered by accurate maps expect a realistic experience as near to a holodeck as software only can allow. FlightGear is platform agnostic, the simulator has been compiled and run under Linux, Windows, BSDUNIX, SGIIRIX, Sun-OS, and Macintosh. A flying experience makes a pleasant change of pace for me. During previous reviews of Bzflags (http://www.freesoftwaremagazine.com/articles/bzflags) and the battle for Wesnoth (http://www.freesoftwaremagazine.com/articles/wesnoth_interview_player): I have been beaten bruised, bashed, shot at and exploded hundreds of times by my irritatingly accurate elder son Nelson. Let’s raise the level of complexity and see who’s the better flyer. If you can’t beat’em then change the rules I say! Expect a realistic experience as near to a holodeck as software only can allow

Before your first attempts at flying Preparation is everything. Preparation is important before any major journey as a newbie pilot. Before running FlightGear for the first time there are a couple of potential issues to note. The first is that the basic download is rather large at 148MB (version 0.9.10). This is made worse still if later you wish to have all the models for the airplanes, flying saucers and maps of the world. For example the map of England is a tasty 58MB in size. For broadband connections this isn’t a real issue, but for road warriors and countryside dwellers this may set a high barrier for first use. A well thought out alternative approach is to buy the three DVD collection (http://cdrom.flightgear.org/) that comes with source code and a highly extensive range of maps and models. This is a good kickstart for the hours, days, and weeks of pleasure to come. The next issue to note is that flight simulators in general are graphics-hungry beasts. FlightGear uses the OpenGL API and concentrates on realism and not an over abundance of irrelevant wow factors. A quality experience is not only dependent on the graphics card itself, but also on the drivers that allow the cards to run at their optimum. Running FlightGear with my old but trusty ATI 9000 card was a little shuddery until I updated to the newest catalyst drivers. After reinstallation I had a responsive ride. That is apart from the sheer stupidity of my many avoidable (by a trained monkey) crashes. And yes I did my best to ignore the nervous laughter of Nelson as I slam dunked my stress ball onto the table for the fifteenth time. Personally, I found using the mouse with the keyboard to pilot an airplane a lot less pleasurable than with a joystick. If you are like me and slowly get addicted to detailed realism then at some point you should spoil yourself with a yoke and associated pedals. Not that it would improve my flying. But hey, “nil desperandum”. I found the short reference (http://www.flightgear.org/Docs/FGShortRef.html) an excellent aid, which I promptly printed and stuck on a notice board next to my computer. This is a good kick start for the hours, days, and weeks of pleasure to come

Beginnings Okay, so I downloaded and installed the minimum package. Loaded in a Jumbo jet and waited for inspiration to hit me. Ten minutes later I realized this was no arcade game. Where was god mode? Where was the power up on engine four? You actually have to understand a little theory before beginning. I decided next to read the shortest tutorial I could find. With one click I had hit pay dirt (http://www.4p8.com/eric.brasseur/flight_simulator_tutorial.html). So, I need an easy to manipulate first plane to fly. The Cessna 172p Skyhawk (1981 model) looked good, and the San Francisco airport (default) and a clear noon day sky gave me enough elbow room to epileptically bounce my first attempts into the sky. There are two ways to run FlightGear, the first is through the command line and the second the more user friendly method is to use a graphical wizard called fgrun. Fgrun can in principle enable all the features that are available through the command line; therefore I chose the wizard to run the simulator. After choosing the

Flying high with FlightGear

17


Issue 14 flight options mentioned previously (partially shown in figure 1), I was off and running. Literally, you find yourself on the runway with an airplane moving forward. A moment of personal crisis and potential washing expenses: I spilled some tea then revved the engine, a cheap escape. I didn’t manage to stay on the runway, but I did finally manage to get the so called easy to fly plane in the air. Having read the tutorial, I realized to rev the engine up I needed to press “page up”. I know you don’t believe this incredible fact, so I have included figure 2. Yippee, my first flight. Pressing ‘v’ allows you to easily change views. This gives you a good idea where you are in orientation relative to the ground. I found the helicopters perspective the most intuitively descriptive. The next important milestone was a professional landing. After a number of tries I realized that unless you like simulated broken teeth then you need to go back to the tutorial and read the relevant procedures. So “shift + b” toggles the break and your speed needs to be around 172 km/hour at height X. And, yes, the guidelines really do work. I landed well... perhaps not where one would normally land, but pretty near. Scared a few trees and bounced up and down like jelly on a washing machine. But that’s our secret... right? A moment of personal crisis and potential washing expenses: I spilled some tea then revved the engine

Figure 1: Now shall I fly the jumbo or the UFO?

Figure 2: Alan makes his first flight, sort of After landing I was really quite motivated and practiced navigation, banking, loop the loop and all the other fun things such an easy to pilot airplane lets you do. After a couple of flight hours I had built up most of the basic skills that would be required in a real life situation. It took me ten minutes from scratch to show Nelson how to take off and land. He was really pleased, especially with the A10 looping through 3D clouds. I have the feeling that if ever I meet Nelson in battle with a TIE fighter I won’t last long. I’ve just sharpened his skills up considerably. Yes, very annoying indeed. I had built up most of the basic skills that would be required in a real life situation

18

A realistic experience


Issue 14

Mapping reality Now that I was addicted, I decided to try and expand on the range of features used. Installing extra airplanes is as simple as it will ever get. You download a tar gunzip archive file and expand the archive into the home directory of FlightGear under the subdirectory \data\Aircraft. The next time you run the wizard you will see the new model as an extra choice. I particularly liked the concord, X15 and YF-23 models. Though I must admit Santa Claus (figure 3) did come in a close second. There are tutorials on building your own models. So if you want to help space tourism with your own special design, why not try here?

Figure 3: FlightGear is known for its 100% realism. Santa Claus is coming to town Another nice feature of the simulator is the ability to place other fliers on the same map and potentially interact. Working direct from behind my cable modem at home I set the following parameters in the fsgun wizard for multiplayer mode: Multiplayer tick box: (ticked) Callsign: What ever you want. Hostname: mpserver01.flightgear.org in:10 out:5000

And I was in. Extra points were won by the developers of the program. A Google Maps based service (http://mpmap01.flightgear.org/) showed me where I was in respect to the rest of the players (as shown in figure 4).

Figure 4: Callsign AlanB on a specially written Google maps. Notice how I appear to have crashed—15 feet When I get the necessary time with Nelson we will practice formation flying and chicken against each other.

A realistic experience

19


Issue 14

The inevitable interviews After explaining the very minimum of features I thought I would call some expert and not so expert witnesses in defense of this great product. Expert witness X Flight Simulator Engineer for almost twenty years—Allen Cook AB: How long have you been a flight simulator engineer and for which companies have you worked for? AC: I have worked for 18.5 years for Link-Miles/Thomson/Thales Training and Simulation. AB: What do you think of FlightGear? AC: Reading the blurb, many of the techniques employed are the same as used for real flight simulators. If it does all it says with some degree of realism and accuracy, then it could provide useful training for would be pilots or navigators. AB: How does it all stack up against a real ultra expensive flight simulator? AC: These “desktop” type simulators are generally only used for procedural training or aircraft familiarisation, instrument and navigational training. The original Link simulator provided this kind of training for a single aircraft type with the exception of an out the window visual, but with some basic motion and force feedback. The patent for the original Link Aviation trainer was filed in April 1929. In order for the training to be “positive”, however, there needs to be comprehensive objective tests for each aircraft type and variant, coupled with subjective testing by a current qualified and experienced pilot. These tests need to be frequently updated and monitored in order to keep pace with navigational data bases and aircraft updates. The level of training proficiency gained from these types of devices can then augment higher level simulation or real aircraft training. If instruments or navigational or aircraft handling were inaccurate or misleading, this could provide “negative training”, which for obvious reasons would be highly undesirable for would be real-life pilots. However, as an educational or entertainment tool, it should provide a good taster of what it really takes to fly a real aircraft. AB: Can anything in FlightGear be improved? AC: Every single aspect of a simulator can always be improved. However, as mentioned above, the most important thing is to provide positive training. Witness Y A ten-year-old man flying for the first time—Nelson Berg AB: So how does it feel to be a pilot? NB: A bit scary because you don’t know 100% what the plane is going to do. AB: Which airplane did you enjoy flying the most? NB: The A10 with the 3D clouds. AB: Any suggestions for improving the game? NB: I’d like a real arcade mode. AB: How hard was it to land? NB: Very hard.

20

A realistic experience


Issue 14 AB: Will you fly again? NB: Yes, I look forward to flying again? AB: Why? NB: Because it feels like you are part of the game. Sorry simulation.

Conclusions So, there you have it, from an avid ten-year-old game player. FlightGear, though it doesn’t fall under the category instantaneous gratification, does grab the attention and keeps it. Better still from a parental point of view, you have an opportunity to teach your kids the basics of flying via “positive training”. Of course, it goes without saying that you need a bit of patience yourself and some pre work. But where else can you fly a realistic model of concord for the price of electricity and some good old fashioned humiliation.

Acknowledgements Allen Cook currently resides in Perth, Australia, where he is a consultant hungry for new opportunities and challenges.

Notes and resources An excellent first tutorial (http://www.4p8.com/eric.brasseur/flight_simulator_tutorial.html) Atlas map server (http://atlas.sourceforge.net/) FlightGear home (http://www.flightgear.org) FlightGear WIKI (http://www.seedwiki.com/wiki/flight_gear/flight_gear.cfm) OpenGL (http://www.opengl.org)

Biography Alan Berg (/user/8" title="View user profile.): Alan Berg Bsc. MSc. PGCE, has been a lead developer at the Central Computer Services at the University of Amsterdam for the last seven years. In his spare time, he writes computer articles. He has a degree, two masters and a teaching qualification. In previous incarnations, he was a technical writer, an Internet/Linux course writer, and a science teacher. He likes to get his hands dirty with the building and gluing of systems. He remains agile by playing computer games with his kids who (sadly) consistently beat him. You may contact him at reply.to.berg At chello.nl

Copyright information This article is made available under the "Attribution" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/flightgear

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

A realistic experience

21


Issue 14

22

A realistic experience


Writing documents with OpenOffice.org Writer ...because using a word processor isn’t enough By Marco Marongiu Everybody uses word processors, but very few people use them in the right way. Maybe it’s time you learned to use your word processor with... style! Despite their obvious advantages, WYSIWIG word processors have a fundamental drawback: people get interested in the final layout of the document too soon, and concentrate less on the content, which is exactly the opposite of what one should do when writing a document (and, by the way, it’s also the opposite of what happens with systems like LaTeX, where you are required to take care of the content first, and concentrate on the visual side later). With WYSIWIG word processors people get interested in the final layout of the document too soon Taking care of the layout too soon has inauspicious consequences. Suppose you are writing a report, for example. You start writing and, before you’re finish, you start messing around with fonts, font sizes, text alignment, colours and so on; you also mark important keywords in a bold, italicised typeface so that they stand up clearly through the document. Then you bring the document to your boss for a review; he likes the idea of the highlighted keywords, but he doesn’t like the formatting and asks you to make them just bold. Now, since you didn’t mark keywords logically as such, you have to select them one by one and change the formatting. And you start crying of course, because you know you’re going to waste a lot of time doing a stupid and boring job. Not to mention that when you take the document to the boss to review it again, he will also ask you to change the fonts and alignment of the titles... or worse, ask you to put the italics back because he likes it better the way it was. Well, I’m here to help you in doing first things first. A little history It all started in 1989, with the first release of Microsoft Word. Soon after, in 1991, Word 2.0 was released and it finally brought WYSIWIG text processing to the masses. WYSIWIG, as you may already know, is an acronym for “What You See Is What You Get”, which means that you can set the layout of a document on the screen, and that will be the layout of the printed document. Everybody uses a word processor nowadays. You do, too.

What you need To make the most out of this article you need: • a PC • a good Word Processor, like OpenOffice.org Writer (http://www.openoffice.org/product/writer.html) is! • patience and relax: don’t hurry • a simple, short document to write, like a letter

Step 1: start OpenOffice.org Writer

Writing documents with OpenOffice.org Writer

23


Issue 14

Figure 1: The graphical interface of OpenOffice.org Writer Start the program. Probably you already have a “OpenOffice.org Writer” item in your menu; in GNOME it’s usually in the “Applications” menu, under the “Office” submenu. Or you can run the oowriter command straight from a terminal window. Once you start it, you’ll see a window like the one in figure 1. This is the graphical interface of OpenOffice’s Writer module.

Step 2: start writing

Figure 2: Start writing, concentrating only on the content Start writing. Care only about the content. Don’t be concerned about the fonts, don’t be concerned about font sizes, don’t be concerned about anything but the content. Start writing. Care only about the content. Don’t be concerned about the fonts, don’t be concerned about font sizes, don’t be concerned about anything but the content

Step 3: once finished, think about the style Once you are done with the content and you are happy with the things you wrote, it’s time to do a kind of document make-over.

24

...because using a word processor isn’t enough


Issue 14

Figure 3: Doing things with style: start here Open the “Format” menu and look for the “Styles and Formatting” item (see figure 3), or just press the F11 key. You will get a pop-up window where you can select and modify existing styles, or create your own.

Figure 4: Modifying the default style Many of the styles are based on the “Default” style. Hence, if you want to change, say, the font of nearly the whole document you can start modifying this one. Look for the “Default” item in the pop-up window, right click and select “Modify...” (see figure 4).

Figure 5: Changing the “Default” style A new window pops up. From this window you can define almost all aspects of the style. For the moment just change the font family, by choosing a beautiful Bitstream Vera, sans-serif font (one of my favourites, and it’s released under a free license too!). As soon as you press the “Ok” button you’ll see how the fonts of the entire

...because using a word processor isn’t enough

25


Issue 14 document suddenly change to reflect your choice.

Step 4: logically restyle individual parts of the document Now it’s time to think about the text from a logical perspective, and apply styles according to the logic. In the specific case of our letter, it’s easy to decompose it into a few blocks, each one playing a specific role: 1. the address; 2. the opening, that is: the salutation that opens the letter; 3. the body of the letter, where the real content of the message is; usually, that’s the biggest part of the letter; 4. the closing, that is: the salutation that ends the letter; 5. the signature, that is: your name (and some room for the real signature that you will write by hand). Each of these parts need different formatting. Start formatting the body.

Figure 6: Starting the real styling: we select the body of the letter to redefine its style Select it with the mouse, then go to the styles pop-up. The “Text body” item is active: as shown before with the Default style, just right click on it, select “Modify...”, then change the style however you want. In my case, I just added some vertical space at the end of each paragraph (want to know how to do it? keep reading!) and indented the first line, but you may want to experiment by changing different parameters and seeing the results of your customisations: it’s an interesting experience!

Figure 7: Customising the signature style You can customise all the other parts of the document in the same way, for example: select the signature, look up the “Signature” style in the pop-up and apply it; if you don’t like it, just customise it the same way as above. Go on and customise all the other parts.

26

...because using a word processor isn’t enough


Issue 14 Think about the text from a logical perspective, and apply styles according to the logic

Step 5: adding you own styles In the letter above, I intentionally “forgot” to put in a subject line. Now I’ll show you how to add one, customise it and create a style out of it.

Figure 8: Creating a new style from selection First of all: type in the subject line. Once you are done, select it, right click and select “Paragraph”: that’s where you will define how a subject line should appear.

Figure 9: Creating a new style from selection: styling the text In this case, I just wanted the line in a bold face, so that it stands out and you can easily locate what the letter is about; I also added some room below it. In figure 9, you can see how you can set a 1.00cm space below the paragraph.

...because using a word processor isn’t enough

27


Issue 14

Figure 10: Creating a new style from selection: making the style out of the text Having done that, press the rightmost button in the pop-up and select “New style from selection”.

Figure 11: Creating a new style from selection: naming your style You are then prompted to name your style. It is better that you adopt some kind of naming convention, so that you can easily recognise your styles from the bundled ones. In this case, I chose to prefix my own styles with the word “My”, e.g.: “MySubject”, “MyFirstLine” and so on. Having dealt with with the subject line, repeat the same steps to create new styles every time OpenOffice.org doesn’t provide one that fits your needs.

Updating existing styles: an easier way Going through a tabbed pop-up window to personalise a part of a document is not a hassle (or, at least, that’s my opinion but yours could be different). Really, is there no easier way to modify an existing style?

28

...because using a word processor isn’t enough


Issue 14

Figure 12: Updating a style from a selection Well, actually there is. As before, select a part of the text you have already styled (in figure 12, I selected the closing of the letter, styled with “Complimentary close”), then modify it using the normal tools available in the interface of the program (e.g.: click on the buttons to align the paragraph to the centre, change margins interactively using the cursors in the upside ruler and so on). After you’re done, click the rightmost button in the pop-up again, choosing “Update Style” this time. The style is automatically updated with the changes you made to the text.

Summing up: is it worth it? This was just a little example, and you may well wonder if the procedure shown is general enough. Well, actually it’s not. The aim of the article was to show why using styles should be preferred over sloppy formatting, not to give a general procedure on how to write documents. It isn’t wise, for example, to write a document of some tens of pages and leave it to the very end to style the text. Styled documents are ready for automation So, for longer documents, what you should do? Well, now that you know that styles are important, just apply them on the go. When you are writing a level 1 heading, mark it as such! When you are writing the body of the text, do the same. Once all your text has been completely marked, you can make any changes to your document and you won’t be worried if your boss wants dark red, widely spaced headings or wants to change the font of all the text body. (Even if you don’t have a boss that requires you to write reports, you are exposed to the same problems anyway. Using styles will solve them!) Another advantage is that styled documents are ready for automation. What do I mean by that? Well, many things... Inside-document automation Big documents always have a table of contents. If you styled your documents marking the headings, then OpenOffice.org can create and update the table of contents for you because it knows which parts are headings and where they are (the page number). Creating a tables of contents by hand is a real pain; worse, updating it when parts of the document are changed can lead to suicide! So, why not let something else take care of it for you? For this functionality look in the “Insert”→“Indexes and Tables”→“Indexes and Tables...” menu. Outside-document automation You may want to know that an OpenOffice.org has a lot of XML under the hood. Therefore, if you logically marked the parts of your document and you know what you are doing, you can extract information from the document even if you don’t have an OpenOffice.org installation at all! Of course, if the whole document is just a sloppily-formatted, Default-styled document, it provides the same amount of structural information that a plain text files does (which means: almost nothing). However, if you write your documents wisely then you

...because using a word processor isn’t enough

29


Issue 14 can, for example, automatically create a pretty web page with all your documents’ titles and abstract. So, if you’ve never written your documents with style, it’s never too late to start. Begin today, and after a short time you will ask yourself why you never did it before!

Biography Marco Marongiu (/user/26" title="View user profile.): Born in 1971, Marongiu graduated in applied mathematics in 1997; he's now a full-time system administrator for a European ISP. He's also a Perl programmer and technical writer and lecturer by passion, and is interested in web and XML related technologies. Marongiu has been a Debian User since version 1.1.10 and he helped found the GULCh Linux Users Group (Gruppo Utenti Linux Cagliari), the first one in Sardinia. He recently became a father to his first son Andrea, and he's been trying to reorganise his life since, so that he can start writing technical articles again and holding seminars.

Copyright information This article is made available under the "Attribution-NonCommercial" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/openoffice_writer_intro

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

30

...because using a word processor isn’t enough


Baby steps with The GIMP Making a web banner using The GIMP By Rosalyn Hunter Have you been planning on getting around to learning how to use the GIMP someday? Well now that the GIMP has had its tenth anniversary, it’s about time to start. In this article, I will walk you step by step through the process of making a web banner using the GIMP. Hopefully this kickstart will encourage you to do more playing on your own. Long regarded as one of free software’s “killer apps”, the GNU Image Manipulation Program (GIMP) is a tool that has amassed a large number of users and is one of the most popular free software applications today. The different versions of GIMP vary slightly in the way they are laid out. For this tutorial, I have used version 2.2.10 the most current stable version at the time that I am writing this article. The best way to learn from this tutorial is to open GIMP up and follow along as I explain how to make a web banner. It’s virtually painless, so take a seat and let’s begin.

Opening GIMP GIMP saves the status of your open windows, so starting the program can sometimes cause a dizzying cascade of windows to open that can be quite overwhelming to the new user. The only window that you absolutely need to have open to begin is the tool window. It is the small window containing all of the icons. It is titled “The GIMP”. To start, close all other windows until you need them.

The GIMP main tool window The only window that you absolutely need to have open to begin is the tool window Now that we are alone with the main GIMP window, let's take a look at it shall we? It has three menu items: File, Xtns, and Help. The File menu has your basic Open and New options as well as something called Acquire. If you have a scanner, you can configure GIMP to work with it, and your scanner interface will be found here. Acquire also has an option called screen shot which will allow you to grab an image of a window. Xtns has plugins and scripts for advanced users. Ignore it for now. Help is very useful for new users, so take some time to see what the options do later. Now we will return to the main part of the tool window. The major part of the tool window is taken up by several little icons. If you hold the mouse over each icon, text will pop up explaining what it does.

Baby steps with The GIMP

31


Issue 14 The bottom of the window shows the tool options. This will change as each tool is selected above. The tools can be changed to do many things allowing you a great deal of freedom. Since GIMP is an image processing program it is best to begin with an image. Select the file menu and open an image file. I started with a digital photograph that I took named sunset1.jpg. I suggest that you simply open an image currently on your computer to practice with.

My starting image: sunset1.jpg I want to use this image to make a web banner to put on a new webpage called “My nature page”. The size and shape of this image is wrong for a web banner, so I first need to cut down the image. To do this, I use the crop tool.

The crop tool The crop tool is the one that looks like a little craft knife. When you select the tool the cursor changes. Make a box by holding down the left mouse button and pulling it across diagonally from the top to the bottom. Select the most important part of the image. Your selection will be highlighted. Once you have drawn the box, you can adjust the size by selecting one of the dark squares on the corners and moving it while holding down the left mouse button. The size in pixels is displayed in the crop/resize tool window that pops up when you use this tool. You can change the units to inches or whatever you like best by selecting the little px next to the number. To specify a size, grab a corner of the selection and move it slowly while looking at the tool window. I resized my image to have a width of 1600 and a height of 500. When you are satisfied with the selection, hit the crop button. Once you crop the image, all of the rest of the image is gone! If you really didn’t want to erase the rest of the image? Don’t panic. Click the right mouse button over the image screen and a menu will pop up. Go to edit, and the top menu item says “undo crop image”.

32

Making a web banner using The GIMP


Issue 14 GIMP has a long undo buffer and you can go back several steps if you need to. However,the best way to make sure that you don’t destroy the original image is to save your new image under a different name. GIMP has a long undo buffer and you can go back several steps if you need to Right-click on the image to open the menu, then under the File menu choose “Save as...” to save the image with a new file name. I saved my cropped file as sunset1banner.jpg. Redundant menus There’s more than one way to get to the menus in GIMP. For example, you can merge layers by right-clicking on the layers dialog box and selecting Merge Visible Layers..., you can right-click on the image and select the Layer option which has Merge Down as an sub-option, you can use the Layer menu found on the top of the image window, or you can use the keyboard combination Control + M. You can save a file using the menus on top of the window, or by right-clicking and using the Save as... option in the File submenu found there. The main GIMP window won’t have a save button, because you must save each window separately. In this tutorial, I tend to get to the menus by clicking the right mouse button over a window; however,you can also use the File menu on the top of the window. There are also keyboard combinations that do specific functions such as control-z for undo. To learn more about these combinations, look at the online GIMP manual (http://docs.GIMP.org/en/). GIMP almost always gives you options after you press Save. You have lots of control over the quality of the saved image. Take the defaults for now, as you understand more, you may want to change the settings. We now have a long, banner-shaped image, but you can’t easily read text over a very colorful image, so we need to lower the contrast a bit. This can be done using layers.

Using layers A layer is a separate level of the same image. In GIMP you can put different images on different layers, just as in old cell animation, where images were painted onto layers of clear plastic over a paper background. To begin, open the layers dialog box. To do that, go to the tool window and select: File/Dialogs/Layers. The layers dialog box will pop up somewhere on the screen. Move it so that you can easily see it. I usually like to stretch the window a bit to make it longer. The layers dialog box currently shows one layer marked “background”. It shows a thumbnail of my image. To add another layer on top of this one, we click the new layer button. Look on the bottom of the layers menu. There are some icons. The left-most icon looks like one piece of paper. Clicking on that icon creates a new layer.

Making a web banner using The GIMP

33


Issue 14

The new layer button First, a window will pop up asking you details about the new layer. You can change the name of the layer, but for now just use the default name “New Layer”. You have the option of making the image white or transparent. Choose white. Click OK and your original image will turn white. No the image is not gone. It is just as if we placed a nice white sheet of paper on top of it. Look at the layers dialog box. There are now two layers shown. A white layer on top called “New Layer”, and the background, our original layer. To the left of each is an eye. This shows the visibility of the layer. Go to the eye next to the New Layer, click on it, and the original image will reappear. The eye toggles the visibility of the layer. Please notice that New layer is still selected in the layers menu. If you make changes to the image now, you will only be making changes to the selected layer whether you can see the changes or not. Now click the place where the eye was on the layers menu, and turn visibility back on for the New Layer. The screen will appear white again. The goal is to subtly introduce the impression of the picture beneath onto the white layer above. We can do that by using the opacity button that you can find on the layer’s dialog box. Make sure that New Layer is selected, and hold down the left mouse button over the opacity slider. Slide it to the left and you will begin to see the opacity change. You can now see the background image through the white layer. To my eye the image looked best at 69.9% so I stopped at that opacity, and tried to save the image. The program would not let me save. It gave me the error “jpg can’t handle transparency, flatten image”. You may ask, “Isn’t the image that I am working on now a jpg?”. The simple answer is no. GIMP requires a special format to save all of this complex information. The default image format for GIMP is XCF, and if you want to save all of your layers as they are for later, then you must save the file in XCF format. We can do that now by selecting File/Save as... and change the last part of the filename to .xcf instead of .jpg. In the lower left hand corner of the save image box there is a line that says “Select file type (by extension)”. This means it reads the letters after the dot to determine how to save the file. Only XCF files save directly. Every other type must be exported by the program. Isn’t the image that I am working on now a jpg? The simple answer is no. The default image format for GIMP is XCF.

Exporting to jpg So now we know how to save the file in XCF format, but what you probably wanted to save was a jpeg file. You are probably wondering, “How do I save what I am seeing as a jpeg so that I can show it on my

34

Making a web banner using The GIMP


Issue 14 website?”. To do that we must make one image out of the layered image. We also must remove any transparency. In order to combine the two images into one, go to the layers menu and right-click over the image thumbnails. A menu will pop up. Select “merge down” and the two layers will be combined into one layer. This image still may contain transparency data, so you have to flatten the image. right-click in the layers menu, and select Flatten Image found at the bottom of the menu. Now you can save this file as a jpeg. To save, go to the image window and select File/Save as.... Change the last part of the filename to .jpg. I saved my file as sunset1bannerwhite.jpg.

Shading the banner After saving this jpeg file, I realized that I didn’t want the banner to be white. What can I do about it now? Quite a lot, because the changes can be undone. To do this, I right-click on the image, and choose Edit/Undo Flatten Image, and keep undoing until I have the two layers that I originally started with. The image window will show a white screen again. Deja vu. Because I like the ethereal quality of the orange light shining through the blades of grass, I want to tint the image orange like the sunset. To do this, I select the color picker tool, it’s the one that looks like an eyedropper dropping something. To follow along, pick a color that you like from your background image.

The color picker tool First, make the new layer invisible by clicking the eye next to it so that you can see the original image. Make sure that the background image is selected on the layers dialog box. The cursor will change to look like a dropper. Pick a color by clicking the tip of the dropper on the image. The color chosen is shown in the color picker tool window. I picked the most intense orange that I could find. It took me several tries to find the color that I wanted. You should pick a deep color because it will fade when we reduce the opacity. The orange color appears in both the color picker window and on the main GIMP tool window. This means that this color will be used with whatever drawing or painting tool is used next. Select the layers dialog box and change the selection back to the New Layer. Turn the visibility back on. Then select the tool icon that looks like a bucket of paint. This is the fill icon.

Making a web banner using The GIMP

35


Issue 14

The fill icon When you click this on the white screen the entire screen changes to the color that you have selected. It is a common error to forget to change the selection in the layers dialog box. If you did that here, some portion of the background image would be dyed. Just remember that you can undo mistakes. Grabbing the opacity slider with the cursor, reduce the opacity until it looks good. I chose 47%. To save this intermediate, merge down and flatten the image. Then you can save it as a jpeg. I named mine sunset1bannerorange.jpg.

Adding Text To add a title we can write text on top of the image. The text tool is the one that looks like a large letter T on the tool window. Select the T and click on the image.

The text icon In earlier versions of GIMP, you first had to make a new transparent layer to put the text on if you wanted to keep the text seperate from the image. Now this is done automatically. When you click on the image, a window pops up to take the text. The words that you type can be seen on the image. On my image, the words were tiny and orange. I forgot to change the color back to black! The settings for the text tool can be found at the bottom of the tool window when it is selected. There are settings for font, size, color, etc. Clicking on color reveals a window that will let you choose from a spectrum. If you click all of the way to the left, you can choose black. Then press OK. The words on the banner are now black. If you prefer a fancier title font, change the font settings. I chose “freemono bold oblique� and increased the size to 100px.

36

Making a web banner using The GIMP


Issue 14 To move the location of the text, select the move icon. The move icon is the one that looks like a plus sign made out of arrows. When you select it and then click on the image, the cursor changes to a pointing hand. Holding it down over the words allows you to move them around until they are in the desired position.

The move icon

Resizing images To finish the banner, flatten the image, and save it. I saved my image as titlebanner.jpg, and then put it into my webpage. When I looked at my page, I found that the image was much too large. To change the size of the image, right-click on the window containing your image to open the menu, choose the Image sub-menu, and select Scale Image.... A window pops up asking you to set the new size. I set the length to 800px and pressed enter. It automatically adjusted the height to 250px so the ratio of width to height remained the same. Adjust your image to the size that you want, then click Scale. I saved this smaller banner as titlebanner800.jpg. GIMP is a great tool for making images for websites

My nature page When I put this new banner on my web page, it finally looked the way that I wanted it to. GIMP is a great tool for making images for websites. The background image The background image on the nature page was made in much the same way as the banner was. An image treebranches.jpg was loaded and a white layer was placed over it and shaded to form a nice background color. The background image was changed to make a tileable image by using Filters/Map/Small Tiles... found by right-clicking on the image.

Making a web banner using The GIMP

37


Issue 14 As you can see from this brief tutorial, GIMP allows you to take an image and alter it through a wide variety of methods. This tutorial only scratches the surface of what GIMP can do. To learn more, I suggest that you read the GIMP manual, try other tutorials, and simply play around with the program. Perhaps soon, you will find GIMP as indispensable a tool as I do. Enjoy.

Further reading and resources Help for GIMP is extensive. The program documentation contains an entire color manual that you can read with a browser. You can also get help by clicking on the help button found in the main GIMP window. Use “context help” to get specific help for a tool or menu item. List of GIMP resources: • GIMP.org (http://www.GIMP.org/)—The official GIMP website. • GIMPguru.org (http://www.GIMPguru.org/)—The site for those using GIMP to edit photographs. • GIMPsavvy.org (http://GIMP-savvy.com/)—A pretty complete looking book that can be bought or downloaded by tarball. Designed for an older version of GIMP. • manual.GIMP.org (http://manual.GIMP.org/)—Official GIMP manuals in several languages. • GIMPtalk.com (http://www.GIMPtalk.com/forum/board.php)—A forum for GIMP users.

Biography Rosalyn Hunter (/user/36" title="View user profile.): Rosalyn Hunter has been on the internet since before the web was created. Born into a family of instructors, she has made it her life's goal to teach others about the important things in life, such as how to type kill -9 when a process is dead. She lives in a little house on the prairie in the American West with her husband, her three beautiful children, a cat and a dog.

Copyright information This article is made available under the "Attribution-Sharealike" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-sa/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/make_banner_gimp

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

38

Making a web banner using The GIMP


Free Open Document label templates Using the right tools to save time and effort By Solveig Haugland If you’ve ever spent hours at work doing mailings, cursed your printer for printing outside the lines on your labels, or moaned “There has got to be a better way to do this,” here’s the solution you’ve been looking for. Working smarter, not harder, with the OpenOffice label templates will save you time, effort, and (if you want) make really cool-looking labels.

Using the right tool for the job I believe in using tools. And if the tools are easy to use and free, so much the better. That’s why I’m a big proponent of using templates. Templates are one of the best ways to save time, effort, and be sure that your documents are consistent when they need to be. Templates make life easier when you use them for letters, documents, brochures, etc., but they really make life easier when you use them for labels. The spacing for your label documents has to be extraordinarily precise to make sure that the text is printed exactly where it needs to be—I’ve tried making my own and while it’s possible, it’s really not worth it. It’s not worth it primarily because there are so many excellent pre-existing templates to use instead. There might be a few sheets of labels somewhere without a corresponding OpenOffice.org label template, but they’re rare. You can print on virtually any label sheets you want with the templates included in OpenOffice.org, and the templates available on the web, such as those from WorldLabel. This article is about how to use the OpenOffice.org templates, in particular the WorldLabel templates, to print the labels you need. I’ll talk about how to download them, install them, use them as they are, and how to customize them with graphics and other features. I’ll also touch on how to use the OpenOffice.org label wizard; you can use the label wizard each time, or save the template you create in the same template repository with your WorldLabel templates.

About WorldLabel WorldLabel lets you download free templates (http://www.worldlabel.com/Pages/openoffice-template.htm) in OpenOffice.org format. You can download label templates in .stw or .ott file format for Openoffice.org 1.1x and 2.0 versions for Writer. You can look them up by the number on your Avery label sheet box or read the description. There’s a huge number of templates including those for CD and DVD, video, mailing, shipping, and diskettes, and with square or round corners. The templates are XML Open Document Format (ODF), Public Domain, licensed under GPL.

Downloading WorldLabel templates The first step, of course, is to get the templates onto your computer. First, make a directory where you’re going to put them. Create a directory at C:\labels or home/labels, for instance, though you can put them wherever you want. Next, go to the URL for OpenOffice.org templates. • If you want letter-size templates (this is what you want in the US) go to this URL (http://www.worldlabel.com/Pages/openoffice-template.htm). • If you want A4 sized templates go to this URL (http://www.worldlabel.com/Pages/openoffice-a4.htm). You can also just download one template at a time. You’ll see a list of templates. Find the one you want, by its corresponding Avery number (this is printed on your box of Avery labels), by the dimensions, or by the

Free Open Document label templates

39


Issue 14 name if you know the WorldLabel name.

Figure 1: WorldLabel templates To download the template, find the “Download” link, under the version you want. If you’re using the current version of OpenOffice.org, use the link under the 2.0 version for .ott files. Then right-click on “Download” and choose “Save Target As...”. When the dialog box appears, specify the labels directory that you made, and click “Save”. Repeat the downloading steps for any additional templates you want.

Installing the templates in OpenOffice.org Once you’ve got the WorldLabel templates, you should add them to the template repository and tell OpenOffice.org where they are. Strictly speaking, you don’t have to do any of this, since you can simply choose File→Open and find the template file. However, OpenOffice.org has a specific way to organize templates which is easier to use once you’ve got it set up. This applies to any template that you download, as well as any template that you create. There are several ways to do this; I’ll show you three. Copying to a directory Copy your templates to the appropriate directory. The directory is (OpenOffice)\share\template\language. Just paste your directory of templates into that location.

40

Using the right tools to save time and effort


Issue 14 Figure 2: Copying templates to the templates directory Importing a single template That other way was so easy, why bother with anything else? Good question. This approach is good if you want to just bring in a particular template and maybe put it in another category like “templates for the month-end reports”.

Figure 3: Choosing to import the template 1. Choose File→Templates→Organize. 2. Select a category on the left. (If you need to create one, right-click on an existing category, choose “New”, and immediately type the name of the new category.) 3. Right-click on the category and choose “Import Template” (figure 3). 4. Find the template and click “Open”. 5. The template will appear in the category.

Figure 4: The imported template appears Pointing to a directory of templates locally or on the network Why would you need yet a third way to point OpenOffice.org at your templates? If you’re a system administrator, you want to make things easy on yourself. Therefore you might want to put all the templates on the network and just point each user to them. Here’s how. 1. Put the directory of templates on the server. 2. Important: Create at least one subdirectory and put the templates there. It’s odd, but OpenOffice.org recognizes the subdirectories when you do it this way, but not the main directory. You’d have something like figure 5. 3. Choose Tools→Options. 4. Go to OpenOffice.org→Paths and select the “Templates” line.

Using the right tools to save time and effort

41


Issue 14 5. Click “Edit”. In the window that appears, click “Add”. Specify the path on the network. Note that you can have several paths to templates (figure 6). 6. Click “OK”, then click “OK” twice more to save changes and close the window.

Figure 5: Your template directory

Figure 6: Pointing to the shared templates Note: There’s another way to add a template to the repository, but it’s more useful when it’s a template you create yourself, or create based on one of the wizard templates. I’ll talk about that approach later.

Using WorldLabel templates Now that you’ve installed the templates, the rest is easy. Just choose File→New→Templates and Documents. You’ll see the templates window and your templates; if you don’t, select the “Templates” icon at the left.

42

Using the right tools to save time and effort


Issue 14

Figure 7: OpenOffice Templates window Double-click the templates category you want, then select the template you want. Any information about the template will be displayed (figure 8).

Figure 8: Selecting the template Double-click the template; it will open, as shown (figure 9).

Figure 9: A new document based on the template To add information, just click in the area where you want label information, and start typing (figure 10). Press “Return” to go to a new line, then press “Tab” twice to go to the next label area.

Using the right tools to save time and effort

43


Issue 14

Figure 10: Moving between labels To format text, just select one or more labels. To select all of the labels, click in the text for one, then press “Ctrl + A”. Apply formatting as you would normally, either with the toolbar, or by choosing Format→Character or Format→Paragraph.

Figure 11: Formatting labels When you’re finished, just print and insert the correct sheet of labels in your printer.

Customizing a WorldLabel template You might be wondering how the WorldLabel templates are created, especially if you’ve used the wizard templates, which are based on Frames. The WorldLabel templates are created with tables; you don’t see the borders since they’ve simply been formatted that way. If you take a close look, though, when you click in the template, you can see the table toolbar.

44

Using the right tools to save time and effort


Issue 14

Figure 11: Labels and the table formatting toolbar This means you have all the formatting capabilities that you normally get with a table, including the following: • alignment to the top, middle, or bottom (you might want to align your labels all the top), • background formatting—you can apply a color to the background of each cell, • easier cutting and pasting than with frames, • easier selection of all the content of a row, column, or the whole table, • easier copying and pasting; you can easily select the whole table and copy it onto the next page, to make multi-page sheets of labels. To apply values to the table, like backgrounds, choose Table→Table Properties and choose the appropriate tab (figure 12).

Figure 12: Formatting labels using the Table window To do things to the table, choose View→Toolbars→Table (figure 13).

Using the right tools to save time and effort

45


Issue 14

Figure 13: The Tables toolbar Showing and hiding table borders I find that tables are easier to work with, when you’re doing any extensive customization, if the borders are visible. To see the borders of the table, select the whole table. You can simply click in the upper right cell and drag down to the lower right cell, or click in one of the cells and press “Ctrl + A”. Then click and hold down on the indicated borders icon in the Tables toolbar, and choose the lower right option for borders on all cells (figure 14).

Figure 14: Adding visible borders to the labels The table borders appear. As you can see there are actually five columns, including the two spacer columns (figure 15).

Figure 15: Labels with visible borders

46

Using the right tools to save time and effort


Issue 14 To take the borders off later, just repeat those steps but choose the upper left option for no borders on any cells. Pasting into label cells Table-based label templates are much easier to paste content into. Let’s say you’ve just got a table somewhere else and you want to make labels out of it. Don’t worry about the dimensions of the original table. You will have to do some formatting once you’ve pasted, though, so this should be done if the time for reformatting is less than the time for retyping.

Figure 16: Selecting content to copy 1. Select one column of content (two columns won’t work since the separator column is in the template) and copy it (figure 16). 2. Go to the label template, click in one cell, and paste. The pasted content will fit into the label template, taking on the correct dimensions (figure 17). 3. To apply the correct formatting (you can do this after you’ve pasted all the content), select the pasted content and from the styles dropdown list, select Default (figure 18). 4. With the pasted content still selected, choose Format→Paragraph, click the “Indents & Spacing” tab, and specify .07 inch in the first two fields (figure 19). 5. Click “OK”.

Figure 17: Pasting content into the labels template

Using the right tools to save time and effort

47


Issue 14

Figure 18: Applying the Default style

Figure 19: Applying the correct indent Note: You could also update the Default style to be indented .07 from each side. Pasting one cell into multiple label cells Let’s say you’re making moving labels, or business cards, or something else where you need exactly the same information in every cell. Rather than pasting into each cell individually, you can copy the text once, then paste into every cell. 1. Select the content to paste, as plain text. You don’t need it to be a table cell. 2. Go to the labels and select all the cells where you want that text to show up. 3. Paste. The content will appear in every selected cell. Again, you’ll need to apply the Default style as before, and as before, only paste one column at a time because of the separator columns. Copying the first page to make additional pages If you’re creating labels, you often need more than just one page. So, to make a multi-page sheet of labels, you essentially just have to select the whole table and paste it onto the next page. 1. Select the whole table. You can simply click in the upper right cell and drag down to the lower right cell, or click in one of the cells and press “Ctrl + A”. 2. Copy the table. 3. Click below the table (figure 20) 4. Paste. The table will appear on the next page. Repeat these steps to add additional pages.

48

Using the right tools to save time and effort


Issue 14

Figure 20: Clicking in the next available line, to paste another page

Using label wizard templates There are two basic types of label templates in OpenOffice.org: documents that already exist, and templates that are created for you based on selections you make in the label wizard. Using the wizard labels is a bit different. But, it’s definitely a good idea to learn to use them as they provide two key features, mail merge and the ability to automatically update all labels in the sheet to match the first label. I won’t talk about mail merge, since that’s a big topic on its own, but I will go through how to do the automatic update, also known as synchronizing. Creating a label using the label wizard 1. Select the page size and Avery number that you want (figure 21). 2. If you want the same content to appear in every label, fill in that text in the blank field. (You can change and format it later.) Note: If you want to make slight adjustments to the label, click the “Format” tab and change the measurements. However, this is an advanced task and you shouldn’t have to do this. 3. Click the “Options” tab. If you want the text or formatting to be the same in all the labels, select the “Synchronize” option (figure 22). 4. Click “New Document”. The label document will appear, and if you selected Synchronize, the Synchronize button will appear, as well (figure 23). 5. You’re now ready to format, print, edit, or otherwise change the template.

Figure 21: Selecting the label to use

Using the right tools to save time and effort

49


Issue 14

Figure 22: Selecting the Synchronize option

Figure 23: The new untitled label document Updating labels using the synchronize feature Here’s how the Synchronize feature works. It’s very handy—you can use it to update the text or the formatting (or the graphics) in the first label so that all other labels match (figure 24). 1. Make the changes you want in the first cell. Change the formatting as you would normally in a text document, change the content, or (as in the next procedure) add a graphic (figure 25). 2. Click the “Synchronize Labels” button. 3. All the labels will be updated to match the first one.

Figure 24: Updating one label

50

Using the right tools to save time and effort


Issue 14

Figure 25: The updated labels Handling frames in a wizard template Frames are the boxes that the wizard templates use to subdivide text into labels. (If you want to play around with them in other documents, just choose Insert→Frame.)

Figure 26: Frames in a wizard label template Frames are a little odd to work with. If you didn’t click the Synchronize option, you’ll be able to go from one frame, and you’ll want to. I’ll give you a few tips on how to do this. • One of the issues is that you might want to click on the frame border, to change the width of the border or other options, or you might want to click inside to type. It’s not clear how to tell OpenOffice.org which you want. If you’re having problems clicking in a frame to type, just press the “Esc” key. Likewise, if you are typing in the frame and want to select the frame border, you can also press “Esc”. • If you want to quickly move from one frame to another using the keyboard, press Esc, then press Tab, then press Enter. Saving a wizard template as a standard template Going through the Wizard to create labels each time is a bit more work than just opening an existing template. However, there is that handy Synchronize feature. What do you do to reduce the labor associated with the wizard labels? Just save the template the wizard creates in the same location as your other templates. 1. Create a template as you would normally, through the wizard. 2. Do any additional formatting once you have created the template. 3. Choose File→Templates→Save. 4. In the Templates window that appears, type a name for the template, and a category (figure 27). Note: To create a new category, click “Organizer”. In the left-hand list, right-click on an existing category

Using the right tools to save time and effort

51


Issue 14 and select “New”. Immediately type the name of the new category. Click “Close” to go back to the Templates window. 5. Click “OK”.

Figure 27: Identifying the template You can now use the template the same way you use any other template. Choose File→New→Templates and Documents, select the Templates category, and just double-click the template you want.

Adding graphics to any template A major feature of OpenOffice.org templates is the ability to add graphics. You can add them in the corner, or in the background as a watermark. Inserting a graphic 1. Just click in the cell where you want the graphic. 2. Choose Insert→Picture→From File. 3. Find the graphic on your computer and select it. 4. The graphic will appear (figure 28). 5. To resize it, hold down “Shift” and drag one of the corner handles in or out (figure 29).

Figure 28: A graphic added to a label

52

Using the right tools to save time and effort


Issue 14

Figure 29: Resizing a graphic Wrapping text around a graphic At this point, you’ve got a graphic but it probably doesn’t look that good with the text.

Figure 30: A graphic without wrapping To wrap the text nicely around the text, right-click on the graphic and choose “Page Wrap”.

Figure 31: Specifying Page Wrap Now you can move the graphic and the text will get out of its way. If necessary, delete any new carriage returns that were created.

Using the right tools to save time and effort

53


Issue 14

Figure 32: A graphic with wrapping Note: To specify a little more room around the graphic, right-click and choose “Picture”. In the “Wrap” tab, specify spacing. Adding a background graphic You can add a graphic to the background of each label, too. I’ll use this lightened watermark OpenOffice.org logo as an example.

Figure 33: A watermark graphic 1. First, format the text the way you want it, since with a background graphic the text will be harder to select. 2. Insert the graphic in the label the same way you do with other graphics, by choosing Insert→Picture→From File (figure 34). 3. Then right-click on the graphic and choose In Background (figure 35). 4. You’ll see the graphic in the background (figure 36).

54

Using the right tools to save time and effort


Issue 14

Figure 34: Inserting a watermark graphic

Figure 35: Sending the watermark graphic to the background

Figure 36: The watermark graphic in the background of the label

Conclusion No templates article would be complete without mentioning styles. Styles can make formatting templates even faster. Styles are a far bigger topic than templates, but I hope you’ll google for information, use the online help, or refer to the styles section of my blog (http://openoffice.blogs.com/openoffice/styles/index.html). I hope you’ll use templates, either the WorldLabel templates or the wizard templates or both, to make your job easier. It’s easy to fall into the habit of doing things manually, and I do that myself, but the difference when you take a little time to set up templates is amazing. It’s particularly helpful when you have a large team of people—the time you save yourself might not be that much but the time that five or 500 people save is

Using the right tools to save time and effort

55


Issue 14 tremendous. If you have new people on your team regularly, if consistency is a goal or a challenge for your organization, or if you have a distributed team, templates can be tremendously helpful. They’re the right tool for the job.

Biography Solveig Haugland (/user/20443" title="View user profile.): Solveig Haugland has worked as an instructor, course developer, author and technical writer in the high-tech industry for 15 years, for employers including Microsoft Great Plains, Sun Microsystems,and BEA. Currently, Solveig is a StarOffice and OpenOffice.org instructor, author, and freelance technical writer. She is also co-author, with Floyd Jones, of three books: Staroffice 5.2 Companion, Staroffice 6.0 Office Suite Companion and OpenOffice.Org 1.0 Resource Kit, published by Prentice Hall PTR. Her fourth book, on OpenOffice.org 2.0, is coming this fall and is listed on Amazon.com and other bookstores. For tips on working in OpenOffice.org or StarOffice, visit Solveig's blog: http://openoffice.blogs.com.

Copyright information This article is made available under the "Attribution-NoDerivs" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nd/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/free_open_document_labels

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

56

Using the right tools to save time and effort


Managing users in Ubuntu A short, practical guide to user management in Ubuntu and GNU/Linux By Mark Rais As you notice from day to day use of Ubuntu, most tasks are easily accomplished. But what happens when you’re ready to expand your use of Ubuntu to include new applications, or connect to a home network and add new users? This brief guide shares the key steps necessary to create and manage other users, helps clarify some essential differences with other flavors, and provides tips regarding “root” user. Perhaps most importantly, these steps help empower the use of your Ubuntu system to become far more than just another desktop PC.

Understanding users in Ubuntu The security and usefulness of your Ubuntu system depends a good deal on what you do to enable users and their privileges. Without falling into the minutia and the mundane, it is important to at least understand how users are handled in the Ubuntu GNU/Linux environment. When you first install Ubuntu, you are required to create a user account. This initial user account, and for that matter all subsequent users, have their independent user files stored under the Home folder. But there is something unique about the first user account you create. In my case, when installing Ubuntu, I created the user account: “mark”. Not only is mark my first Ubuntu user, but mark has automatically been given unique and powerful privileges that other users do not receive. My mark account can create users, change files and folders, and do a lot of administrative functions on Ubuntu that are normally performed by another important user account named “root”. Therefore, in Ubuntu, you should understand the three key users: • Initial user, in my case called mark, created when installing Ubuntu • Root user, known as the administrator that usually has maximum privileges • All other users, which I term basic users, are added following installation Each of these three key users have their own folders, their own unique privileges, and most importantly their own role to play on your Ubuntu system. In the following sections, I will share how to enable and utilize each. Let’s begin with the basic user. NOTE: I assume that you are logged in to your Ubuntu system as the initial user, thereby having the rights and privileges necessary to perform the tasks below.

Creating and managing basic users Inevitably, once you setup Ubuntu in your home or office, others will come to you begging to get access. Some may want a chance to try out one of the multitude of cool applications that come preloaded with your system, while others desire to see GNU/Linux power! In other words, you need a good way to give them access without giving them the keys to the system. Step 1. Accessing the users and groups tool Creating basic user accounts is easily accomplished through the Users and Groups tool. From your main menu, choose System, then Administration. To start your tool select the Users and Groups menu item. Notice the message that appears (figure 1).

Managing users in Ubuntu

57


Issue 14

Figure 1: Using the privileged user account This is a very important message and what it infers is something unique about Ubuntu. In most GNU/Linux systems the privileged user is named root, and the password you type in would be that of root. However, in Ubuntu, the privileged user is the initial user account you created, and therefore you must type that user account password. Once you type the password in, you will have access to all of the various administration tools. I provide more details regarding the reasons for this in the “Understanding the Superuser” section below. Step 2. Adding a new user You should now see the Users and Groups tool. Please choose the Add User button on the right. What you choose to include in the Account sections should be based on who you’re adding, and what you plan to do with your Ubuntu system. If you’re adding a basic user so someone else can also access your Ubuntu system, the defaults will be satisfactory. For an example, I will add my son John as a basic user of my Ubuntu system so he can enjoy some of those cool GNU/Linux games. Below is the sample user information. Notice that I chose to manually set the password, since I prefer to give him something that is both secure and easily remembered (figure 2).

Figure 2: Adding a new user with basic rights Before you press the OK button, please click on the “User privileges” tab at the top. This is an important step whenever you create a new user. Under the “User privileges” tab, note the default access given to this basic user. You may prefer to change some of these, such as “Monitor system logs”, “and Connect to Internet”. Anything that is checked is allowed by this user. Also make sure that the “Executing system administration tasks” is NOT checked.

58

A short, practical guide to user management in Ubuntu andGNU/Linux


Issue 14 Once you are satisfied with the privileges granted to this new user, press the OK button. You should return to the main Users and Groups tool window. Now scroll down until you see the new user you just added. In my example, I added user: john (figure 3).

Figure 3: Successfully added new user Once you are finished adding new basic users, it is very important to press the OK button again. This will create the account and save the information you added. Ubuntu should also automatically create your new user’s folder under the Home directory. Once finished, your new user will be able to login and enjoy the power of Ubuntu GNU/Linux! If for some reason the login fails, please refer to the troubleshooting tips at the end of this article. Step 3. Making future changes to users Notice that if you wish, you can now go back and change the properties of this user by highlighting the user name and pressing the Properties button. Or, if this user is no longer needed or wanted in the future, you can highlight the name and press the Delete button. If you ever decide to delete a basic user, realize that the folder and files from the user are not automatically removed, only the user’s login access is removed. This is greatly advantageous since it allows you to restore a previously deleted user without losing files. In order to totally remove even the user’s folder, you will need to apply a super-user command. This is a step that is unlikely to be necessary for beginning Ubuntu, but that I explain briefly in the “Understanding the Superuser” section.

Creating and managing user groups Although it is fine to simply leave a new user such as john in his or her own user group, you may prefer to also assign new users to another unique group. This affords not only an easier time in managing users rights, it also offers a means to share files, etc. You do not have to assign new users to a group, the default is that they are assigned to their own personal group. But if you prefer to do so, below are the key steps. Step 1. Start the users and groups tool As mentioned above, access the tool from your main menu. However, instead of making changes or using the options on the “Users” tab, click on the “Groups” tab. Scroll down until you see your new user. Notice that a group with the user’s name has also been added.

A short, practical guide to user management in Ubuntu andGNU/Linux

59


Issue 14 Step 2. Add a group Now, press the Add Group button.

Figure 4: Adding users to a specific group Notice in my example (see figure 4) that I’ve created a new group named “desktopusers”, and then highlighted my new user john. By pressing the Add button in the middle, I will add john to the group. You can add multiple users by holding down the Ctrl key and highlighting as many as you wish. Just be sure to press the Add button once you are done choosing. Press OK when you are satisfied that all the users who belong in your new group were added (figure 5).

Figure 5: Successfully added new group Notice that on your main “Users and Groups” window, the new group was added to the bottom of the list. Press OK again to save the changes. That’s it! In the future, to change users in a particular group you can use the same steps above. But instead, highlight the group to change and press the Properties button. What you enabled with this new group is that users, such as a working group of colleagues or friends, can now share files and manage folders that were given desktopuser group access.

Understanding the superuser I briefly mentioned above that there are three key users in Ubuntu. This section will clarify why certain attributes exist, and what the key differences are between root and the initial user account.

60

A short, practical guide to user management in Ubuntu andGNU/Linux


Issue 14 Notice that in order to apply any of the steps above you needed to be logged in and use the initial Ubuntu account. The first account you create, during installation, is automatically assigned super-user do rights (also called sudo). With a super-user account, system administration and modification is possible. The most powerful super-user account in GNU/Linux is root. However, you’ll notice that a root account is not automatically included in your Ubuntu installation details. The root does not, by default, come enabled for your use. In situations where you must use superuser privileges, Ubuntu allows you to use the initial account combined with sudo. If for example you wanted to delete a basic user’s file folder from under Home, you would use the following commands from the command (terminal) prompt: cd /home sudo delete john

To run the sudo command you will be prompted for your initial user password. This prevents you from having to run as root to do basic system administration, while protecting your system from security weaknesses associated with fully enabling another account as superuser. What about root? Ubuntu hides the root account somewhat in order to discourage its use, unless absolutely necessary. Instead, almost all of the power and privileges needed for administration are assigned to your initial account. But what about those instances where you plan to perform some major modifications or enhancements to your Ubuntu system? I must state that this is unlikely to ever be the case for a beginning user. But, if you are in a situation similar to myself, trying to add something as major as perhaps the LTSP to your Ubuntu (edubuntu.org already has some good options for new users who want this), then you may need to apply root. Again, before you press ahead to enable your root account, I want to convey that you should not be using root for day-to-day administration. Nor should you follow the steps below if you are brand new to Ubuntu and read some document that says “you need to be logged in as root”. Instead, use sudo as described above to run such commands. If you’ve gotten this far, you don’t need anymore disclaimers just a simple answer. To enable root in Ubuntu you use the same steps as mentioned in section 1. However, you highlight the root user account and then press the Properties button. From there you can set the root password by hand and press OK twice to save your changes. I just urge you not to become a habitual root account user and to stick with the initial account and sudo when possible.

Troubleshooting It’s a rare thing for me to hear about problems creating and managing users. However, there are a few things to keep in mind. Login failure If you created a new user account based on the steps above and get a strange error, you may have a simple problem with the user’s properties. The errors you may see include: $Home/.dmrc not properly configured, or that the HOME/user does not exist and the default directory will be temporarily set to /root. In both cases, the error was caused by the new user’s folder not being properly configured or created. You can resolve this easily enough, by simply deleting the user and starting the steps above again. But this time, also click on the Advanced tab, when adding user, and ensure that the line for Home directory reads: /home/$user Obviously, this only applies during initial creation of a new user account.

A short, practical guide to user management in Ubuntu andGNU/Linux

61


Issue 14 Changes do not save I’ve encountered this more often than you would imagine. It seems that people sometimes get confused when pressing the OK button during the steps above. You must not only press the OK button on the specific properties Window, but also press OK once again on the main Users and Groups window in order to save your changes.

Conclusion You should now have all the key steps needed to create and manage multiple user accounts on Ubuntu. More importantly, you should also have a reasonable understanding of what to do if you need to run a command or perform an action that requires “root access”. By applying these steps, you can share the power and pleasure of your Ubuntu system with others, while retaining security and stability.

Biography Mark Rais (/user/27" title="View user profile.): Mark Rais dedicates his time and energy to promoting free software technology, especially among the poor and where a technology divide exists. He serves as senior editor for reallylinux.com (http://www.reallylinux.com). You can contact him at "markr" followed by the "at" symbol and then "reallylinux.com".

Copyright information Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. Source URL: http://www.freesoftwaremagazine.com/articles/users_in_ubuntu

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

62

A short, practical guide to user management in Ubuntu andGNU/Linux


Creating a managed website—Part 1 Focus on the message not the tools. Set up a content management system to deliver your site. By Graham Oakes Do you manage a website? Maybe you’re looking after the site for a small business. Maybe you’re doing it for a community group. Perhaps it’s your own personal site. You’d like it to be dynamic: to have some fresh news every week and a home page that’s always up to date. Therein lies the problem. You’re tired of constantly editing HTML to make these changes. And every change gets more complex as you try to keep the look-and-feel consistent across all the pages. Or maybe the site was developed by an external designer. That shielded you from the technical complexities, but now every change takes time and costs money. Perhaps you need a content management system (CMS)...

Do I need a CMS? A CMS can insulate you from the technical complexities of updating content. Rather than having to learn HTML editors and manage FTP protocols, you can get back to what you want to do—use simple editing tools to create up-to-date, well-presented content for your audience. A CMS can help in other ways. With the appropriate CMS you could, for example: • Create workflows to help teams of authors co-ordinate their work; • Automatically structure each page with common navigation and other design elements; • Control the branding of your content by ensuring that style sheets are used consistently; • Ensure the site complies with accessibility guidelines; • Distribute the same content to multiple websites, RSS feeds, etc; • Ensure that content is only displayed to people with the correct access rights. Of course, this all comes at a cost. For a start, you need to choose a CMS from the hundreds that are available. Then, even if you choose a free CMS (and CMSs based on free software are capable of running most websites these days), you’ll need to pay for a server to run it. You’ll need to download, install and configure the CMS. Finally, everyone who’s creating content for the site will need to change the way they do things. So even a free CMS isn’t cheap. But the benefits of allowing people to create and publish content more easily can make one worthwhile for many sites. Setting up a CMS—how much effort is involved? A CMS makes it easier for people without technical skills to publish content. However, to make this possible you need to spend time setting up the CMS. This creates an overhead. For example to install the Joomla (http://www.joomla.org/) CMS you need to • Set up your hosting and internet access arrangements • Set up a server and install the operating system • Download and install Apache, PHP and mySQL • Download and install Joomla • Set up templates to control page designs • Set up the site itself For a CMS like Plone (http://www.plone.org), you’ll also need to set up user permissions and workflows. Only once all this is done can you start entering content onto the site. How long does this all take? Nynke Fokma of Moebius (http://www.moebius.nl) reckons “With Joomla, we built the new site from the existing HTML site in two days.” That’s two experienced people and two days. If you’re learning as you go, or if you have a complex site, it could take a lot longer. The good news is that this is a one off—once the site is set up, then people can publish

Creating a managed website—Part 1

63


Issue 14 new content quickly and easily. If the site changes a lot, then the initial overhead could be repaid very rapidly. If the site doesn’t change much, then a CMS might not be particularly helpful.

Hut... Like building your own hut, creating a site in HTML gives flexibility to grow in different directions. But your skills may limit the elegance of the final design. (You may also need to spend time plugging the leaks!) (Image courtesy of Robin Elaine (http://www.flickr.com/people/robinelaine/).)

... or Hotel? A CMS can help create structure and order, but it can also constrain your flexibility. It’s very easy to do what the CMS anticipates; tough to move outside the boundaries. (At least with free software, you have a map of those boundaries and can extend them yourself if you need to.) (Image courtesy of Thomas Hawk (http://thomashawk.com/).)

What do I need to think about before I choose a CMS? To get the right trade-off between costs and benefits, you need to choose the right CMS. To do this, you need to be clear about what you want to achieve. Some of the benefits may be more important to you than others. Some may be irrelevant. The costs may have greater or lesser impact on you depending on your skills. Being clear and focused makes it a lot easier to choose your CMS and configure it appropriately. Being clear and focused makes it a lot easier to choose the right CMS and configure it appropriately To develop that clarity, here are some questions to consider: • Who is your audience? Think about the people who come to your site. What attracts them? Are they looking for in-depth, authoritative information, or for sound bites? Do they use a full-sized web browser, or are they sometimes coming via their mobile phone? Are they all looking for the same information, or do you share more privileged information with some people? How frequently will they come to the site? How long will they stay? What language do they speak? A site that is visited by local teenagers every morning to get the latest gossip is going to look very different to a site visited

Focus 64 on the message not the tools. Set up a contentmanagement system to deliver your site.


Issue 14 only occasionally by international customers who need technical support, and they’re both going to need different content management tools. • What do you want to say? Think about the message, and about the format it needs. Will everything be in text or do you also deliver audio and video? How much of this content will there be? If your site has 20,000 pages and is accessed by thousands of people every day, then you need a CMS that can support this volume. Do you want to support more collaborative content such as discussion forums and wikis? Some CMSs make this easy, so if it works for your audience it’s an important consideration. Likewise, if you want to include e-commerce functionality on the site then you need to consider how your CMS will integrate with other systems. • What will the site look like? What impression do you want to convey to your audience? “Authoritative” looks different to “cool”, so you’ll need to ensure that all aspects of the site (the colours, fonts, images, voice, etc) convey the right message. If this is really important, then make sure you choose a CMS that makes it easy to support your desired design. Above all, remember that a CMS doesn’t replace design. It may come with standard templates, but for all bar the simplest of sites you’ll want to develop these to reflect your own branding. Think carefully about who will be visiting your site and what you want to say to them “A CMS will not make your site look better. It will not make your content more interesting. You still have to do the work. But a CMS can help organise and reuse content, and present it at the right time and in the right format, if you are ready to do so.” Francesco Ciriaci, cofounder of Reflab (http://www.reflab.it/) • Where will the content come from? Migrating content from your existing site to a new CMS can be a substantial task. If you have a lot of content, check that your CMS provides tools to support the migration. Once the site is up and running, how frequently will it change, and how much control do you need over those changes? If everything needs to go through legal and other approvals before it can be published, then look for a CMS that supports such workflows. Or if several people need to collaborate on certain pages, then look for a CMS that supports such collaboration. • Who will work with the CMS? Someone will be creating content, but there may also be people who manage servers, and people who approve changes to the site. Who is your current webmaster? A CMS will affect all these people. There may even be external contractors and volunteers who work with the site. They all need to accept new ways of working. So look at yourself and your co-workers—are you prepared to learn new ways of doing things? “I use a model to guide me when I advise people about web sites. It’s based on a hierarchy of needs. If the business is healthy and their current use of web technology is OK, then I look at their “organisational athleticism”—can they adapt to the pace of change? If the organisation is not athletic, then introducing a CMS could be real trouble.” Rick Brenner, principal of Chaco Canyon Consulting (http://www.chacocanyon.com/) • Administration. Be clear about the administrative details. If you are migrating from a site that’s been developed by someone else, make sure you own the URL and all the content files for the site. You’ll need copies of these files, so you need the account names and passwords to access them. Take a backup. Check how you’ll take backups of the content you load into the new CMS.

How do I choose the CMS? OK, you have a fair idea of who will use the CMS and what they will do with it. Choosing a CMS is now about checking the features that each CMS offers against what you want to do, and picking the one that provides the best fit. The main complexity is the range of options. Wikipedia (http://en.wikipedia.org/wiki/List_of_content_management_systems) lists about 130 free software CMSs. CMS Review (http://www.cmsreview.com/) lists more. CM Pros (http://www.cmprofessionals.org/), a community of content management professionals, is developing a database of CMSs (https://www.cmprofessionals.org/resources/cmsml/comparator/) and their features to help narrow down the search, but the best source of up-to-date information about any particular CMS is currently the website for that CMS. Here’s what to think about as you’re working through these lists.

Focus on the message not the tools. Set up a contentmanagement system to deliver your65 site.


Issue 14 Why use a free software CMS? Many free CMSs are now mature systems and well matched to common content management problems. Seth Gottleib has written a report (http://www.optaros.com/pdf/optaros_cmsReport_012206_sgg.pdf) that identifies a range of situations where free CMS work well. In these situations, the benefits of free software include: • You can put your budget into content development, not into licence fees. • You can try out the software before you commit too heavily to it. Demo versions of many CMS are even available at the opensourceCMS.com (http://www.opensourcecms.com/) website. Although, if you need more advanced features, such as customised workflows, you probably need to download the software to try it. • An active development community means that free CMS are often early to support new features in areas like collaboration and content syndication.

To be continued... The second part of this article will look at how to select a CMS for your site. It will then discuss the steps you’ll need to take to install and configure the CMS, and then to set up your site and its content. Finally, it will cover promotion and maintenance of your site.

Biography Graham Oakes (/user/20" title="View user profile.): Dr Graham Oakes is the principal of Graham Oakes Ltd, a consultancy formed in 2003 to help organisations untangle the complexity within their systems, processes and governance. He helps define business and technology strategies that people will adopt, and then to assure implementation of those strategies. He can be contacted via his web site (http://www.grahamoakes.co.uk).

Copyright information This article is made available under the "Attribution" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/cms_end_users_part_1

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

Focus 66 on the message not the tools. Set up a contentmanagement system to deliver your site.


Spiff up your website with KImageMapEditor A brief tutorial to a small application that can save you a large amount of time By Terry Hancock One of the things I love about using a large free software distribution, especially on a suitably large harddrive, is that you can sometimes just go exploring in your applications menu. It seems like there’s always something there I haven’t looked at yet. Jan Sch?r’s KImageMapEditor was one of these discoveries—and what a gem it turned out to be! Oddly, you probably won’t find this in the “Graphics” menu, but rather under Debian→Apps→Editors, where you usually find text tools (of course, your distribution may have it in a different place). What it does is to make HTML “map-area” tags (which define clickable “hot spots” in an image) completely simple to use, by providing a graphical editing environment for laying them out. You probably already have KImageMapEditor if you use KDE. If not, you can find it as a DEB package [1], an RPM package [2], and of course, as source code from the project site [3].

The problem I’ve long avoided the map-area tags, because they just seemed too complicated. You have to tinker with coordinates within an image, measure out where points should go, and create a complex set of them in order to get them to work. Besides, I already had a tool for doing similar effects—I was a real wiz at slicing up images and arranging them in tables. You probably already have KImageMapEditor if you use KDE Recently, I also began using HTML to provide in-package documentation for a software package “Universe” [4], which is based on the “Python Universe Builder” (PUB) [5]. I wanted to mingle my pre-written design documentation with the automatically generated API documentation from epydoc, and there’s a nice hook which allows me to link them by putting some content on the “index.html” page that epydoc generates. I decided a diagram would be the perfect way to quickly communicate the relationship between the modules in the package, and give potential developers a quick way to get started on the project. So, naturally, I whipped out my HTML table skills, made a zillion (okay, just fifteen) images of connecting elements and assembled them with the appropriate text in a table, resulting in the diagram in figure 1.

Figure 1: The “old way”, with HTML tables. Dull and too hard to maintain. This took, as I now see, 183 lines of table code, and was extremely tedious to maintain (as I discovered, for example, when I added the “sound” module!). What a waste of time! Fortunately, I have discovered KImageMapEditor, which I can now use to greatly simplify this page, making it much easier to maintain, as well as much more visually appealling.

Spiff up your website with KImageMapEditor

67


Issue 14

First, you need an image With the KImageMapEditor approach, the first requirement is a good starting image. For a diagram like this, I highly recommend using a vector-graphics tool like Dia [6], Skencil [7], or Inkscape [8]. I’ve had success with all three, and used Inkscape to create the drawing for this project, which is in figure 2 (online readers can simply use the figure image to follow along—but feel free to start right away on your own image).

Figure 2: My grand plan for the universe, as an image. As you can see, I’ve gone beyond my original concept, by adding images, descriptive of what each module is responsible for (this package is mostly graphics and presentation, so this is a natural choice for this project). I just used polybezier lines to lay out the relationships, which obviously sidesteps the complexity of the arrow images I used in my original design. The viewer will never actually see what you draw, you’re just defining active regions in your image I made a backup copy of my HTML file and then deleted the enormous table from my original, replacing it with a single image tag, embedding the above image into it. At this point, it’s just a dumb image, without anything clickable. The tag itself looks like this: <img src="../image/universe_plan.png" alt="Universe Modules" width="597" height="656" border="0" />

Start KImageMapEditor The next step is to start the KImageMapEditor. Normally, if you haven’t used it before, it will simply bring up an empty screen. Unsurprisingly, you will click on File→Open to open the HTML file (You can also start by just loading an image, in which case KImageMapEditor will create a new HTML file). The editor will analyze the HTML and let you choose from the images that it finds (figure 3).

68

A brief tutorial to a small application that can save you a largeamount of time


Issue 14

Figure 3: Selecting the correct image from the HTML source. In this case, there’s not a lot else in the file, so the first image is what is wanted. So, select that, and click “Ok”. This will load the image into the editor, as shown in figure 4.

Figure 4: What you’ll see after you’ve loaded the image. You will note, looking at the screen, that there is a canvas area on the right and three tabs on the left. First, you will need to create a map to edit. So, click on the “Maps” tab; then right-click in the empty window; and select “New map...”. You can choose any name you like. I picked “modules” for this project. Next, you will need to attach this to your image. Clicking on the image tab will show you the image you are working on. Right-click on the image you want to use and select “Edit usemap...”. This will allow you to specify a map for the image using a combo box based on the “Maps” tab, so we can just select “modules” off of the list at this point. That takes care of the “boilerplate code”. Next we’ll click on “Areas” to get started defining the hotspots in this image.

Defining areas If you look at the top of the canvas part of the screen (right side), you will see a palette with the area-definition tools. The first tool (arrow icon), is used to select already-defined areas. You can’t do that yet, but you’ll get a lot of use out of it later. The next tool is the circle tool (circle icon), which makes circle-shaped areas, as you would expect; though, if you are experienced with vector graphics programs, you might be surprised that it cannot make ellipses. The next tool, which will be using a lot of, is the box tool (square icon), which defines rectangular box-shaped areas. The next four icons can be used to draw more-or-less arbitrary shapes. The first makes (irregular) polygons, allowing you to click for each vertex (if you click close enough to the first point, the polygon closes). The

A brief tutorial to a small application that can save you a largeamount of time

69


Issue 14 next icon provides “freehand” definition of polygons. I recommend you alway use the first polygon tool, which allows you to explicitly specify points, because the freehand tool will generally create a lot of points, making your HTML a bit untidy. You should realize that there is no need to draw with the precision you would ordinarily use in creating graphics: the viewer will never actually see what you draw, you’re just defining active regions in your image. Hence, a couple of pixels of misfit is just not going to matter that much anyway, and I think it’s better to keep it simple. The result is quite compact compared to my original solution, taking up less than 19 lines of code (which I don’t even have to manage manually) In fact, since this project is a simple block diagram, I’ll only be using the “box” tool. My first block was on the lower right, so I scrolled the canvas up; selected the box tool; and clicked and dragged it over the “control” box in my diagram. As soon as you let go of the mouse button, a dialog will pop-up prompting you to edit the properties of the area (figure 5). This is just a time-saver, you can actually click past this, and come back to it later, so don’t panic if you miss something. For now, I just put in the correct module link (this is a URL that’s automatically generated by epydoc in my project, but you can use any URL appropriate for your web page), and a brief descriptive label “control”.

Figure 5: The properties dialog will come up as soon as you finish defining the area. You’ll also note that the area appears on the area tab at left, with both the URL and a thumbnail of the image in the area. Defining the rest of the areas in the image is just as easy, so I repeated the process for all of those, ending up with what you see in figure 6. You’ll also note that the descriptive labels are shown in the graphics canvas area.

Figure 6: My session, after all of the implemented areas have been set.

70

A brief tutorial to a small application that can save you a largeamount of time


Issue 14

Testing and cleaning up At this point, you can use File→Save, and the changes will be saved to the HTML file. This will allow you to load it immediately and test it in your favorite web browser, which will show you the final result, as in figure 7 (of course, this looks just like the HTML with the plain image, but it’s clickable now!).

Figure 7: What it looks like in the browser (unfortunately, it’s hard to show that it is now clickable). KImageMapEditor doesn’t know where to put the map element in the HTML document, so it just sticks it on the end. I immediately cut and pasted this section to a position immediately after the image tag, which I find more intuitive. KImageMapEditor is unfazed by this and will keep the map element wherever you put it (I have noticed that it may scramble the attributes on the image tag, which is a little annoying, but you can still find everything). The result is quite compact compared to my original solution, taking up less than 19 lines of code (which I don’t even have to manage manually). This, combined with the ease of editing the original graphic in Inkscape, makes this a huge improvement in terms of maintainability!

Going further Universe, like most projects is a work in progress, and although this diagram outlines my grand development scheme, only parts of it are complete. So far this is only apparent because the unimplemented parts of the image aren’t clickable. But I’d like to be a bit more explicit. I could modify the image to indicate this, but I can also use KImageMapEditor to actively alert the reader that those parts aren’t implemented. For this, I used the editor’s ability to manage Javascript tags. First of all, I defined the extra area tags for the unimplemented modules. Then I used a Javascript URL as the link: javascript:alert('Not implemented.')

This will make a Javascript dialog box pop-up if you click on it. Of course, that could be sort of annoying since I’ve now made a “do-nothing” link. I needed to add a brief note for what each module is supposed to do, so I used the onMouseOver and onMouseOut tags to control the status line, so that the words “Not Implemented” immediately appear there as soon as you put the cursor over those modules. You can be a lot more daring with the layout of links To do this in KImageMapEditor, you select the area you want to use (from either the area list or the canvas), right-click, and select “Properties...”. This takes you back to the dialog you used in creating the areas in the first place. Now, though, click on the “Javascript” tab to get to the various event trigger hooks that you can use, including onMouseOver and onMouseOut. I then defined these with simple tabs (figure 8).

A brief tutorial to a small application that can save you a largeamount of time

71


Issue 14

Figure 8: Managing javascript hooks.

More complex drawings Obviously, it is possible to go a lot further with KImageMapEditor. You can be a lot more daring with the layout of links. With the polygon tool, it’s possible to make diagrams with some three-dimensional effects (figure 9), and complex artistic designs that would be nearly impossible with tables.

Figure 9: Much more complex 3D diagram, which uses polygon-areas (from PUB [5]). That’s it! I hope you find KImageMapEditor as useful as I have. It’s a cool graphical tool that solves a problem simply and efficiently, and it’s definitely going to be a regular part of my web crafting software from now on.

Notes and resources [1] Debian Packages (http://packages.debian.org/kimagemapeditor) [2] RPM Packages (http://rpmfind.net/linux/rpm2html/search.php?query=kimagemapeditor) [3] Source Code (http://www.nongnu.org/kimagemap) [4] Part of my game project, The Light Princess (http://light-princess.sf.net) [5] Joe Strout’s Python Universe Builder (http://py-universe.sf.net) [6] Dia (http://www.gnome.org/projects/dia/) [7] Skencil (http://www.skencil.org)

72

A brief tutorial to a small application that can save you a largeamount of time


Issue 14 [8] Inkscape (http://www.inkscape.org)

Biography Terry Hancock (/user/5" title="View user profile.): Terry Hancock is co-owner and technical officer of Anansi Spaceworks (http://www.anansispaceworks.com/), dedicated to the application of free software methods to the development of space.

Copyright information This article is made available under the "Attribution-Sharealike" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-sa/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/kime_tutorial

Published on Free Software Magazine (http://www.freesoftwaremagazine.com)

A brief tutorial to a small application that can save you a largeamount of time

73


Issue 14

74

A brief tutorial to a small application that can save you a largeamount of time


Secure email servers from scratch with FreeBSD 6.1 (part 1) Build a secure email server with FreeBSD, Postifx, ClamAV, Spamassasin, and MySQL By Yousef Ourabi FreeBSD—it’s the other white meat. Perhaps you are a long time GNU/Linux user and have been curious about experimenting with the other half of Open Source, the BSD class of operating systems. The 6.1 release is just around the corner, the first batch of RCs (release candidates) are already hitting the FreeBSD mirrors and by the time this article hits the press, 6.1 will probably have been released. The time has come for the adventurous to forgo their penguins and get down with the beastie.

Introduction This article will cover the steps involved in setting up a highly secure email server using FreeBSD, Postfix, Cyrus-imap (SSL), Squirrelmail (webmail), ClamAV and Spamassain. The mail host will be able to host virtual domains, and virtual users backed by a MySQL database. All required information will be covered from installing and hardening FreeBSD with ipfw, installing packages from the venerable ports system, understanding the role DNS plays in email to securing Postfix and configuring ClamAV and Spamassain for anti-virus and spam filtering. This is the first part of a two part series. This first part will cover the history and origins of FreeBSD, installation and configuration of the base system, updating and installing packages from ports, and securing the system with ipfw2. The second part will cover configuring Postfix, MySQL, and Cyrus-imap over SSL, configuring ClamAV and Spamassain for anti-virus and spam filtering, and Squirrelmail over Apache SSL for secure web mail when you are away from your computer. FreeBSD is used by Yahoo, Coyote Point, and countless others Email server terminology When diving into the world of managing your own email server, it’s easy to get lost on a sea of acronyms such as “MTA”, “MUA”, and “MX” record. Mail Transfer Agent (MTA): this is the email “server”. Postfix (discussed in the second article) is an MTA, other (in)famous MTAs are Sendmail and qmail. The MTA works behind the scenes accepting mail for users it is in charge of, and forwarding mail to other MTAs. Mail User Agent (MUA): this is the client that users typically interact with. Mozilla-Thunderbird and Microsoft Outlook are MUAs. Mail User Agents send emails to MTAs which then either deliver them to users, or another MTA. Mail exchanger (MX): is the terminology used by DNS, the system that resolves IP numbers to human readable host names. In the DNS configuration there is a special entry for email servers that sets the priority of the email, which is used when there are multiple email servers and one stops responding, and the name of the email server itself.

The history of FreeBSD The origins of FreeBSD go back to the University of California Berkeley during the late ’70s, and the suffix “BSD” is an acronym for “Berkeley Software Distribution”. Initially FreeBSD started as an outgrowth of the 386BSD project, also known as JOLIX. The 386BSD project itself was a patch set of the 4.3BSD, from which the University of California Berkeley had withheld a large amount of code as part of their agreement with Novell.

Secure email servers from scratch with FreeBSD 6.1 (part 1)

75


Issue 14 In the early ’90s Novell, which had purchased the IP rights to AT&T’s UNIX System, sued the University of California for patent infringement. It was around this time that Linus Torvalds released the initial Linux kernel, and the rest was history. Novell and The University of California eventually settled. It was agreed that certain parts of the code base, then called 4.4BSD, were encumbered. The University of California removed the tainted code and released the 4.4BSD-Lite operating system; however large parts of it were removed, and a bootable, working version for intel processors was not available. In 1993, development of 386BSD seemed to have stagnated, and there was a growing back log of patches that Lynne and William Jolitz, the original creators of the project were not merging into the main code base. Eventually, a group of developers including Jordan Hubbard, decided that the project was worth continuing on its own, even without the support of Jolitz. In December of 1993 the FreeBSD project released its 1.0 version. The name “FreeBSD” was coined by David Greenman. This initial release was still based on the encumbered 4.4BSD-Net/2 distribution; it wasn’t until FreeBSD 2.0 that FreeBSD was free of patented intellectual property. The rest is history. While Linux took the (free software) world by storm, FreeBSD was still recovering lost mindshare from the doubt and uncertainty cast by the Novell law suit Bill Joy, BSD, vi, and Sun An interesting side note is that Bill Joy, of Sun Microsystems fame, was one of the original creators of BSD software. During his time at the University of California Berkeley, he also wrote the original, “vi” editor. Sun Microsystems earlier offering “SunOS” was based on BSD code from the early ’80s until the early ’90s when Sun released SunOS 4.0 based on AT&T’s SysV code. Sun attempted to clarify the change by marketing “Solaris” instead of “SunOS” although “SunOS” referred to as the core operating system, while “Solaris” is considered an operating environment; thus Solaris 10 is SunOS 5.10. FreeBSD sports a new multi-threaded file system that increases performance on systems such as email and database servers

What’s new The 6.0 branch represents a mixture of stabilizing features introduced in the 5.x branch and some new features. The 5.x branch introduced a new scheduler called “ULE” around the same time the linux 2.6 kernel introduced the new anticipatory scheduler. A very new and exciting feature is a multi-threaded SMP safe file system layer, which offers greatly enhanced performance for I/O bound systems such as database and email servers. In this release the ULE scheduler has been marked as safe for SMP systems.

Installing FreeBSD 6.1 FreeBSD uses a text based installation tool called Sysinstall. Debian, and Slackware users will feel right at home, while long time Red Hat users might need to adjust. The majority of the installer has gone unchanged, although there have been some minor improvements and additions (which will be noted).

76

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL


Issue 14 Figure 1: FreeBSD’s installer booting The installation is the same as in the previous 5.x branch; however, there was a bug resulting in USB peripherals becoming unresponsive after the kernel loads that wasn’t fixed in the 6.0 release. If you experience this do the following: select option 6, and enter this: set hint.atkbd.0.flags="0x1" [hit enter] boot [hit enter]. The same line should be entered in the /boot/loader.conf file (after the installation) to prevent the USB peripherals from not working after the install: hint.atkbd.0.flags="0x1". The 6.1 installer starts off with a new country selection screen (figure 2) which wasn’t present in previous versions.

Figure 2: Country selection The next screen (figure 3) was the first screen in previous versions. From here you should select “Standard” to begin the normal installation process.

Figure 3: Default menu You will then be presented with an informational screen, simply stating that you need to setup a FreeBSD partition. You will then be presented with the partition information; it is advisable to simply hit “a” and have the installer automatically create the FreeBSD partition for you, and then “q” to quit and move on to the next screen. If you have already created a partition and want to change its type, FreeBSD’s partition type is “165”.

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL

77


Issue 14

Figure 4: Fdisk utility The next screen (figure 5) is the boot loader selection. FreeBSD has its own boot loader similar to Grub or Lilo. This is rarely needed on multi-boot systems as I find grub to be easier to use and manipulate. I recommend selecting “Standard” as this will give you the chance to manage booting FreeBSD via Grub if you have it installed.

Figure 5: Boot loader selection You will then be presented with another information screen, which leads to the partitioning utility. Again, “a” will automatically create the partitions, and “q” will save and move to the next step. FreeBSD uses a more traditional UNIX-like partition layout than Linux does. The FreeBSD model favors many partitions, one each for /, swap, /tmp, /var, /usr, and optionally /usr/local and /home. The preferred partitioning scheme on GNU/Linux distributions consists of three partitions, one for /, one for swap and one for /boot. Both have their advantages; the GNU/Linux scheme is more flexible and doesn’t require prior knowledge of which directory is likely to grow the most and thus need the most space. The FreeBSD model is inherently more secure and granular, and is the model I prefer. Partitions, partition types, slices and boot loaders FreeBSD has a slightly different disk layout than that used in the GNU/Linux world when it comes to partitions. Standard IDE (or SATA) disks can have up to four primary partitions, or three partitions and one extended partition with 63 logical partitions in it. Most GNU/Linux installs span several partitions, one for /boot, swap and / (if not more). FreeBSD on the other hand installs entirely into one partition, which must be a primary partition; FreeBSD then creates multiple slices in that partition for the standard mount points such as /, /usr, which are each labeled in alphabetical order. Historically, some of letters have special meanings, the “c” slice represents the entire disk, and the “b” slice typically is the swap space. Note: UFS2 was introduced during the 5.x cycle, and is still relatively new. As such it isn’t supported by Grub yet. If you wish to use Grub as your boot loader, select UFS1 (do this by using the arrows to navigate to the /

78

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL


Issue 14 partition) and hit “1”. UFS2 is an major upgrade to BSD’s standard “Unix File System”. UFS2 supports, among other things, 64 bit file pointers allowing the file system to grow past 1 Tera-Byte in size. Although this article is about configuring an email server, for users interested in dual booting FreeBSD along with GNU/Linux simply use the following lines in grub.conf (or menu.lst) assuming the /root partition has been formatted with UFS1: Title FreeBSD 6.1 root (hd0,2,a) (The partition where FreeBSD is installed, with a being the first slice inside the partition) kernel /boot/loader

Figure 6: Installer partition editor The next screen (figure 7) will be the “Distributions” screen. This is where you select what software you want to be installed. For our purposes I would recommend selecting all the distributions except “X.org”.

Figure 7: Package selection You will then be asked (figure 8) to provide the installation source; usually, this is CD/DVD. However, if you downloaded the boot-only iso you should select HTTP or FTP, and the FreeBSD server closest to you.

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL

79


Issue 14

Figure 8: Installation source You will then be given the final chance to abort the installation before the disks are formatted and FreeBSD is installed. After the core installation is complete, you will be presented with an informational window informing you that the installation is complete; if necessary, you can re-enter the installation utility at any time by typing /usr/sbin/sysinstall. The installer will then guide you through the final configuration process to determining whether or not you will be using this system as a network gateway, SSH server, NFS server or client, and also whether or not you would like to add users and groups to the system.

Figure 9: Network configuration prompt You will then be presented with a screen of possible devices to configure. In most cases, all you have to do is select the correct ethernet device and then select yes. You can distinguish ethernet devices from others because they have the word “ethernet� at the end of their description. After you make your selection, you will be asked if you want to configure the device using ipv6, which in most cases is no. After that you will be asked if you want to enable DHCP for automatic configuration of the device.

80

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL


Issue 14

Figure 10: Network Configuration After all the required information is entered you will be asked if you want to bring up the interface right now. Select yes and continue. You will then be asked if you want the machine to act as a network gateway: unless you know what you are doing, select no. Next, you will be asked if you want to configure inetd, the so called super-server. Again, select no. You will then be asked if you wish to allow remote logins via SSH. This depends on whether or not this is a server or workstation—for servers I would recommend yes, for workstations probably not. After that, you will be asked if you want to configure the FTP server, to which I would almost always say no. Then you will be asked if you want to configure the machine as an NFS client or server: of course this depends on your needs, so answer accordingly. After that, you will be asked if you want to customize the console settings: the answer is almost always no. After all of that, the time zone configuration process begins; this is the last really involved configuration step. You should say yes to configuring the time zone, and then probably no when the installer asks if the machines time is based on UTC. Select your region, your country, and finally your time zone.

Figure 11: Time Zone Configuration Confirmation After that is complete, you will be asked if you want Linux compatibility on the system; again I would say no. If you do end up needing this, you can always install a more up-to-date version from ports (more on that later). You will then be asked if the system has PS/2, serial or bus mouse. Answer according to your system, but chances are no will be fine for your configuration. Next, the installer will ask you if you want to install any software from the ports system. Select no: the ports that come with install CD are out of date by the time you have downloaded them. We will update the ports system to reflect the latest and greatest later. You will then be asked if you want to setup users and groups, select no, it’s easier to have all the user-friendly shells, such as bash installed first and then use sysinstall to configure new users. Next, the installer will ask you to enter the root password; this should be secure, although it is easy enough to change the password later using the passwd utility. You will then be presented

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL

81


Issue 14 with your last chance to change any of the configuration options. Select no, and then exit the installer. The system will then automatically reboot. The first time the system boots you will be prompted to enter some random text on the keyboard. This is to generate the entropy used to generate the systems SSH keys. It is important that you hit a wide number of keys, with varying cadence so that the entropy is appropriately random. That’s it! You have successfully installed the FreeBSD operating system. FreeBSD was used for Hotmail’s email service before the company was acquired by Microsoft

Installing and updating software FreeBSD has a first rate package management system, giving users the option to install pre-compiled binaries or compile software from source. Packages, the pre-compiled binaries provided by the FreeBSD team, are managed with a series of commands that start with pkg_*; on the other hand the ports (software that is compiled locally) is managed via the make utility with commands such as make install, make deinstall and make clean. FreeBSD’s ports and package management Packages FreeBSD packages are binary files recognizable by the extension .tbz. The most common command you will use when dealing with packages is pkg_add "packagename". Other useful commands are pkg_info, pkg_version and pkg_deinstall. pkg_info with no arguments will show you the version of every package installed. pkg_info zip-2.31 will show the information of the zip program installed on your system. pkg_info diablo-jdk-freebsd6-1.5.0.06.00.tbz will show you the information for the FreeBSD native jdk waiting to be installed. pkg_version will display the relative version of packages installed versus what’s available via ports. pkg_deinstall takes the short name of the package, and will remove it. Here, the package name to be used is the one displayed by pkg_info or pkg_version. Ports FreeBSD ports are compiled from source into the binary packages mentioned above, and then installed. The ports tree, or location of ports files is /usr/ports, which contains a number of categorized subdirectories. Ports are basically make files with a little FreeBSD magic that contain the location of the files to download and their version. The Makefile in each directory includes a global make file /usr/ports/Mk/bsd.port.mk that contains the macros for downloading and unpacking files; so, installing ports is as easy as changing directories to the port and typing make install && make clean. FreeBSD ports are managed via CVS, but there are a variety of wrapper tools such as cvsupdate and portupgrade to automate routine tasks like updating ports and upgrade any packages. When installing software from the ports tree you will often be presented with compile time options that affect the behavior of the package. One common way to specific options is with the -D option to make; for example to compile subversion without BDB support you would type make -DWITHOUT_BDB install && make clean. Now that you have some background on FreeBSD’s package management options, it’s time to get started and install some useful software. The first thing you need to do is make sure our ports are current and update any outdated packages; the first two packages you will install are cvsupdate and portupgrade (in that order). cvsupdate is used to update the ports tree with the CVS repository stored on the FreeBSD servers, and portupgrade is an automated tool that upgrades packages.

82

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL


Issue 14 Here are the steps to take: • cd /usr/ports/net/cvsup-without-gui • make install && make clean (this will install cvsup and clean up all the temporary files) • Create a directory for the cvsup config file: mkdir /root/config/cvsup • cp /usr/share/examples/cvsup/stable-supfile /root/config/cvsup • edit /root/config/cvsup/stable-supfile (See text box) • From /root/config/cvsup type cvsup -g -L 2 stable-supfile • cd /usr/ports/sysutils/portupgrade • make install && make clean • portsdb -uU (Will update version information in ports database) • portversion | grep "<" (will list packages that are out of date) Configuring cvsup and using sysinstall cvsup cvsup has a simple configuration file that must be passed as a parameter. The example files in /usr/share/examples are pretty self-explanatory; however, the key points of configuration are the update server, what to update, and the version to update to. default host should be set to the nearest cvsup mirror. The FreeBSD handbook (Google: freebsd cvsup mirrors) has a list of mirrors in different countries. default release=cvs tag=RELENG_6 this line should remain unchanged; it affects the version of source code to be synced and downloaded to /usr/src, not the ports that we will be installing. The default file has a line that reads src-all: it instructs cvsup to synchronize all the source code packages; however, you also want to update the ports and documentation packages; so, you must add the following two lines: ports-all tag=. doc-all tag=.

Sysinstall Now that you have a fully updated system, it would be a good time to add a new user. FreeBSD’s configuration utility, which is also used during the install process, is called sysinstall. To use it simply type /usr/sbin/sysinstall. You will then be presented with the text based interface: simply select configure and user management for guided user management. You should now have a fully up to date system, with the tools to repeat the process at a later date. It’s now time to install some more software that will lay the ground work for configuring your email server FAMP—FreeBSD-Apache-MySQL-PHP The best aspect of installing via ports is that it resolves dependencies much like Debian’s apt. Installing the latest version of Apache is a breeze: simply change directories (cd) to /usr/local/www/apache22 and type make install && make clean. Next install the MySQL database server: change directories to /usr/ports/databases/mysql50-server and type make install && make clean. This will also automatically install the mysql-client package. Next install the php5 package from /usr/ports/lang/php5. After typing make install you will be prompted with an text based menu: you must select one of the options Apache Module and enable it by hitting the space bar Schedulers and building kernels

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL

83


Issue 14 ULE vs. 4BSD The ULE scheduler was recently introduced and provides similar pre-emptiveness to that of the 2.6 Linux kernel. The ULE scheduler was initially rolled out during the 5.x series; however, due to system instability the default scheduler was reverted to the classic 4BSD scheduler. The ULE scheduler still isn’t enabled by default, as proven by the fact that its configuration line is commented out in the default kernel config file. The adventurous may choose to uncomment the ULE scheduler, and comment out the 4BSD scheduler and rebuild their kernels. Compiling the kernel Compiling FreeBSD’s kernel will be a little bit different for those used to compiling Linux kernels. There is no graphical, or semi-graphical text based interface to select the various parameters: as with many other things in FreeBSD a single, simple text file will do the trick. The default kernel configuration files are located in /usr/src/sys/{YOUR_ARCH} where arch will most likely be i386 or amd64. It is highly recommended to copy the GENERIC file to a safe location, like /root/config/kernel/MYKERNEL and then symlink it back to /usr/src/sys. This is to prevent the accidental deletion of your config if you decided to blow away /usr/src. The name of the kernel config file is not enough to distinguish it from other kernel configuration files; instead the IDENT line must be changed to reflect the name you choose for your configuration, MYKERNEL in this particular case (for this article). To build and install the kernel with your custom config, simply change directories to /usr/src and invoke make buildkernel KERNCONF=MYKERNEL. The command to install the newly built kernel is similar: make installkernel KERNCONF=MYKERNEL. # Should be changed to the identifier of your custom config ident GENERIC -- Becomes -ident MYKERNEL # Scheduler Options #options SCHED_ULE options SCHED_4BSD

# ULE scheduler # 4BSD scheduler (This is the classic scheduler)

cd /usr/src make buildkernel KERNCONF="KERN_LABEL" make installkernel KERNCONF="KERN_LABEL"

FreeBSD services Now that you have some of the key software packages in place, let’s take a look at how FreeBSD manages daemons. FreeBSD uses a simple, single run-level system controlled by a handful of text files, with /etc/rc.conf at the center of it all. Unlike most GNU/Linux, which rely on the AT&T SysV startup system (which is a series of symlinks to various directories that relate to various runlevels), a single one line entry in /etc/rc.conf will determine if a daemon is started when the system boots up. For example: apache22_enable="YES" will obviously enable Apache 2.2.x at system start-up. FreeBSD’s default firewall ipfw2 is also started via the /etc/rc.conf file. Here’s what your rc.conf file should look like: cron_enable="YES" firewall_enable="YES" firewall_logging="YES" # Note: firewall_type can also be open, or closed for default ipfw2 canned rule sets

84

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL


Issue 14 firewall_type="/etc/ipfw2.conf" apache22_enable="YES" apache22_flags="" mysql_enable="YES" mysql_dbdir="/var/db/mysql" mysql_args="--user=mysql" # Note: For email package we will configure in the next article. courier_authdaemond_enable="YES" courier_imap_imapd_enable="YES" courier_imap_imapd_ssl_enable="YES" clamav_clamd_enable="YES" clamav_freshclam_enable="YES" amavisd_enable="YES"

DNS and email The role DNS plays in relaying email is small, yet vital. The most common DNS records are A, CNAME, and PTR for reverse DNS. However, the record type for email servers is the MX, or “Mail eXchanger” record. Each domain, such as “cnn.com” must have an MX record so that mail sent to user@cnn.com is routed to the proper MTA server. The MX record entry has two points of configuration: the priority of the mail host, and the name of the mail host. The priority of the MX host determines which server the client doing the lookup will send its mail to. Thus, if you define two MX records with priorities of 10 and 20, the mail exchange with priority 10 will receive the mail (assuming it’s up) DNS and Email example IN IN

MX 10 MX 20

mx.mydomain.com mxbackup.mydomain.com

FreeBSD’s firewall ipfw2 FreeBSD comes with a powerful, stateful software firewall package called ipfw2; while FreeBSD does have the ability to use other firewalls such as OpenBSD’s pf, this article will focus entirely on ipfw2. ipfw2 has a rich feature set and a full discussion on its configuration is beyond the scope of this article. This is the quick and dirty, annotated configuration that is applicable to your setup in the context of an email/webmail server. ipfw2 rule files always follow a very simple syntax: directive order type from HOST to HOST port_number via interface optional_state_setting. # Yousef Ourabi, Zero-Analog 2006 #IPFW uses the following syntax # CMD RULE_NUMBER ACTION LOGGING SELECTION STATEFUL # Values from /etc/rc.firwall -- Setup loopback add 100 pass all from any to any via lo0 add 200 deny all from any to 127.0.0.0/8 add 300 deny ip from 127.0.0.0/8 to any # Allow inbound SSH and outbound icmp (for ping command) add 400 allow all from any to mail.mydomain.com 22 via fxp1 keep-state add 500 allow icmp from mail.mydomain.com to any via fxp1 keep-state # Mail, Webmail, Secure Webmail (HTTPS), and IMAP-SSL

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL

85


Issue 14 add 600 allow add 700 allow add 800 allow add 900 allow keep-state

all all all all

from from from from

any any any any

to to to to

mail.mydomain.com 25 via fxp1 keep-state mail.mydomain.com 80 via fxp1 keep-state mail.mydomain.com 443 via fxp1 keep-state mail.mydomain.comm 993 via fxp1

# Block outbound SSH, and allow all other outbound connections. add 1000 deny all from mail.mydomain.com to any 22 add 1100 allow all from mail.mydomain.com to any keep-state # Block everything else. add 65535 deny all from any to any

Conclusion FreeBSD is an incredibly powerful and robust operating system worth giving serious consideration for projects that require a rock solid OS. So legendary is FreeBSD’s robustness that it was used by Hotmail in the early days before it was acquired by Microsoft. You should now have a fresh and updated FreeBSD install to continue your journey with. This article was all about taking the first steps with FreeBSD, and learning a little bit of the history along the way. The following article will focus on configuring the email, and web servers such as Postfix, Apache and Squirrelmail to handle multiple domains, users, giving users access to their email via the web and protecting ourselves against spam and viruses. Hope to see you soon!

Resources and further reading • 386 BSD Wikipedia entry (http://en.wikipedia.org/wiki/386BSD) • FreeBSD Wikipedia entry (http://en.wikipedia.org/wiki/FreeBSD) • Solaris Wikipedia Entry (http://en.wikipedia.org/wiki/Solaris_Operating_Environment) • SunOS Wikipedia Entry (http://en.wikipedia.org/wiki/SunOS)

Biography Yousef Ourabi (/user/43" title="View user profile.): Yousef Ourabi is a developer in the San Francisco bay area. He is currently working at the startup he recently founded, Zero-Analog (http://www.zero-analog.com " title="Zero-Analog). Zero-Analog is currently developing an enterprise application, however, one of its stated goals is "to increase the rate of open source adoption in companies of all sizes, across all industries". Zero-Analog also offers consulting services, all based around open source tools, frameworks and applications. He can be reached at: yourabi@zero-analog.com.

Copyright information Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. Source URL: http://www.freesoftwaremagazine.com/articles/secure_email_server_bsd_part_1

86

Build a secure email server with FreeBSD, Postifx, ClamAV,Spamassasin, and MySQL


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.