vipw
groupadd -g 500 USER
useradd -s /bin/sh -g USER -G wheel -m -d /home/USER -u 500 USER
passwd USER
visudo
# uncomment first line that starts with "#%wheel"
vi /etc/rc.conf
ntpdate_flags="swisstime.ethz.ch"
wsmoused_flags=""
pf=YES
mkdir /data
echo "/dev/wd0h /data ffs rw,nodev,nosuid 1 2" >> /etc/fstab
vi /etc/rc.shutdown
powerdown=YES
mount -t cd9660 /dev/cd0a /mnt
cd /usr/src
tar xvzfp /mnt/3.3/src.tar.gz
tar xvzfp /mnt/3.3/sys.tar.gz
cd /usr
tar xvzfp /mnt/3.3/ports.tar.gz
umount /mnt
export CVS_RSH=/usr/bin/ssh
cd /usr/src
cvs -d anoncvs@anoncvs.ca.openbsd.org:/cvs -q update -dP -rOPENBSD_3_3 .
cd /usr/ports
cvs -d anoncvs@anoncvs.ca.openbsd.org:/cvs -q update -dP -rOPENBSD_3_3 .
mkdir /data/obj
mkdir -p /data/ports/obj
mkdir /data/ports/distfiles
mkdir /data/ports/packages
chgrp -R wsrc /data/ports /data/obj
rmdir /usr/obj
ln -s /data/obj /usr/obj
cat > /etc/mk.conf << EOF
WRKOBJDIR=/data/ports/obj
DISTDIR=/data/ports/distfiles
PACKAGES=/data/ports/packages
EOF
cd /usr/src
find . -type l -name obj |xargs rm
make cleandir
rm -rf /usr/obj/*
make obj
cd /usr/src/etc && make DESTDIR=/ distrib-dirs
mkdir /data/kernel
cd /data/kernel
cp /usr/src/sys/arch/i386/conf/GENERIC GENERIC_RAID
vi GENERIC_RAID
option RAID_AUTOCONFIG
pseudo-device raid 4 # RAIDframe disk driver
config -s /usr/src/sys -b . GENERIC_RAID
make clean && make
cd /data/kernel
mv /bsd /bsd.old
cp bsd /
reboot
cd /usr/src
make build
cd /usr/ports/sysutils/mergemaster/
make install
make clean
/usr/local/sbin/mergemaster -v
cd /usr/ports/shells/bash2
FLAVOR=static make install
FLAVOR=static make clean
echo "/usr/local/bin/bash" >> /etc/shells
cd /usr/ports/devel/autoconf/
make install
make clean
cd /usr/ports/devel/automake/
make install
make clean
cd /usr/ports/devel/libtool/
make install
make clean
cd /usr/ports/net/ncftp
make install
make clean
cd /usr/ports/net/ntp
make install
make clean
cd /usr/ports/net/wget
make install
make clean
cd /usr/ports/devel/gmake/
make clean
cd /usr/ports/devel/gettext/
make clean
cd /usr/ports/converters/libiconv/
make clean
cd /usr/ports/editors/xemacs21
FLAVOR=no_x11 make install
FLAVOR=no_x11 make clean
cd /usr/ports/devel/metaauto/
make clean
cd /usr/ports/editors/xemacs21-sumo
make install
make clean
cd /usr/ports/archivers/bzip2/
make clean
cd /usr/ports/net/ucd-snmp
make install
make clean
mkdir /usr/local/etc
cp /usr/local/share/examples/ucd-snmp/EXAMPLE.conf /etc/snmpd.conf
ln -s /etc /usr/local/etc
vi /etc/rc.local
# uncomment the 'snmp' lines
cd /usr/ports/databases/openldap/
SUBPACKAGE=-server make install
SUBPACKAGE=-server make clean
groupadd -g 55 ldap
useradd -s /sbin/nologin -c "LDAP Server" -g ldap -m -d /var/ldap -u 55
ldap
rm /var/ldap/.*
vi /etc/openldap/slapd.conf
# create pid file
pidfile /var/ldap/slapd.pid
# fix TLSCertificateFile and TLSCertificateKeyFile
# fix directory line:
directory /var/ldap
# remove line "replogfile"
# remove lines starting with "replica"
# add update lines:
updatedn
"cn=replicator,ou=Accounts,dc=CHANGE,dc=ME"
updateref "ldaps://ldap-master:636/"
touch /var/log/ldap.log
echo "/var/log/ldap.log root:wheel 640 7 250 * Z" >> /etc/newsyslog.conf
vi /etc/syslog.conf
local4.* /var/log/ldap.log
kill -HUP `cat /var/run/syslog.pid`
/etc/init.d/ldap stop
slapcat -l ldap.ldif
/usr/local/sbin/slapadd -v -c -f /etc/openldap/slapd.conf -b "dc=CHANGE,dc=ME" -l ldap.ldif
chown ldap.ldap /var/ldap/*
/usr/local/libexec/slapd -u ldap -h "ldap://localhost:389/ ldaps://ldap-slave:636/"
/etc/init.d/ldap start
vi /etc/rc.local
# OpenLDAP Daemon
if [ -x /usr/local/libexec/slapd ]; then
echo -n ' slapd'; /usr/local/libexec/slapd -u ldap -h
"ldap://localhost:389/ ldap://ldap-slave:389/ ldaps://ldap-slave:636/"
fi
vi /etc/rc.shutdown
# stop OpenLDAP slapd
if [ -r /var/ldap/slapd.pid ]; then
kill `cat /var/ldap/slapd.pid | head -1`
fi
cd /usr/ports/sysutils/login_ldap
make install
./w-login_ldap-3.3/fake-i386/usr/local/bin/enable-login_ldap
make clean
chmod u+s /usr/libexec/auth/login_-lda
vi /etc/login.conf
#
# LDAP Specs
#
ldap:\
:requirehome@:\
:auth=-ldap:\
:x-ldap-server=ldap-slave:\
:x-ldap-server-alt=ldap-master:\
:x-ldap-port=636:\
:x-ldap-basedn=ou=Users,dc=CHANGE,dc=ME:\
:x-ldap-binddn=cn=lookup,ou=Accounts,dc=CHANGE,dc=ME:\
:x-ldap-bindpw=YOUR_SECRET:\
:x-ldap-uscope=subtree:\
:x-ldap-noreferrals:\
:x-ldap-filter=(&(objectClass=posixAccount)(uid=%u)):\
:x-ldap-gscope=base:\
:x-ldap-groupdn=cn=unixAccount,ou=THE_MACHINE,ou=Roles,dc=CHANGE,dc=ME:\
:x-ldap-groupfilter=(|(&(objectClass=posixGroup)(memberUid=%u))(&(objectClass=groupOfUniqueNames)(uniqueMember=%d))):
vipw
# for each user you want LDAP access, insert "ldap" between the colons in '::0:0:'
cd /usr/ports/security/cyrus-sasl2
/code>
grep DISTNAME Makefile
DISTNAME= cyrus-sasl-2.1.11
wget http://www.abstrakt.ch/unix/cyrus-sasl-2.1.11-ldap-patch
md5 cyrus-sasl-2.1.11-ldap-patch
MD5 (cyrus-sasl-2.1.11-ldap-patch) = e1ef9066bc780e4d6431ce01a6fd7f76
mv cyrus-sasl-2.1.11-ldap-patch patches/patch-ldap
vi Makefile
DISTNAME= cyrus-sasl-2.1.13
cat > distinfo <<EOF
MD5 (cyrus-sasl-2.1.13.tar.gz) = 1114d59d970791932e96de8557472672
RMD160 (cyrus-sasl-2.1.13.tar.gz) = 70e43b6aeb62ba172526ec02fb2309f7f6e25bc4
SHA1 (cyrus-sasl-2.1.13.tar.gz) = fccd1650b5b540380c4c5f87c6de76633a30bdca
EOF
CONFIGURE_ARGS=--with-ldap=/usr/local make
make install
make clean
ln -s /usr/local/lib/libsasl2.so.2.11 /usr/lib/
cat > /etc/saslauthd.conf << EOF
ldap_servers: ldap://localhost/
ldap_bind_dn: cn=imap,ou=Accounts,dc=CHANGE,dc=ME
ldap_bind_pw: secret
ldap_scope: sub
ldap_search_base: ou=Accounts,dc=CHANGE,dc=ME
ldap_auth_method: bind
#ldap_filter: (&(uid=%u)(|(role=mailUser)(role=mailAdmin)))
ldap_group_dn: cn=%s,ou=MAILROLE,ou=Roles,dc=CHANGE,dc=ME
EOF
vi /etc/rc.local
# Cyrus SASL Authentication Daemon
if [ -x /usr/local/sbin/saslauthd ]; then
echo -n ' saslauthd'; /usr/local/sbin/saslauthd -a ldap
fi
vi /etc/rc.shutdown
# Stop Cyrus SASL Authentication Daemon
if [ -r /var/sasl2/mux.pid ]; then
kill `cat /var/sasl2/mux.pid | head -1`
fi
cd /tmp
wget http://www.sleepycat.com/update/snapshot/db-4.1.25.tar.gz
wget http://www.sleepycat.com/update/4.1.25/patch.4.1.25.1
tar xvzf db-4.1.25.tar.gz
cd db-4.1.25
patch < ../patch.4.1.25.1
cd build_unix
../dist/configure \
--enable-compat185 \
--enable-dump185 \
--enable-cxx
make
sudo make install
cd /tmp
ncftpget ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-imapd-2.1.13.tar.gz
tar xvzf cyrus-imapd-2.1.13.tar.gz
cd cyrus-imapd-2.1.13/makedepend
./configure
make
sudo cp makedepend /usr/local/bin/
cd ..
./configure \
--with-openssl=/usr \
--with-cyrus-user=cyrus \
--with-cyrus-group=mail \
--with-auth=unix \
--with-notify=no \
--with-idle=idled \
--with-dbdir=/usr/local/BerkeleyDB.4.1 \
--with-sasl=/usr/local \
--without-ucdsnmp \
--disable-gssapi
make depend
make all CFLAGS=-O2
su
make install
groupadd -g 12 mail
useradd -s /bin/sh -g mail -G daemon -d /usr/cyrus -u 8 cyrus
touch /var/log/imapd
echo "/var/log/imapd root:wheel 640 7 250 * Z" >> /etc/newsyslog.conf
vi /etc/syslog.conf
# Cyrus IMAP
local6.debug /var/log/imapd
kill -HUP `cat /var/run/syslog.pid`
cat > /etc/imapd.conf << EOF
configdirectory: /data/cyrus/imap
partition-default: /data/cyrus/partition
admins: mailadm
sasl_pwcheck_method: saslauthd
sendmail: /usr/sbin/sendmail
sievedir: /data/cyrus/sieve
# --- uncomment the following lines if you have a valid certificate for
the mail server
#tls_ca_file: /data/certs/cacert.pem
#tls_cert_file: /data/certs/mail.CHANGE.ME.cert.pem
#tls_key_file: /data/certs/certs/mail.CHANGE.ME.key.pem
EOF
mkdir -p /data/cyrus/partition /data/cyrus/imap
/data/cyrus/sieve
chown -R cyrus.mail /data/cyrus/*
chmod 750 /data/cyrus/imap
chmod 750 /data/cyrus/sieve
ln -s /data/cyrus/imap /var/imap
ln -s /data/cyrus/sieve /var/sieve
ln -s /data/cyrus/partition /var/spool/imap
su cyrus
tools/mkimap
exit
cp master/conf/prefork.conf /etc/cyrus.conf
cat >> /etc/services << EOF
#
# Cyrus IMAP additional services
#
imsp
406/tcp
acap
674/tcp
sieve
2000/tcp
lmtp
2003/tcp
fud
4201/udp
EOF
vi /etc/rc.local
# Cyrus IMAP Master Daemon
if [ -x /usr/cyrus/bin/master ]; then
echo -n ' master'; /usr/cyrus/bin/master &
fi
vi /etc/rc.shutdown
# Stop Cyrus IMAP Master Daemon
PID=`ps -axuwww | grep master | grep -v grep | awk '{print $2}'`
if [ "X$PID" != "X" ]; then
kill $PID
fi
/usr/cyrus/bin/master &
cyradm --user mailadm --auth login localhost
IMAP Password: <enter your mailadm password here>
localhost> cm user.root
localhost> exit
exit
cd /usr/src/gnu/usr.sbin/sendmail
make clean
cat >> Makefile.inc << EOF
.if defined(WANT_SASL)
ENVDEF+= -DSASL -D_FFR_UNSAFE_SASL
LDADD+= -lsasl2 -ldb
CFLAGS+= -I/usr/local/include -I/usr/local/include/sasl
LDFLAGS+=-L/usr/local/lib -L/usr/local/BerkeleyDB.4.1/lib
.endif
EOF
echo >> /etc/mk.conf "WANT_SASL=1"
echo >> /etc/mk.conf "WANT_LIBMILTER=1"
cd libmilter
make
cd ..
make
make install
make clean
echo "pwcheck_method: saslauthd" >
/usr/local/lib/sasl2/Sendmail.conf
touch /etc/kerberosIV/srvtab
cd /usr/ports/security/uvscan
vi Makefile
VERSION= 4.24.0
DISTNAME= vlnx424e
MASTER_SITES= http://download.nai.com/products/evaluation/virusscan/english/cmdline/linux/version_4.24/intel/
.for file in unxadmin.pdf e4240upg.pdf license.txt readme.txt
echo > distinfo "SHA1 (vlnx424e.tar.Z) = ab60091a790e5ac2f7c343158a2b599894f61c2e"
vi pkg/PLIST
share/doc/uvscan/unxadmin.pdf
share/doc/uvscan/e4240upg.pdf
make install
make clean
cd ../uvscan_dat
make clean
cd /usr/ports/emulators/redhat/
make clean
mkdir /data/scripts
vi /data/scripts/update_virus_dat.sh
#!/bin/sh
echo "===================================================="
echo -n "Retrieving newest virus DAT file..."
cd /usr/local/libexec/uvscan/dat
/usr/local/bin/ncftpget ftp://ftpeur.nai.com/pub/datfiles/english/dat-*.tar > /dev/null 2> /dev/null
echo "done"
cd /usr/local/libexec/uvscan
DAT_FILE=`find /usr/local/libexec/uvscan/dat -type f -cmin -60`
if [ "X$DAT_FILE" == "X" ]; then
echo "No new virus DAT file to install. Listing DAT files:"
echo "===================================================="
ls -al dat
echo "===================================================="
exit
fi
echo "===================================================="
echo "Extracting virus DAT file '$DAT_FILE'..."
tar xvf $DAT_FILE
# removing trash
rm -fr *.ini *.txt file_id.diz packing.lst validate.exe
chown root.bin *
echo "===================================================="
echo "Newest virus DAT file installed."
echo "===================================================="
chmod 755 /data/scripts/update_virus_dat.sh
/data/scripts/update_virus_dat.sh
====================================================
Retrieving newest virus DAT file...done
====================================================
Extracting virus DAT file '/usr/local/libexec/uvscan/dat/dat-4262.tar'...
clean.dat
file_id.diz
names.dat
packing.lst
pkgdesc.ini
reseller.txt
scan.dat
validate.exe
readme.txt
internet.dat
====================================================
Newest virus DAT file installed.
====================================================
mkdir /usr/local/libexec/uvscan/dat
crontab -e
#
# update virus DAT every day @ 6
0 6 * * * /data/scripts/update_virus_dat.sh 2>&1 | mail -s "`/bin/hostname` daily virus update" root
# ---- archivers
cd /usr/ports/archivers/unzip
make install && make clean
cd ../bzip2
# is already installed make install && make clean
cd ../lha
make install && make clean
cd ../unarj
make install && make clean
cd ../unrar
make install && make clean
cd ../zoo
make install && make clean
# ---- perl packages ports
cd ../p5-Compress-Zlib
make install && make clean
cd ../p5-Archive-Tar
make install && make clean
cd ../p5-Archive-Zip
make install && make clean
cd /usr/ports/converters/p5-Convert-TNEF
make install && make clean
cd /usr/ports/converters/p5-Convert-UUlib
make install && make clean
cd /usr/ports/devel/p5-Net-Server
make install && make clean
cd /usr/ports/mail/p5-SMTP-Server
make install && make clean
cd /usr/ports/security/p5-MD5
make install && make clean
perl -MCPAN -e shell
# ---- you might have to answer a couple of questions -- answer them ;-)
install Bundle::libnet
install Bundle::LWP
# ---- you don't want to install lwp-request, lwp-mirror, lwp-rget, lwp-download
install Bundle::CPAN
install Digest::HMAC
install Digest::MD5
install Digest::Nilsimsa
install Digest::SHA1
install IO::Stringy
install MIME::Base64
install MIME::Parser
install Net::SMTP
install Net::Ping
install Net::DNS
install Time::HiRes
install URI
install Mail::Internet
install Mail::SpamAssassin
vipw
_amavisd:*:100:100::0:0:Amavis Mail Scanner Daemon:/var/amavis:/sbin/nologin
spam:*:101:101::0:0:Spam Bayes Learner:/var/empty:/sbin/nologin
notspam:*:102:102::0:0:Not Spam Bayes Learner:/var/empty:/sbin/nologin
vi /etc/group
_amavisd:*:100:
spam:*:101:
notspam:*:102:
mkdir -p /var/amavis
chown _amavisd._amavisd /var/amavis
chmod 750 /var/amavis
cd /var/amavis
mkdir .spamassassin
touch .spamassassin/user_prefs
chown -R _amavisd._amavisd .spamassassin
cd /tmp
wget http://switch.dl.sourceforge.net/sourceforge/razor/razor-agents-2.22.tar.gz
tar xvzf razor-agents-2.22.tar.gz
cd razor-agents-2.22
perl Makefile.PL
make
make test
make install
razor-client
razor-admin -create
razor-admin -register -user postmaster@CHANGE.ME
cp -r /root/.razor /var/amavis
chown -R _amavisd._amavisd /var/amavis/.razor
cd /usr/local/libdata/perl5/site_perl/i386-openbsd/Razor2/Client
wget http://www.ijs.si/software/amavisd/Razor2.patch
wget http://www.ijs.si/software/amavisd/Razor2.patch2
patch < Razor2.patch
patch < Razor2.patch2
vi /var/amavis/.razor/razor-agent.conf
debuglevel = 0
cd /tmp
wget http://www.dcc-servers.net/dcc/source/dcc-dccd.tar.Z
tar xvzf dcc-dccd.tar.Z
cd cd dcc-dccd-1.1.36/
./configure
make
make install
/usr/local/bin/cdcc 'info'
# 05/11/03 11:14:08 CEST /var/dcc/map
# Will re-resolve names after 13:12:36
# 169.67 ms chosen delay 9 total addresses 8 working
IPv6 off
dcc.dcc-servers.net,- RTT+0 ms anon
# * 137.118.60.88,- dccpub1.neonova.net neonova server-ID 1127
# 100% of 1 requests ok 169.67+0 ms RTT 51 ms queue wait
# 153.19.44.233,- coral.ely.pg.gda.pl WEiAPG server-ID 1072
# 100% of 1 requests ok 321.18+0 ms RTT 246 ms queue wait
[...more lines like these...]
mkdir -p /var/amavis/var /var/amavis/usr/bin /var/amavis/usr/libexec /var/amavis/var/dcc
mkdir -p /var/amavis/usr/lib /var/amavis/bin
cp -r /var/dcc /var/amavis/var/
cp /usr/local/bin/dccproc /var/amavis/usr/bin
cp /usr/libexec/ld.so /var/amavis/usr/libexec
cp /usr/lib/libc.so.29.0 /var/amavis/usr/lib
cp /usr/lib/libm.so.1.0 /var/amavis/usr/lib
)chown -R _amavisd._amavisd /var/amavis/var/dcc
cp /bin/sh /var/amavis/bin
cd /tmp
wget http://www.ijs.si/software/amavisd/amavisd-new-20030314-p2.tar.gz
md5 amavisd-new-20030314-p2.tar.gz
MD5 (amavisd-new-20030314-p2.tar.gz) = a6c5c52237e3bc352bc2db07fface5af
tar xvzf amavisd-new-20030314-p2.tar.gz
cd amavisd-new-20030314
cp amavisd /usr/local/sbin/
chown root.wheel /usr/local/sbin/amavisd
chmod 550 /usr/local/sbin/amavisd
cp amavisd.conf /etc
chown root.wheel /etc/amavisd.conf
chmod 644 /etc/amavisd.conf
touch /var/amavis/amavis.log
chown _amavisd._amavisd /var/amavis/amavis.log
vi /etc/amavisd.conf
#
# Section I
#
$MYHOME = '/var/amavis';
$mydomain = "CHANGE.ME";
$daemon_user = '_amavisd';
$daemon_group = '_amavisd';
$TEMPBASE = "$MYHOME/tmp";
$helpers_home = $MYHOME;
$daemon_chroot_dir = $MYHOME;
$pid_file = "$MYHOME/amavisd.pid";
$lock_file = "$MYHOME/amavisd.lock";
# SENDMAIL MILTER, using amavis-milter.c helper program:
$forward_method = undef;
$notify_method = 'pipe:flags=q argv=/usr/sbin/sendmail -Ac -i -odd -f ${sender} -- ${recipient}';
read_hash(\%local_domains, '/var/amavis/local_domains');
#
# Section II - MTA specific (defaults should be ok)
#
$relayhost_is_client = 1;
$inet_socket_bind = '127.0.0.1';
#
# Section III - Logging
#
$log_level = 5; # NOTE: change this to something more reasonable after testing
#
# Section IV - Notifications/DSN, BOUNCE/REJECT/DROP/PASS destiny, quarantine
#
$virus_admin = "virusalert\@$mydomain";
$QUARANTINEDIR = '$MYHOME/virusmails';
#
# Section V - Per-recipient and per-sender handling, whitelisting, etc.
#
# -- SQL is in this section
#
# Section VII - External programs, virus scanners
#
# SpamAssassin settings
# $sa_local_tests_only = 1;
$sa_spam_subject_tag = '***SPAM*** ';
cd helper-progs
./configure --with-milterinc=/usr/src/gnu/usr.sbin/sendmail/include --with-milterlib=/usr/lib
make
make install