Install NetBSD-6.1.1 CD. #rm -rf /usr/share/man/cat?/* #rm -rf /usr/X11R* cd /etc cp hosts hosts.org cp printcap printcap.org cp inetd.conf inetd.conf.org cp rc.conf rc.conf.org cp shells shells.org cp group group.org cp sysctl.conf sysctl.conf.org mkdir /usr/home useradd -m -s /bin/csh -d /usr/home/USERNAME -c USERNAME USERNAME #Add USERNAME to wheel in /etc/group. passwd root passwd USERNAME cd mkdir .org mv .* .org cat<.cshrc set path=(/{usr/pkg/,,usr/}{bin,sbin} /usr/games) set filec set prompt='%m{!} %~ %# ' setenv CFLAGS '-O2 -pipe' setenv PAGER less EOF cd / cat syssrc.tgz|gzip -d|tar -xf- cd /usr/src/sys/arch/i386/conf cp GENERIC_LAPTOP HOSTNAME vi HOSTNAME config HOSTNAME cd ../compile/HOSTNAME make clean depend all|&tee mk01.log mv /netbsd /netbsd.org mv netbsd / shutdown -r now cat</etc/ntpdate #!/bin/sh host=`hostname` echo "To: ${MAILTO:-root}" echo "Subject: $host ntpdate" echo "" echo "/usr/sbin/ntpdate ntp1.plala.or.jp" echo "" /usr/sbin/ntpdate ntp1.plala.or.jp EOF crontab -e #45 3 1 * * /bin/sh /etc/ntpdate 2>&1 | sendmail -t cat<>/etc/hosts 192.168.0.1 HOSTNAME EOF cat<>/etc/rc.conf hostname=HOSTNAME #defaultroute=123.45.67.89 rpcbind=YES mountd=YES nfs_server=YES apmd=YES postfix=NO EOF cat</etc/exports /usr -alldirs -network 192.168.0/24 EOF cat</etc/resolv.conf nameserver 220.220.248.1 nameserver 220.220.248.9 EOF cat<>/etc/sysctl.conf # Obey interface MTUs when calculating MSS net.inet.tcp.mss_ifmtu=1 EOF touch /etc/ipf.conf #perl /usr/share/examples/ipf/mkfilters>/etc/ipf.conf cat</etc/ipnat.conf map pppoe0 192.168.0.0/24 -> 0/32 portmap tcp/udp 44000:49999 mssclamp 1408 map pppoe0 192.168.0.0/24 -> 0/32 mssclamp 1408 #rdr pppoe0 0/0 port WINNYPORT -> 192.168.0.1 port WINNYPORT tcp EOF cat</etc/ifconfig.pppoe0 create ! /sbin/ifconfig NIC up ! /sbin/pppoectl -e NIC $int ! /sbin/pppoectl $int myauthproto=pap myauthname=000XX0000@PROVIDER.or.jp myauthsecret=PASSWORD inet 0.0.0.0 0.0.0.1 netmask 0xffffffff #! /sbin/route add default -iface 0.0.0.1 up EOF chmod go-rwx /etc/ifconfig.pppoe0 cat<>/etc/rc.conf ifwatchd=YES ipfilter=YES ipnat=YES EOF mkdir /etc/ppp cat</etc/ppp/ip-up #! /bin/sh /sbin/route add default $5 EOF cat</etc/ppp/ip-down #! /bin/sh /sbin/route delete default $5 EOF chmod a+x /etc/ppp/ip-up /etc/ppp/up-down #ipfstat -i #ipfstat -o #ipnat -l #ipnat -C #ipnat -f /etc/ipnat.conf cd /usr cat pkgsrc-2013Q2.tar.bz2|gzip -d|tar -xf- cat</etc/mk.conf PKG_DEFAULT_OPTIONS+=-inet6 EOF cd /usr/pkgsrc/shells/tcsh make install package|&tee mk01.log #pkg_add tcsh|&tee tcsh.log #chsh root #chsh USERNAME cd /usr/pkgsrc/seciruty/openssl make install package|&tee mk01.log #pkg_add openssl|&tee openssl.log cd /usr/pkgsrc/meta-pkgs/courier make install package|&tee mk01.log #pkg_add courier|&tee courier.log cd /usr/pkgsrc/lang/tcl-expect make install package|&tee mk01.log #pkg_add tcl-expect|&tee tcl-expect.log cd /usr/pkgsrc/databases/php-pgsql make install package|&tee mk01.log #pkg_add php54-pgsql|&tee php54-pgsql.log cd /usr/pkgsrc/databases/postgresql91 make install package|&tee mk01.log #pkg_add postgresql91|&tee postgresql91.log cd /usr/pkgsrc/www/ap-php make install package|&tee mk01.log #pkg_add ap22-php53|&tee ap22-php53.log cd /usr/pkgsrc/net/samba make install package|&tee mk01.log #pkg_add samba|&tee samba.log cp /usr/pkg/share/examples/rc.d/* /etc/rc.d cat<>/etc/rc.conf apache=YES authdaemond=YES courier=YES courierd=YES courieresmtp=YES courieresmtpmsa=YES courieresmtps=YES courierfilter=YES courierimap=YES courierimaps=YES courierpop=YES courierpops=YES nmbd=YES pgsql=YES #pgsql_flags="-l" samba=YES smbd=YES sqwebmail=YES webmlm=YES winbindd=YES EOF #cat<>/var/cron/crontab/root #@hourly /usr/pkg/etc/courier/sharedindexupdate #@hourly /usr/pkg/etc/courier/cleancache.pl #EOF crontab -e #0 * * * * /usr/pkg/etc/courier/sharedindexupdate #0 * * * * /usr/pkg/etc/courier/cleancache.pl cp /usr/pkg/libexec/courier/webmail/* /usr/pkg/libexec/cgi-bin echo PASSWORD>/usr/pkg/etc/courier/webadmin/password chown courier:mail /usr/pkg/etc/courier/webadmin/password chmod 0400 /usr/pkg/etc/courier/webadmin/password ln -s /usr/pkg/sbin/webmaild.rc /usr/pkg/sbin/webmaild cd /usr/sbin mv sendmail sendmail.org ln -s /usr/pkg/bin/sendmail sendmail vi /usr/pkg/etc/courier/esmtpd.cnf mkesmtpdcert vi /usr/pkg/etc/courier/pop3d.cnf mkpop3dcert vi /usr/pkg/etc/courier/imapd.cnf mkimapdcert vi /usr/pkg/share/courier/imapd.rc #Change the "ulimit -v" to "ulimit -d". vi /usr/pkg/share/courier/imapd-ssl.rc #Change the "ulimit -v" to "ulimit -d". cat<>/usr/pkg/etc/httpd/httpd.conf Include etc/httpd/httpd-ssl.conf Options FollowSymLinks AllowOverride None Order allow,deny Allow from all Alias /sqwebmail/ "/usr/pkg/share/courier/sqwebmail/images/" LoadModule php5_module lib/httpd/mod_php5.so AddHandler application/x-httpd-php .php SetEnv SQWEBMAIL_MAXATTSIZE 16777216 SetEnv SQWEBMAIL_MAXARGSIZE 16777216 EOF #vi /usr/pkg/etc/httpd/httpd-ssl.conf vi /usr/pkg/etc/php.ini #Add "extension=pgsql.so" cd /usr/pkg/etc/httpd openssl genrsa -out server.key 1024 openssl req -new -key server.key -out server.csr openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365 chmod go-rwx server.* cat<>/etc/inetd.conf swat stream tcp nowait.400 root /usr/pkg/sbin/swat swat EOF chmod -R o+rx /usr/pkg/libexec/courier/module/* chmod u+s /usr/pkg/libexec/courier/module/esmtp/courieresmtpd courier-maildirmake ~/Maildir https://mune.plala.jp/cgi-bin/webadmin #Server name:mune.plala.jp #Default domain:mune.plala.jp #Aliases:root->mune,postmaster->mune,webmaster->mune #Whitelist, allow relaying 202.214 & 210.138 #Default smarthost:mmr.plala.or.jp #Install new configuration echo 0>/usr/pkg/etc/courier/sizelimit /etc/rc.d/sqwebmail restart http://mune.plala.jp http://mune.plala.jp:901 #Add user, change passwd. https://mune.plala.jp/cgi-bin/webmail