Changes between Version 1 and Version 2 of QuickstartGuide

Show
Ignore:
Timestamp:
04/05/06 23:39:19 (4 years ago)
Author:
jfp (IP: 62.212.97.80)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • QuickstartGuide

    v1 v2  
    33== Get a package == 
    44 
     5 * Auto built (latest) http://autobuild.jsmtpd.org  
     6 * Releases http://sourceforge.net/project/showfiles.php?group_id=132129 
     7 
     8== Unpack == 
     9 
     10Packages are tar.bz2 archives.  
     11 * On Linux, use something like "tar jxvf Jsmtpd-xxx.tar.bz2" 
     12 * On Windows, use a archiver able to unpack them (winrar is one example) 
     13 
     14You get a directory holding a jsmtpd installation 
     15 
     16== Start me up (Windows) == 
     17 
     18 Get in the Jsmtpd's directory. In command shell, execute startup.bat, or double click on it in explorer. You'll get a window with  
     19 
     20{{{ 
     21G:\Jsmtpd-200604041051\Jsmtpd>startup.bat 
     22.;etc\;lib\commons-logging.jar;lib\crypt.jar;lib\dnsjava-1.6.5.jar;lib\jsmtpd-core.jar;lib\log4j-1.2.9.jar;lib\tiger-jav 
     23amail-1.0.jar;lib\xercesImpl.jar;lib\xmlParserAPIs.jar;plugins\basicPlugins.jar;plugins\jsmtpd-snippet.jar;plugins\filte 
     24rs\ClamAV\jsmtpd-clamav.jar;plugins\filters\SA\jsmtpd-SA.jar;plugins\filters\Jasen\commons-beanutils.jar;plugins\filters 
     25\Jasen\commons-collections-3.1.jar;plugins\filters\Jasen\commons-digester.jar;plugins\filters\Jasen\fastutil-4.3.1-jasen 
     26.jar;plugins\filters\Jasen\jasen.jar;plugins\filters\Jasen\jsmtpd-jasen.jar;plugins\filters\Jasen;plugins\inputIPFilters 
     27\jsmtpd-inputIPFilters.jar 
     28 0    [main][ INFO] org.jsmtpd.Controler - Jsmtpd 0.6a-unstable, Copyright (C) 2005 Jean-Francois Poux - jfp@jsmtpd.org 
     29 0    [main][ INFO] org.jsmtpd.Controler - Jsmtpd comes with ABSOLUTELY NO WARRANTY; 
     30 0    [main][ INFO] org.jsmtpd.Controler - This is free software, and you are welcome to redistribute it under certain conditions; 
     31 0    [main][ INFO] org.jsmtpd.Controler - See the LICENCE file for details 
     32 0    [main][ INFO] org.jsmtpd.Controler - Server starting ... 
     33 625  [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.dnsServices.DNSJavaResolver, set DnsServers=192.168.10.1 
     34 641  [main][ INFO] org.jsmtpd.Controler - DNS Service plugin loaded : DNSJava resolver plugin for jsmptd 
     35 641  [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set RelayedHosts=10.0.0.0/255.255.0.0,127.0.0.1 
     36 641  [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set ValidUsers=*@localhost,*@yourdomain.com 
     37 641  [main][ INFO] org.jsmtpd.Controler - ACL Service plugin loaded : Simple Acces Control List plugin for jsmtp 
     38 656  [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, set MailDir=mailboxes/ 
     39 656  [main][ INFO] org.jsmtpd.Controler - Local Delivery Service plugin loaded : UnixMailboxWriter plugin for jsmtpd 
     40 672  [main][ INFO] org.jsmtpd.Controler - Remote Delivery Service plugin loaded : RemoteSmtpSender plugin fort jsmptd 
     41 672  [main][ INFO] org.jsmtpd.Controler - Input IP filter chain loaded 
     42 688  [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 3 threads 
     43 703  [main][DEBUG] org.jsmtpd.core.send.QueueService - Buffer set to 16 messages max for immediate processing 
     44 703  [main][DEBUG] org.jsmtpd.core.send.QueueService - Storage usage 0/1024 (in Mo) 
     45 703  [ThreadPoolControl-9][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 
     46 703  [main][ INFO] org.jsmtpd.core.receive.Receiver - Listening for connections on port 25 
     47 703  [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 1 threads 
     48 719  [ThreadPoolControl-14][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 
     49 719  [main][ INFO] org.jsmtpd.Controler - Delivery service started 
     50 735  [main][ INFO] org.jsmtpd.Controler - Server running 
     51}}} 
     52 
     53That's it, Jsmtpd is running. Use Control+C to stop it. 
     54 
     55== Start me up (Linux) == 
     56 
     57 Get execution rights on the startup.sh script : 
     58{{{ 
     59chmod 700 startup.sh 
     60}}} 
     61 
     62Then fire up jsmtpd : 
     63 
     64{{{ 
     65./startup.sh 
     66}}} 
     67 
     68You should get something like : 
     69{{{ 
     70 1    [main][ INFO] org.jsmtpd.Controler - Jsmtpd 0.6a-unstable, Copyright (C) 2005 Jean-Francois Poux - jfp@jsmtpd.org 
     71 8    [main][ INFO] org.jsmtpd.Controler - Jsmtpd comes with ABSOLUTELY NO WARRANTY; 
     72 11   [main][ INFO] org.jsmtpd.Controler - This is free software, and you are welcome to redistribute it under certain conditions; 
     73 12   [main][ INFO] org.jsmtpd.Controler - See the LICENCE file for details 
     74 13   [main][ INFO] org.jsmtpd.Controler - Server starting ... 
     75 1545 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.dnsServices.DNSJavaResolver, set DnsServers=192.168.10.1 
     76 1580 [main][ INFO] org.jsmtpd.Controler - DNS Service plugin loaded : DNSJava resolver plugin for jsmptd 
     77 1595 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set RelayedHosts=10.0.0.0/255.255.0.0,127.0.0.1 
     78 1599 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set ValidUsers=*@localhost,*@yourdomain.com 
     79 1600 [main][ INFO] org.jsmtpd.Controler - ACL Service plugin loaded : Simple Acces Control List plugin for jsmtp 
     80 1736 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, set MailDir=mailboxes/ 
     81 1737 [main][ INFO] org.jsmtpd.Controler - Local Delivery Service plugin loaded : UnixMailboxWriter plugin for jsmtpd 
     82 2134 [main][ INFO] org.jsmtpd.Controler - Remote Delivery Service plugin loaded : RemoteSmtpSender plugin fort jsmptd 
     83 2137 [main][ INFO] org.jsmtpd.Controler - Input IP filter chain loaded 
     84 2155 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 3 threads 
     85 2194 [main][DEBUG] org.jsmtpd.core.send.QueueService - Buffer set to 16 messages max for immediate processing 
     86 2197 [main][DEBUG] org.jsmtpd.core.send.QueueService - Storage usage 0/1024 (in Mo) 
     87 2208 [main][ INFO] org.jsmtpd.core.receive.Receiver - Listening for connections on port 25 
     88 2208 [ThreadPoolControl-9][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 
     89 2214 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 1 threads 
     90 2261 [ThreadPoolControl-14][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 
     91 2263 [main][ INFO] org.jsmtpd.Controler - Delivery service started 
     92 2264 [main][ INFO] org.jsmtpd.Controler - Server running 
     93}}} 
     94 
     95That's it, Jsmtpd is running. Use Control+C to stop it. 
     96 
     97Note that by default, Jsmtpd will try to bind on port 25...and this requires admin rights (uid=0, that's to say to be root). You can change the port in etc/jsmtpd.ini to a >1024 port for testings, but it won't be able to receive mails as smtp default is port 25. 
     98 
     99Error message of you try to run it on port 25 while not beeing root :  
     100{{{ 
     101 0    [main][ INFO] org.jsmtpd.Controler - Jsmtpd 0.6a-unstable, Copyright (C) 2005 Jean-Francois Poux - jfp@jsmtpd.org 
     102 7    [main][ INFO] org.jsmtpd.Controler - Jsmtpd comes with ABSOLUTELY NO WARRANTY; 
     103 10   [main][ INFO] org.jsmtpd.Controler - This is free software, and you are welcome to redistribute it under certain conditions; 
     104 11   [main][ INFO] org.jsmtpd.Controler - See the LICENCE file for details 
     105 12   [main][ INFO] org.jsmtpd.Controler - Server starting ... 
     106 1724 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.dnsServices.DNSJavaResolver, set DnsServers=192.168.10.1 
     107 1758 [main][ INFO] org.jsmtpd.Controler - DNS Service plugin loaded : DNSJava resolver plugin for jsmptd 
     108 1773 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set RelayedHosts=10.0.0.0/255.255.0.0,127.0.0.1 
     109 1776 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set ValidUsers=*@localhost,*@yourdomain.com 
     110 1778 [main][ INFO] org.jsmtpd.Controler - ACL Service plugin loaded : Simple Acces Control List plugin for jsmtp 
     111 1800 [main][DEBUG] org.jsmtpd.config.PluginLoader -    [set][c]:class org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, set MailDir=mailboxes/ 
     112 1802 [main][ INFO] org.jsmtpd.Controler - Local Delivery Service plugin loaded : UnixMailboxWriter plugin for jsmtpd 
     113 1810 [main][ INFO] org.jsmtpd.Controler - Remote Delivery Service plugin loaded : RemoteSmtpSender plugin fort jsmptd 
     114 1813 [main][ INFO] org.jsmtpd.Controler - Input IP filter chain loaded 
     115 1831 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 3 threads 
     116 1871 [main][DEBUG] org.jsmtpd.core.send.QueueService - Buffer set to 16 messages max for immediate processing 
     117 1874 [main][DEBUG] org.jsmtpd.core.send.QueueService - Storage usage 0/1024 (in Mo) 
     118 1884 [ThreadPoolControl-9][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 
     119 1887 [main][ INFO] org.jsmtpd.Controler - Network Listener is down 
     120 java.net.BindException: Permission denied 
     121        at java.net.PlainSocketImpl.socketBind(Native Method) 
     122        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) 
     123        at java.net.ServerSocket.bind(ServerSocket.java:319) 
     124        at java.net.ServerSocket.<init>(ServerSocket.java:185) 
     125        at java.net.ServerSocket.<init>(ServerSocket.java:97) 
     126        at org.jsmtpd.core.receive.Receiver.<init>(Receiver.java:53) 
     127        at org.jsmtpd.Controler.initReceiver(Controler.java:233) 
     128        at org.jsmtpd.Controler.startup(Controler.java:83) 
     129        at org.jsmtpd.Launcher.main(Launcher.java:38) 
     130 1903 [Thread-0][DEBUG] org.jsmtpd.Controler - Shutting down plugin : DNSJava resolver plugin for jsmptd 
     131 1904 [Thread-0][ INFO] org.jsmtpd.Controler - Jsmtpd shutdown 
     132}}} 
     133 
     134== Minimal things to configure == 
     135 
     136Take your favorite text editor and edit etc/jsmtpd.ini. The file holds the basic configuration of jsmtpd. Change the default hostname of your machine : 
     137{{{ 
     138#host running service 
     139localHost=testSmtp.mydomain.com 
     140}}} 
     141 
     142There are 3 points to setup in order to have a fully configured SMTP server : 
     143 * Configure your name servers (it's not Jsmtpd) 
     144 * Configure the ACL plugin : Jsmtpd has to determe which domain(s) it handles, and who are his local users. It also tells who is relayed throught the SMTP server. 
     145 * Configure delivery plugins : Jsmtpd will give local mails to a delivery system : likely a pop3 or a imap server. 
     146 
     147== What is a SMTP server == 
     148 
     149A SMTP server is a mail relay. It can receive mails for your users (by example, if you want to send me a mail jfp@jsmtpd.org, then a smtp server will receive the mail for me.)  
     150 
     151You (send mail to jfp@jsmtpd.org) ---> Your ISP SMTP ---(connects to jsmtpd.org server)---> jsmtpd.org server receives the mail for me. 
     152 
     153It's also an outgoing mail sender: When you send your mail, your local smtp server will handle the process of delivering the mail for you. 
     154 
     155A SMTP does not provide a way to read your mail ! Use a pop3 or imap server. 
     156 
     157== DNS configuration == 
     158 
     159You want to receive mail on your new SMTP server ? good. You have to tell the world where is the server receiving mail for your domain. Let's say you bought the domain name : yourdomain.com, and a machine(ip=1.2.3.4) running the smtp server. Create a subname for your machine, an address record : it will point to your machine's ip address 
     160{{{ 
     161smtp.yourdomain.com -> 1.2.3.4 
     162}}} 
     163 
     164Now, use a special dns field to declare your smtp servers :  
     165 
     166{{{ 
     167MX: yourdomain.com -> smtp.yourdomain.com 
     168}}} 
     169 
     170Refer to your service provider for such setup, or your DNS daemon manual. Personnaly, I use bind. 
     171 
     172To check your MX configuration is okay, do a simple NS lookup :  
     173 
     174{{{ 
     175nslookup 
     176> set q=MX 
     177> yourdomain.com 
     178(blah blah blah...) 
     179yourdomain.com      mail exchanger = 10 smtp.yourdomain.com 
     180}}} 
     181 
     182yourdomain.com has one mail server declared : smtp.yourdomain.com 
     183 
     184Now check that smtp.yourdomain.com is reachable : 
     185{{{ 
     186nslookup 
     187> set q=a 
     188> smtp.yourdomain.com 
     189Name:   smtp.yourdomain.com 
     190Address: 1.2.3.4 
     191> 
     192}}} 
     193 
     194At this point, there is a mail server declared, and it can be resolved to an ip address. Remote server can send mail to yourdomain.com. 
     195 
     196== ACL plugin ==  
     197 
     198Now, it's time to tell Jsmtpd the users/domain it handles. We will use a very simple ACL plugin loading it's config from file to memory. Edit the file etc/jsmtpd-plugin-config.xml. There is an ACL element : 
     199 
     200{{{ 
     201        <ACLSetup name="Basic ACL" class="org.jsmtpd.plugins.acls.SimpleACL"> 
     202                <propertyset name="RelayedHosts" value="10.0.0.0/255.255.0.0,127.0.0.1"/> 
     203                <propertyset name="ValidUsers" value="*@localhost,*@yourdomain.com"/> 
     204        </ACLSetup> 
     205}}} 
     206 
     207It's a plugin, it has a logical name ("Basic ACL"), it's java class is "org.jsmtpd.plugins.acls.SimpleACL". It works as explained before. Inside the plugin declaration, there are two propertyset  elements, they configure the plugin. 
     208 
     209First interesting element is RelayedHosts. It tells Jsmtpd it can relay hosts comming from the network(s) specified in the value attribute. Change it to whatever your network requires. 
     210 
     211Second element interesting is ValidUsers. Set a list of user@yourdomain to tell Jsmtpd who are his local users. You can use the * wildcard element to specify the whole domain. 
     212 
     213== Delivery plugin == 
     214 
     215As said before, you can't check your mails with a smtp server, Jsmtpd will give local mail to a delivery system, it's the job of the local delivery plugin. On linux, the one of the oldest system used is mailbox delivery. The smtp server writes mails to a file in mbox format, one file per user. A pop or imap daemon reads the file and allows users to get acces to their mailbox remotely. To do so, edit the file etc/jsmtpd-plugin-config.xml, and locate the LocalDeliveryService element, it looks like :  
     216{{{ 
     217        <LocalDeliveryService name="umw" class="org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter"> 
     218                <propertyset name="mailDir" value="mailboxes/"/> 
     219        </LocalDeliveryService> 
     220}}} 
     221 
     222The default implementation used for local delivery is org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, that's the plugin we mentioned before. The mailDir property is the path where mbox files are written. Usually, it's something like /var/mail on unixes. There are others delivery plugins in Jsmtpd : maildir format, LMTP protocol to feed systems like cyrus, or smtp relay to send the mail to other server. 
     223 
     224== Finished ? == 
     225 
     226Each time you change configuration, you have to restart Jsmtpd. Take a look at the manual for advanced configuration, or look in this wiki.