I use Postfix in a similar fashion to forward to another server. Using the three configuration options, but for your config there is an easier way.
- relay_recipient_maps = ldap:/etc/postfix/ldap_relay_recipients_maps.cf
- transport_maps = ldap:/etc/postfix/ldap_transport_maps.cf
- relay_domains = ldap:/etc/postfix/ldap_relay_domains.cf
One of my LDAP files looks like this for querying an LDAP source on Zimbra...
server_host=ldap://[mail.domain.com]:389
server_port=389
search_base=
query_filter = (&(|(zimbraMailDeliveryAddress=%s)(zimbraMailAlias=%s)(zimbraMailCatchAllAddress=%s))(zimbraMailStatus=enabled))
result_attribute = zimbraMailDeliveryAddress,zimbraMailAlias
version = 3
ldap_cache = yes
ldap_cache_expiry = 600
ldap_cache_size = 64256
bind = yes
bind_dn = uid=[valid login],cn=[valid cn],cn=[valid cn]
bind_pw = [a valid password]
timeout = 30
However, based on what you are looking for, it would be easier to keep the information in local hash tables that can be used for this purpose. The only thing you need to remember is that when you make changes to the files, you need to re-run postmap to build the postfix friendly hash table.
- relay_recipient_maps = hash:/etc/postfix/relay_recipients_maps
- relay_domains = fwddomain.com
- transport_maps = hash:/etc/postfix/transport_maps
You will need to create a text file in the above location with the following entry pairs: {[email address] OK}
email1@fwddomain.com OK
email2@fwddomain.com OK
email3@fwddomain.com OK
Run postmap on the file above to generate the actual hash file which is then created in the same folder as relay_recipients_maps.db. Postfix will now check this file for valid recipients for delivery.
You then need to tell Postfix where to send email for this domain when it is received. Doing the same thing with /etc/postfix/transport_maps file, you can enter vaild pairs which are the domain the email is going to and the host to forward it on to.
fwddomain.com smtp:mail.fwddomain.com
Hopefully this helps point you the right direction. There is alot more information on how to do these types of config files on the internet and others can even use DB's for lookups for these configuations options.