Postfix Generic

While it is certainly possible to masquerade messages from your Postfix server using the "myorigin" parameter, it may have some undesirable side effects like you needing to also set up Postfix to receive email for the masqueraded domain using the "mydestination" parameter. In addition, using this approach is an all or nothing choice (except for the root user who remains exposed from the real origin).

Instead, if you want to be able to just masquerade a few user accounts, so that it appears that emails from these accounts are masqueraded and not all, then the Postfix "generic" option may be for you.

When I send email from the command line in Linux (Fedora 14) from my keith account (to an address not on my machine), I want it to appear that the email originated from my wright.keith@gmail account. Otherwise, most likely my email will get bounced because it will appear to have come from keith@nv53a.fedora.test.

Here's what I did to achieve this:

1. I added these two lines to the /etc/postfix/generic file:
keith@localhost wright.keith@gmail.com
keith@nv53a.fedora.test wright.keith@gmail.com

2. I added this line to /etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic

3. I executed this command as root to hash the generic file into generic.db:
postmap /etc/postfix/generic

4. I restarted postfix to make the changes effective:
service postfix restart

Thanks to this wonderful tip from nixcraft.com (not sure why the url is cyberciti.biz):


Rawhide Reflections

As an earlier post indicated, I'm running Fedora 14 Alpha. When you use non-released versions of Fedora, you might be said to be running Rawhide. I won't say that I wasn't warned that things would break occasionally, but this morning it BAD! When glibc broke, then the system became unbootable.

Lucky for me, I've got a USB key with Fedora 14 Live on it. Also fortunate, the Fedora Project already had an update that fixed the problem. All I had to do was boot up the Live USB, and do a few simple commands to fix it:

# vgscan
# vgchange -a y
# mount /dev/mapper/vg_host-lv_root /mnt
# yum -y --installroot /mnt update glibc

The first command searched my internal hard drive for LVM Volume Groups.
The second command activated the volume group (vg_host) that it found.
The third command mounted the logical volume (lv_root) for my root filesystem under /mnt.
The fourth command actually fixed the problem: it told yum to update the broken package, but to install the update under /mnt, where my real root filesystem is located.


Android Applications To Pay For

I've only bought a few Android applications, but I've not been disappointed.

I love the new Swiftkey Keyboard. Never seen a keyboard predict text so well.

Titatium Backup is awesome, the free version works, but can become tedious since it doesn't automate the restore process.

I would pay for SetCPU, but being a member over at xda-developers.com, I got it for free!

Winds of Steel is still one of my favorite games.

Minisquadron has a very cool interface and is lots of fun.

When Angry Birds comes out with a full version, I'll probably buy it too!


Android Terminology

AOSPAndroid Open Source Project
bootloaderThe first program that is executed when starting a phone which might then boot the operating system, or take the user to a recovery mode.
deodexedA ROM that has been repackaged with all applications no longer using optimized dex files, so they can be more easily modified.
recoveryA special mode that allows the user to install official updates or to reset the phone. It is often modified to allow for installing unsigned updates or ROMs.
ROMRead Only Memory when I went to school, but to a phone, this is like an Operating System and the pre-installed programs that come along with it.
rootThe superuser who can override normal access controls present on the phone.
rootingThe process of enabling the root user to be able to execute programs on the phone.

I was just going to write some others, and then I found this nice wiki with Terminology from one of the most renowned modders: http://wiki.cyanogenmod.com/index.php?title=Terminology

Apache Access Control Order, Allow, Deny Confusion Ended!

Sometimes I go weeks, or even months between teaching how to control access to directories using an Apache web server. When the time comes to teach it again, I sometimes find that even I am confused about how the Order statement affects Allow and Deny from statements. Today, I worked out a couple of examples to help end this confusion permanently!

First of all, I will assume your web server is already up and running, and that there is a directory block that will permit the use of a .htaccess file to control access to that directory or its subdirectories.

In the default configuration file, I have enabled user home directories with the statement:
UserDir public_html
and not disabled by adding a #, so the other UserDir line looks like this:
# UserDir disabled

Just below this, I have also uncommented the Directory block for user home directories like this:

AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# Order allow,deny
# Allow from all

# Order deny,allow
# Deny from all

The important thing in this block is that AllowOverride permits Limit,
which lets us use .htaccess files with Order, Allow from and Deny from statements.

To allow just the web server access to my home directory, I have executed:

setfacl -m u:apache:x /home/keith/
mkdir /home/keith/public_html
restorecon -v /home/keith/public_html

To create a directory that would be mostly open:

mkdir /home/keith/public_html/denyremote
echo 'Deny from 192.168.1. network' > /home/keith/public_html/denyremote/index.html

In a file /home/keith/public_html/denyremote/.htaccess

Order Deny,Allow
# Deny is processed first
Deny from 192.168.1.
# Allow is processed second
Allow from
# If matched by both then allowed
# If matched by neither then allowed

To create a directory that would be mostly closed:

mkdir /home/keith/public_html/localsonly
echo 'Allow from only' > /home/keith/public_html/localsonly/index.html

In a file /home/keith/public_html/localsonly/.htaccess

Order Allow,Deny
# Allow is processed first
Allow from
# Deny is processed second
Deny from
# If matched by both, then denied
# If matched by neither, then denied

Udev Rule for Android SDK

Either because I have wanted to use adb commands, or actually use the Android SDK, I find that I not only need to install the SDK from: http://developer.android.com/index.html, but also I need to write a udev rule.

One sign that you need a udev rule is when you execute the command, adb devices, you see output something like:

List of devices attached
???????????? device

First, you need to attach the Android phone with the USB cord, and have the Settings, Applications, Development, USB debugging enabled on the phone. Next execute the command, lsusb. In my case, the line I'm interested in shows my phone like this:

Bus 001 Device 005: ID 0bb4:0c9e High Tech Computer Corp.

Notice the hexadecimal digits that I have bolded from this line. They need to be modified to match the digits of the attached phone in a rule file such as /etc/udev/rules.d/51-android.rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c9e", MODE="0666" SYMLINK+="android_adb"

The location and name of this file is very important!

By the way, I found a great blog entry on how to write udev rules today:


Android 2.2 APPS2SD

You can usually override the default Froyo install location on the system, by doing:

pm setInstallLocation 1

The different values are:
0 [auto]: Let system decide the best location
1 [internal]: Install on internal device storage
2 [external]: Install on external media

The default value is "0".

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.