Dovecot on the side please

by Stephen McGroarty 1/14/2010 2:04:00 PM
Quick and dirty web post for dovecot
 
So here we go with dovevot for checking that spiffy new mail server.
Since I have postfix encrypting the passwords so I dont have to worry about admins being trustworthy that presented a fun issue or two and here is how i got around them.

I did the default install of dovecot 
yum install dovecot 
and then edited the funk out of my /etc/dovecot.conf file

dont forget to make a backup of it before you edit it

#where to run it 
base_dir = /var/run/dovecot/

# Just the basics, no s protocols with it 
protocols = imap pop3 

#listen on all addresses and standard ports 
listen = [::]

#i wanted to seperate it from my maillog so that i could get a better reading of whats going on 
log_path = /var/log/dovecot 
log_timestamp = "%Y-%m-%d %H:%M:S "

# what directory should it "login to" 
login_dir = /var/run/dovecot/login

# most people have this as /var/vmail/%d/%n 
mail_location = maildir:/home/vmail/%d/%n/Maildir

# !! Turn this off before going to production!! 
mail_debug = yes

# this is my postfix user ID and group ID 
first_valid_uid = 89
last_valid_uid = 89

# how many connections at a time 
max_mail_processes = 50

#specify the protocols and anything special about them
protocol imap {
}

protocol pop3 {
}

protocol lda {
  postmaster_address = postmaster@yourdomain.com
  hostname = mail.yourdomain.com
}

#this is to enforce standard user names 
auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@

# Again turn these off before going to production 
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = no

#how many worker processes per login (If needed) 
auth_worker_max_count = 20

# what type of authorization 
auth default {
   mechanisms = plain login digest-md5 cram-md5 
  passdb sql {
    #the location to your user and password information 
    args = /etc/dovecot-mysql.conf 
  }
  userdb sql {
     #the location to your database connection 
    args = /etc/dovecot-mysql.conf 
  }

#Tried a few things for this part, and this one finally worked for me 
  socket listen {
    client {
      path = /var/run/dovecot/auth-client
      mode = 0660
      user = postfix 
      group = postfix 
    }
  }
}

# Any special plugins you want to load up 
plugin {
}


That is simple enough, but it took a while to get everything dialed in, and now the killer, dovecot-mysql.conf. It was a pain getting this information straight so here it is 

#NOTHING i found mentioned the Driver =  anwhere .. it was a leap of faith to get it 
driver = mysql

# if you do not have encrypted password you do not need this part 
default_pass_scheme = CRYPT

# YOUR database connection string 
connect = host=localhost dbname=postfix user=postfixuser password=mySuperSecretPassword 

#get the password for the user name 
password_query = SELECT password FROM mailbox WHERE username = '%u'

# change to reflect your mail directories, your postfix user/group number and quotas 
user_query = SELECT '/home/vmail/%d/%nMaildir' as home, 'maildir:/home/vmail/%d/%n/Maildir' as mail, 89 AS uid, 89 AS gid, concat('dirsize:storage=',quota) AS quota FROM mailbox WHERE username ='%u' AND active ='1'

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Super Duper Postfix!

by Stephen McGroarty 1/2/2010 6:24:00 PM
Postfix + MySQL on CentOS 
Some things might not be right, but this is what worked for me, so if it doesn't work for you, sorry but this is how I did it, and it works. There are many many many links to doing this, so if this doesnt work keep searching. 

For this I started with a clean CentOS install, it was CentOS 5.4. During the CentOS install I used the advanced package options and I selected squirrelmail, httpd(web server), mysql, and I unchoose sendmail, it still installed sendmail. 

After the machine is booted and updated we then want to setup the mysql database and user.

/etc/init.d/mysqld start

mysql -u root -p 
Password: ***************************************** (not really my password, but you get the idea

mysql> create database postfix 
Query OK, 1 row affected (0.00 sec)

mysql> grant all on postfix.* to 'postfixuser'@'localhost' identified by 'MySuperSecurePassword!'; 
Query OK, 0 rows affected (0.00 sec)

now we want to add the postfix packages. 

/etc/init.d/sendmail stop 
yum remove sendmail 
yum install php-mysql spamassassin php php-mbstring postfix 

Postfix should now be installed, but it is missing some things. 
[root@localhost ~]# postconf -m
btree
cidr
environ
hash
ldap
nis
pcre
proxy
regexp
static
unix

If you notice, there is not MySQL support in there. That is in a special package in the CentOS Plus repo. 
wget http://mirror.centos.org/centos-5/5.4/centosplus/i386/RPMS/postfix-2.3.3-2.el5.centos.mysql_pgsql.i386.rpm 

When you do the rpm install it will tell you that you need postgressql, i just installed it and made sure it was off and the service was off.
yum install postgresql 

When you install postfix from the RPM it will tell you that you have a newer version on your system, and that is why we are using the --force 
rpm -U postfix-2.3.3-2.el5.centos.mysql_pgsql.i386.rpm --force  

Restart the server/service then run the postconf -m again to verify the MySQL support
[root@localhost ~]# postconf -m
btree
cidr
environ
hash
ldap
mysql
nis
pcre
pgsql
proxy
regexp
static
unix

Next we want to add Postfix Admin, there is no RPM for this, but it is a simple web application that will setup the tables in the database for you. 

http://sourceforge.net/projects/postfixadmin/
Because this is going to be a straight mail server, I just untared it in the /var/www/html directory and set it up from there. This is a nice utility for managing and maintaining users, and you can create admins per domain so that they can manage their own accounts. 

connect to the server at the postfix admin URL and configure that, it will allow you to configure the databases even though we haven't setup postfix to use the databases yet. 

After you have postfix admin configured it is time to add the magic to the postfix/main.cf file. 
You want to change it to allow users 
Be sure to find the corisponding lines here and comment them out or change them in the main.cf

#MySQL DB properties
# This is for the virtual users 
virtual_alias_maps = mysql:/etc/postfix/virtual_alias_maps.cf
# the group id that postfix runs as 
virtual_gid_maps = static:89
# Create this directory and chmod -R postfix:postfix /home/vmail 
virtual_mailbox_base = /home/vmail
# this will be the domains that are allowed to send/receive on the box 
virtual_mailbox_domains = mysql:/etc/postfix/virtual_domains_maps.cf
# mailboxes 
virtual_mailbox_maps = mysql:/etc/postfix/virtual_mailbox_maps.cf
# more user and groupIDs 
virtual_minimum_uid = 89
virtual_mailbox_uid = 89
# we want the transport type to be virtual instead of physical 
virtual_transport = virtual
virtual_uid_maps = static:89

And the Database connections

cat virtual_alias_maps.cf
user = postfixdatabaseuser
password = password
host = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address

cat virtual_alias_maps.cf
user = postfixdatabaseuser
password = password
host = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address

cat virtual_domains_maps.cf
user = postfixdatabaseuser
password = password
hosts = localhost
dbname = postfix
table = domain
select_field = description
where_field = domain

Restart the postfix server, add to local users with postfix admin, and use squirrelmail to verify that you can send and receive emails.

Again this is a general overview, email me if you have any questions.
Edits might be made to this as time goes on as well.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

In this corner

by Stephen McGroarty 12/29/2009 7:27:00 PM

Fun issue, and I don't have an answer to this one. I am running Debian linux, and loving it on my desktop at work, but not on my laptop at home.  I am not happy with the laptop because I can't run Compiz. Normal people wouldn't care about this, but this means I can't run the expose clone for linux. I don't care about any of the other fancy stuff that Compiz can do, just that one thing. The problem is not hardware related, my hardware runs it fine, except when i suspend the system. When I suspend the system it just doesnt come back. It goes off, flashes the mouse, and hangs there.

I have found a couple of scripts that I could not get to work correctly, mostly because they are for ubuntu and that uses a differnt power management system. I have found that when i unsuspend, if i am quick on the keys, i can switch to the console, wait a second or two, then switch back and it comes back. 

I have no idea where the issue lays, the hardware is Intel Video GM45,  intel chipsets all the way around. Without Compiz suspend/sleep works fine. 

So my friends, i am at a loss with this one, if you have an answer hit me with an email.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

From the mouth of madness

by Stephen McGroarty 12/19/2009 3:23:00 PM

So I am using an odd assortment of things in my little world. I have Windows 7, Windows Vista, and Debian Linux on my work/home machines and strangely enough they all have web cams. With that I remembered that I have an account over at UStream.tv and that I did broadcast before, so why not do it again. 

Found the only issue is that my debian desktops dont like to broadcast, this seems to be a common issue with Linux desktop because Flash does not prompt you to allow or deny  the application. In poking around I found the application WebCam Studio for Linux and on the bottom of the "Installing on Ubuntu" page was the answer. 

1. Close all browsers

2. Go here:  http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager06.html

3.  Find "www.ustream.tv" and "cdn1.ustream.tv" and change them from "Always Ask" to "Allow" 

4. restart web browser, go to UStream.tv, login, and click broadcast. 

If your camera does work in linux you should not be able to broadcast.

If this doesnt work, make sure your webcam works in general because this is only a solution for broadcasting on websites, not making your cam work.  

I might do another post tonight if i am feeling motivated enough 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Weekly Tip

Back to the command prompt!

by Stephen McGroarty 12/16/2009 7:22:00 PM

Hello Whirled is a bit over stated from here, but  I found myself using Linux on my laptop and a desktop at work. This is only amusing because I am currently a Windows Administrator. What makes this stranger is I chose a version of Linux that I had used once before and never thought anything of since. I am currently using Debian 

I am finding it a bit more resourceful and it is also missing a lot of fluff, once I got passed the fact that FireFox wasnt installed that is. So far in the last month I have writen more windows and linux scripts from my debian box than i have in the last six months. Yes you can write the scripts with VIM and then copy them over to a windows box, or even map the windows share directly with GNOME Desktop. One of my complaints though, I dont like GNOME and I would prefer Enlightenment but we cant all be winners. 

Also in the last month I have learned a few more things about MySQL, I think my next post will be more towards that and include a couple of simple things that I am finding handy.

 

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

But I'm not dead yet

by Stephen McGroarty 12/5/2009 6:15:00 PM

Lately at work I have been working with Ruby on Rails. I really do not like Ruby on Rails. It does get tollerable with the apache plugin Passenger. It allows you to use Apache to control the rails app instead of lighttpd or mongrel+apache proxy. It also supports automaticly restarting the rails app when it crashes, and if you have ever done a rails app you know it crashes a lot under any type of load or uptime. I really dont like Ruby on Rails. But I am finding out it is possible to migrate an app from one server to another, not easy but possible. 

 

Next item is I am running Windows 7 and Debian on different computers at the same time. Its just fun, things like in debian if i am running compiz on my laptop i cant sleep and recover. Small little things make it fun. 

ok this is a rambling post because i hsould post something and i am not feeling well. 

 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

I am not abandoned!!!

by Stephen McGroarty 11/3/2009 9:04:16 PM

Ok so i haven’t been giving my blog much love lately, like the last three months or so, but I had a few things going on. Right now, this very second, i am trying to get my CCNA and not doing to well in the practice tests, so i need to study a lot more. Also I am doing a lot more linux at work, so i have been busy there and i just not have felt the love to talk about myself or share any tech tips lately. That is going to change soon though.

Side note, NO MORE COMMENTS!!!!!!!  tired of all those fuckers trying to sell their shit from my site and not even give me a link, so comments are off.

Also, i just checked, and yeah, i need to login to gmail more.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Something for nothing

by stephen mcgroarty 8/13/2009 6:14:22 PM

In playing with the cabinet I received a while ago, I thought it was time to fill it up and use it. I was able to get a couple of servers from a friend at a really good price. I got the servers a few months ago and they have been sitting under the couch collecting dust, until last weekend when I racked what I could.

HomeCab

After re-arranging the room to be able to use the cabinet and get to the servers I only had to buy RAM for one of them, and that is so that I can install VMware ESX4i on it.

The plan is simple, now that I have all this power, lets do something with it.

 

vmware overview diag 

If you notice, I am going to try to integrate a windows 2008 server into a windows 2003 network. The main point of this exercise is to see what I can do with “scrap” hardware. Each ESX host is limited by the amount of RAM that can be used, in my case 4GB at once. The second limitation on this is drive space. I only have 200GB total space available, and that is because I want to keep my costs extremely low and not buy drives. How can I do this without buying the operating systems? Well since this is a lab I am not going to pirate the OSes, I am going to download them. For free. Microsoft allows you to download the operating systems as either a Virtual Disk or a limited 180 day trial. Since my tests and wants are going to go less than 180 days this is a good option. For the storage backend I am going to be using OpenFiler because it can do it all, at a very low cost. Depending on how well OpenFiler works, I might go out and but 4 1TB drives and setup a RAID array with it later.

Comments are welcome on this post and I will keep an update running here as for how well it works out, but until next time space cadets

--Stephen

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Where is my earth shattering Kaboom

by Stephen McGroarty 8/1/2009 9:17:07 PM

Well, I tried. I don’t have any RAM for my 64bit machine. Now, when i say not any RAM I actually mean very very little. It has 256MB of RAM. I think I need to get some for it before I can keep going with the VMware posts.

I do have VMware ESX 3i up and going, and right now I am installing Windows 2008 server on it. I am doing this as sort of my own personal tests. I want to see what is needed to update an Active Directory domain from 2003 to 2008.

Will update a few things after I get some RAM.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Administration

And then there was one

by Stephen McGroarty 7/26/2009 6:00:45 PM

I have chosen VMWare as the base virtual machine system, but I did site that one reason was because it could be installed on a machine that did not have 64bit extensions. Well this has changed with VMWare 4. The newest version does require 64bit but it does extent the memory and CPU limitations that the server had before.

To get started with vmware, you first want to down the version that suites your needs best, for home use and learning of the basics, I recommend ESXi version 3.5 or 4.0 depending on your hardware. http://www.vmware.com/download/esxi/

After you choose to download, you want to sign in, or if you dont have an account sign up for one, it will just make life simpler.

After you download the ISO, you will want to burn it to a CD and go. You can do this easily. My lab isnt setup at this moment so I need to setup my hardware before I burn the ISO to a disk, but once its done the disk will install on bare metal so you dont need to install any additional OS with the disk.

Next post I will go into more detail such as “how to add storage array” and “how to use the damned thing”  but till i get my lab together this will work.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen
Hacked by Stephen McGroarty
Content © Stephen McGroarty


About the author

Stephen Mcgroarty - Avatar Stephen McGroarty

I am a Microsoft Certified Professional with Windows 2003 Server. I have a firm understanding of Linux, Windows, and everything needed for both workstation and servers.

E-mail me Send mail

Calendar

<<  September 2010  >>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

View posts in large calendar

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010