software:dovecot:archiveserver
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
software:dovecot:archiveserver [2023/07/28 18:41] – rodolico | software:dovecot:archiveserver [2023/09/25 15:19] (current) – rodolico | ||
---|---|---|---|
Line 25: | Line 25: | ||
===== Create a user and store for the e-mail ===== | ===== Create a user and store for the e-mail ===== | ||
- | We should use a different user/group for this and all mail will be owned by that user/group. Additionally, | + | We should use a different user/group for this and all mail will be owned by that user/group. Additionally, |
Message store (ie, home directory) can be anyplace. I'm going to set it up in /srv/vmail. This will be the head of a tree of subdirectories for individual users. Note, I use useradd (vs Debian' | Message store (ie, home directory) can be anyplace. I'm going to set it up in /srv/vmail. This will be the head of a tree of subdirectories for individual users. Note, I use useradd (vs Debian' | ||
<code bash> | <code bash> | ||
- | useradd --home-dir /srv/vmail --no-create-home --shell /dev/false --user-group --comment 'Used for vmail only' vmail | + | useradd --home-dir /srv/vmail --no-create-home --shell /bin/false --user-group --comment 'Used for vmail only' vmail |
mkdir -p /srv/vmail | mkdir -p /srv/vmail | ||
chmod 755 /srv/vmail | chmod 755 /srv/vmail | ||
Line 119: | Line 119: | ||
which would give us greater security. | which would give us greater security. | ||
+ | |||
+ | If you want, here is a little utility written in Perl that will do all of it for you. It takes a username and a password, then either updates or adds that information to the password file. It is NOT very friendly, and could use some cleanup, and the username/ | ||
+ | |||
+ | <code perl updatePasswd> | ||
+ | #! / | ||
+ | |||
+ | # WARNING: This is insecure as it will leave the users password in the | ||
+ | # bash history file | ||
+ | |||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | my $pwfile = '/ | ||
+ | my $user = shift; | ||
+ | my $password = shift; | ||
+ | |||
+ | die " | ||
+ | |||
+ | my $found = 0; # determines if user already exists | ||
+ | |||
+ | # call doveadm to get the hash | ||
+ | my $key = `/ | ||
+ | |||
+ | # read the password file | ||
+ | open PW,"< | ||
+ | my @data = <PW>; | ||
+ | close PW; | ||
+ | |||
+ | # go through it and see if the user already exists | ||
+ | my $newLine = " | ||
+ | for ( my $line = 0; $line < @data; $line++ ) { | ||
+ | my ($thisUser, | ||
+ | if ( $thisUser eq $user ) { # yes, so replace the line and mark found | ||
+ | $data[$line] = $newLine; | ||
+ | $found = 1; | ||
+ | last; | ||
+ | } # if statement | ||
+ | } # for loop | ||
+ | push @data, $newLine unless $found; # we did not find them, so add | ||
+ | chomp @data; # remove all line endings | ||
+ | |||
+ | # write the file back out | ||
+ | open PW,"> | ||
+ | print PW join( " | ||
+ | close PW; | ||
+ | |||
+ | # tell user what we did | ||
+ | print "User $user "; | ||
+ | print $found ? " | ||
+ | |||
+ | 1; | ||
+ | </ | ||
+ | |||
+ | |||
===== Setting up mail client ===== | ===== Setting up mail client ===== |
software/dovecot/archiveserver.1690587660.txt.gz · Last modified: 2023/07/28 18:41 by rodolico