Browse Source

Initial commit

Benjamin Collet 12 years ago
commit
3049e1853a
9 changed files with 124 additions and 0 deletions
  1. 19 0
      config
  2. 15 0
      run.sh
  3. 6 0
      templates/70-persistent-net.rules
  4. 1 0
      templates/hostname
  5. 18 0
      templates/hosts
  6. 22 0
      templates/interfaces
  7. 1 0
      templates/mailname
  8. 41 0
      templates/main.cf
  9. 1 0
      templates/maps.cf

+ 19 - 0
config

@@ -0,0 +1,19 @@
+[% hostname = 'template-squeeze' -%]
+[% domain   = 'fa0.org' -%]
+[% relayhost = 'smtp.fa0.org' -%]
+[% resolv = {
+  nameservers = [ '192.168.248.53' ]
+  search      = 'fa0.org'
+  }
+-%]
+[% interfaces = [
+    { name      = 'eth0'
+      ip        = '192.168.42.7'
+      netmask   = '255.255.255.224'
+      gateway   = '192.168.42.1'
+      ip6       = '2001:470:c8bc:2000::7'
+      netmask6  = '64'
+      gateway6  = '2001:470:c8bc:2000:ff::'
+  }
+  ]
+-%]

+ 15 - 0
run.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+DIR="/root/lacg/"
+CONFIG="$DIR/config"
+TPL="$DIR/templates"
+CMD=$(which tpage)
+
+$CMD --pre_process $CONFIG $TPL/hostname > /etc/hostname
+$CMD --pre_process $CONFIG $TPL/mailname > /etc/mailname
+$CMD --pre_process $CONFIG $TPL/hosts > /etc/hosts
+$CMD --pre_process $CONFIG $TPL/interfaces > /etc/network/interfaces
+$CMD --pre_process $CONFIG $TPL/main.cf > /etc/postfix/main.cf
+$CMD --pre_process $CONFIG $TPL/maps.cf > /etc/postfix/maps.cf
+$CMD --pre_process $CONFIG $TPL/70-persistent-net.rules > /etc/udev/rules.d/70-persistent-net.rules
+
+reboot

+ 6 - 0
templates/70-persistent-net.rules

@@ -0,0 +1,6 @@
+# This file was automatically generated by the /lib/udev/write_net_rules
+# program, run by the persistent-net-generator.rules rules file.
+#
+# You can modify it, as long as you keep each rule on a single
+# line, and change only the value of the NAME= key.
+

+ 1 - 0
templates/hostname

@@ -0,0 +1 @@
+[% hostname %]

+ 18 - 0
templates/hosts

@@ -0,0 +1,18 @@
+127.0.0.1 localhost
+[% FOR if IN interfaces -%]
+[% IF if.ip -%]
+[% if.ip %] [% hostname %].[% domain %] [% hostname %]
+[% END -%]
+[% END -%]
+
+# The following lines are desirable for IPv6 capable hosts
+::1     ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+[% FOR if IN interfaces -%]
+[% IF if.ip6 -%]
+[% if.ip6 %] [% hostname %].[% domain %] [% hostname %]
+[% END -%]
+[% END -%]

+ 22 - 0
templates/interfaces

@@ -0,0 +1,22 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+[% FOREACH if IN interfaces -%]
+auto [% if.name %]
+[% IF if.ip -%]
+iface [% if.name %] inet static
+  address [% if.ip %]
+  netmask [% if.netmask %]
+  gateway [% if.gateway %]
+[%- END %]
+[% IF if.ip6 -%]
+iface eth1 inet6 static
+  address [% if.ip6 %]
+  netmask [% if.netmask6 %]
+  gateway [% if.gateway6 %]
+[%- END %]
+[%- END %]

+ 1 - 0
templates/mailname

@@ -0,0 +1 @@
+[% hostname %].[% domain %]

+ 41 - 0
templates/main.cf

@@ -0,0 +1,41 @@
+# See /usr/share/postfix/main.cf.dist for a commented, more complete version
+
+
+# Debian specific:  Specifying a file name will cause the first
+# line of that file to be used as the name.  The Debian default
+# is /etc/mailname.
+#myorigin = /etc/mailname
+
+smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
+biff = no
+
+# appending .domain is the MUA's job.
+append_dot_mydomain = no
+
+# Uncomment the next line to generate "delayed mail" warnings
+#delay_warning_time = 4h
+
+readme_directory = no
+
+# TLS parameters
+smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
+smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
+smtpd_use_tls=yes
+smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
+smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
+
+# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
+# information on enabling SSL in the smtp client.
+
+myhostname = [% hostname %].[% domain %]
+alias_maps = hash:/etc/aliases
+alias_database = hash:/etc/aliases
+myorigin = /etc/mailname
+smtp_generic_maps = regexp:/etc/postfix/maps.cf
+mydestination = [% hostname %].[% domain %], localhost.[% domain %], localhost
+relayhost = [% relayhost %]
+mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
+mailbox_command = procmail -a "$EXTENSION"
+mailbox_size_limit = 0
+recipient_delimiter = +
+inet_interfaces = loopback-only

+ 1 - 0
templates/maps.cf

@@ -0,0 +1 @@
+/^(.*)@[% hostname %].[% domain %]/         ${1}-[% hostname %]@oxynux.org