CONF_WORLD='
CC=clang
CXX=clang++
CPP=clang-cpp
# This setting to build world without -Werror:
NO_WERROR=
# This setting to build kernel without -Werror:
WERROR=
# Does not set schg bit on various system files,
# useful for building Jails, has security implications.
NO_FSCHG=
'
NANO_NAME=MS_9.2.CLANG
# 8GB
NANO_MEDIASIZE=15665140
NANO_DRIVE=da0
# Size of configuration file system in 512 bytes sectors (204800 = 100MB)
NANO_CONFSIZE=204800
# Size of the /etc ramdisk in 512 bytes sectors (204800 = 100MB)
NANO_RAM_ETCSIZE=204800
# Size of the /tmp+/var ramdisk in 512 bytes sectors (204800 = 100MB)
NANO_RAM_TMPVARSIZE=204800
# TRANSCEND TYPICAL FLASH - 15820800 512 byte sectors: 255H 63S/T 984C
NANO_SECTS=63
NANO_HEADS=255
# VGA BOOTLOADER
NANO_BOOTLOADER="boot/boot0"
NANO_KERNEL=GENERIC
# Kernel modules to build; default is none
NANO_MODULES="aac aacraid accf_data accf_dns accf_http acpi ae aesni age agp aha ahci aic7xxx aio alc ale alq amdsbwd amdtemp amr an aout arcmsr asmc ata ath ath_pci bce bfe bge bridgestp bwi bwn bxe cam cardbus cas cbb cc cd9660 cd9660_iconv ciss cmx coda coda5 coretemp cpuctl cpufreq crypto cryptodev ctl cxgb cxgbe cyclic dc dcons dcons_crom de dpms drm drm2 dtrace dummynet ed em en esp et exca ext2fs fatm fdc fdescfs filemon firewire firmware fxp gem geom hatm hifn hme hpt27xx hptiop hptmv hptnr hptrr hwpmc i2c ichwd ida if_bridge if_carp if_disc if_edsc if_ef if_epair if_faith if_gif if_gre if_lagg if_ndis if_stf if_tap if_tun if_vlan igb iir io ip6_mroute_mod ip_mroute_mod ipdivert ipfilter ipfw ipfw_nat ipmi ips ipw ipwfw isci iscsi isp ispfw iwi iwifw iwn iwnfw ixgb ixgbe jme joy kbdmux kgssapi kgssapi_krb5 khelp krpc ksyms le lge libalias libiconv libmbpool libmchain lindev linprocfs linsysfs linux lmc lpt mac_biba mac_bsdextended mac_ifoff mac_lomac mac_mls mac_none mac_partition mac_portacl mac_seeotheruids mac_stub mac_test malo mcd md mem mfi mii mlx mly mmc mmcsd mps mpt mqueue msdosfs msdosfs_iconv msk mvs mwl mwlfw mxge my ndis netgraph nfe nfs_common nfscl nfsclient nfscommon nfsd nfslock nfslockd nfsserver nfssvc nge nmdm ntfs ntfs_iconv nullfs nvd nve nvme nvram nxge oce opensolaris padlock patm pccard pcn pf pflog pfsync plip portalfs ppbus ppc ppi pps procfs pseudofs pty puc qlxgb ral ralfw random rc4 rdma re reiserfs rl runfw s3 safe scc scd scsi_low sdhci sem send sf sfxge sge siba_bwn siftr siis sis sk smbfs sn snp sound speaker splash sppp ste stge sym syscons sysvipc ti tl tmpfs toecore tpm trm twa twe tws tx txp uart ubsec udf udf_iconv ufs unionfs usb utopia vesa vge viawd virtio vkbd vpo vr vte vx vxge wb wbwd wi wlan wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt wlan_tkip wlan_wep wlan_xauth wpi wpifw x86bios xfs xl zfs zlib"
# -----------------------------------------------------------------------------
# ADD PORTS
# -----------------------------------------------------------------------------
add_port () {
port=`echo $1 | sed -e 's/\//_/'`
eval "
add_port_${port} () {
mkdir -p \${NANO_WORLDDIR}/usr/ports
mount -t unionfs -o noatime /usr/src \
\${NANO_WORLDDIR}/usr/src
mount -t unionfs -o noatime /usr/ports \
\${NANO_WORLDDIR}/usr/ports
mkdir -p \${NANO_WORLDDIR}/dev
mount -t devfs devfs \${NANO_WORLDDIR}/dev
mkdir -p \${NANO_WORLDDIR}/usr/pobj
mkdir -p \${NANO_WORLDDIR}/usr/workdir
cp /etc/resolv.conf \${NANO_WORLDDIR}/etc/resolv.conf
chroot \${NANO_WORLDDIR} /bin/sh -exc \
'make WRKDIRPREFIX=/usr/workdir -C /usr/ports/$1 \
install BATCH=yes $2'
rm \${NANO_WORLDDIR}/etc/resolv.conf
rm -rf \${NANO_WORLDDIR}/usr/obj
rm -rf \${NANO_WORLDDIR}/usr/pobj
rm -rf \${NANO_WORLDDIR}/usr/workdir
umount \${NANO_WORLDDIR}/dev
umount \${NANO_WORLDDIR}/usr/ports
umount \${NANO_WORLDDIR}/usr/src
rmdir \${NANO_WORLDDIR}/usr/ports
}
customize_cmd add_port_${port}
"
}
# -----------------------------------------------------------------------------
# PORTS
# -----------------------------------------------------------------------------
# Add net-snmp (An extendable SNMP implementation)
add_port "net-mgmt/net-snmp"
# Add sstmp, a simple MTA to get mail off the system
add_port "mail/ssmtp"
# Add screen (A multi-screen window manager)
add_port "sysutils/screen"
## Add bash (The GNU Project's Bourne Again SHell)
add_port "shells/bash"
# Add openssh-portable (The portable version of OpenBSD's OpenSSH)
add_port "security/openssh-portable"
## Add mtr (Traceroute and ping in a single graphical network diagnostic tool)
add_port "net/mtr-nox11"
## Add arping (ARP level "ping" utility)
add_port "net/arping"
## Add dmidecode (A tool for dumping DMI (SMBIOS) contents in human-readable format)
add_port "sysutils/dmidecode"
# Add ipmitool (CLI to manage IPMI systems)
#add_port "sysutils/ipmitool"
# Add sudo (Allow others to run commands as root)
add_port "security/sudo"
# Add trafshow (Full screen visualization of network traffic)
add_port "net/trafshow"
# Add wget (Retrieve files from the Net via HTTP(S) and FTP)
add_port "ftp/wget"
# Add vim-lite (Vi "workalike", with many additional features (Lite package))
add_port "editors/vim-lite"
# Add nano (Nano's ANOther editor, an enhanced free Pico clone)
add_port "editors/nano"
# Add iperf (A tool to measure maximum TCP and UDP bandwidth)
add_port "benchmarks/iperf"
# Add links (Lynx-like text WWW browser)
add_port "www/links"
# Add bind-tools (The command line tools from BIND: dig, host, and nslookup)
add_port "dns/bind-tools"
# Add dnstop (Captures and analyzes DNS traffic)
add_port "dns/dnstop"
# Add ezjail (A framework to easily create, manipulate and run FreeBSD jails)
add_port "sysutils/ezjail"
# Add pv (A pipe throughput monitor)
add_port "sysutils/pv"
# Add smartmontools (S.M.A.R.T. disk monitoring tools)
add_port "sysutils/smartmontools"
# Add zfs-stats (Display human-readable ZFS statistics)
add_port "sysutils/zfs-stats"
# Add mpd (Multi-link PPP daemon based on netgraph(4))
add_port "net/mpd5"
# Add nrpe (Nagios Remote Plugin Executor)
add_port "net-mgmt/nrpe"
# Add fail2ban (Scans log files and bans IP that makes too many password failures)
add_port "security/py-fail2ban"
# Add openntpd (OpenBSD's Network Time Protocol daemon)
add_port "net/openntpd"
# Add subversion (Version control system)
add_port "devel/subversion"
# -----------------------------------------------------------------------------
# CUSTOMIZE
# -----------------------------------------------------------------------------
my_custom () {
#------ Relocate same folders
# Relocate /root/.ssh to /etc/dot.root.ssh
# This permit to save ssh keys (only /etc and /usr/local/etc are saved)
mkdir -p ${NANO_WORLDDIR}/etc/dot.ssh.root
ln -s ../etc/dot.ssh.root ${NANO_WORLDDIR}/root/.ssh
# Relocate /var/cron to /etc/cron
# This permit to save crontab (only /etc and /usr/local/etc are saved)
mkdir -p ${NANO_WORLDDIR}/etc/cron
rm -rf ${NANO_WORLDDIR}/var/cron
ln -s ../etc/cron ${NANO_WORLDDIR}/var/cron
# Relocate /home and /usr/home to /etc/home (only /etc and /usr/local/etc are saved)
chroot ${NANO_WORLDDIR} /bin/sh -exc \
'mkdir -p /etc/home && ln -s /etc/home /home && ln -s /etc/home /usr/home'
# Relocate /boot/zfs to /etc/zfs
mkdir -p ${NANO_WORLDDIR}/etc/zfs
rmdir ${NANO_WORLDDIR}/boot/zfs
ln -s ../etc/zfs ${NANO_WORLDDIR}/boot/zfs
#------ Copy config to image
# Add loader.conf
cp ${NANO_TOOLS}/Customize/Files/boot/loader.conf.MS ${NANO_WORLDDIR}/boot/loader.conf
# Add start_if.bce0
cp ${NANO_TOOLS}/Customize/Files/etc/start_if.bce0.MS ${NANO_WORLDDIR}/etc/start_if.bce0
# Add rc.conf
cp ${NANO_TOOLS}/Customize/Files/etc/rc.conf.MS ${NANO_WORLDDIR}/etc/rc.conf
# Add sysctl.conf
cp ${NANO_TOOLS}/Customize/Files/etc/sysctl.conf.MS ${NANO_WORLDDIR}/etc/sysctl.conf
# Add resolv.conf
cp ${NANO_TOOLS}/Customize/Files/etc/resolv.conf.MS ${NANO_WORLDDIR}/etc/resolv.conf
# Add ipfw.rules
cp ${NANO_TOOLS}/Customize/Files/etc/ipfw.rules.MS ${NANO_WORLDDIR}/etc/ipfw.rules
# Add Bash profile
cp ${NANO_TOOLS}/Customize/Files/etc/profile ${NANO_WORLDDIR}/etc/profile
# Add motd
cp ${NANO_TOOLS}/Customize/Files/etc/motd.MS ${NANO_WORLDDIR}/etc/motd
# Add new mailer.conf (replace Sendmail with sSMTP)
cp ${NANO_TOOLS}/Customize/Files/etc/mail/mailer.conf ${NANO_WORLDDIR}/etc/mail/mailer.conf
# Add ssmtp.config (replace Sendmail with sSMTP)
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/ssmtp/ssmtp.conf.MS ${NANO_WORLDDIR}/usr/local/etc/ssmtp/
# Add net-snmpd configuration - snmpd.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/snmpd.conf.MS ${NANO_WORLDDIR}/usr/local/etc/snmpd.conf
# Add ezjail.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/ezjail.conf.MS ${NANO_WORLDDIR}/usr/local/etc/ezjail.conf
# Add smartd.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/smartd.conf ${NANO_WORLDDIR}/usr/local/etc/smartd.conf
# Add nrpe2
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/nrpe.cfg.MS ${NANO_WORLDDIR}/usr/local/etc/nrpe.cfg
# Add inetd (tftp)
cp ${NANO_TOOLS}/Customize/Files/etc/inetd.conf.MS ${NANO_WORLDDIR}/etc/inetd.conf
# Add openntpd
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/ntpd.conf.MS ${NANO_WORLDDIR}/usr/local/etc/ntpd.conf
# Add fail2ban
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/fail2ban/jail.conf.MS ${NANO_WORLDDIR}/usr/local/etc/fail2ban/jail.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/fail2ban/filter.d/apache-access.conf ${NANO_WORLDDIR}/usr/local/etc/fail2ban/filter.d/apache-access.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/fail2ban/filter.d/apache-error.conf ${NANO_WORLDDIR}/usr/local/etc/fail2ban/filter.d/apache-error.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/fail2ban/action.d/bsd-ipfw.conf ${NANO_WORLDDIR}/usr/local/etc/fail2ban/action.d/bsd-ipfw.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/fail2ban/filter.d/roundcube-auth.conf ${NANO_WORLDDIR}/usr/local/etc/fail2ban/filter.d/roundcube-auth.conf
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/fail2ban/filter.d/sshd.conf ${NANO_WORLDDIR}/usr/local/etc/fail2ban/filter.d/sshd.conf
#------ Copy jails configuration
# FLAVOURS
cp ${NANO_TOOLS}/Customize/Files/usr/jails/flavours/own.MS.tar.gz ${NANO_WORLDDIR}/root/own.tar.gz
# PRO-VOIP JAIL
cp ${NANO_TOOLS}/Customize/Files/usr/local/etc/ezjail/pro-voip.MS ${NANO_WORLDDIR}/usr/local/etc/ezjail/pro-voip
cp ${NANO_TOOLS}/Customize/Files/etc/fstab.pro-voip.MS ${NANO_WORLDDIR}/etc/fstab.pro-voip
#------ Copy utils
# Add util cisco like save configuration
mkdir -p ${NANO_WORLDDIR}/usr/local/sbin
cp ${NANO_TOOLS}/Customize/Files/usr/local/sbin/wr ${NANO_WORLDDIR}/usr/local/sbin/
# Add scripts
cp ${NANO_TOOLS}/Customize/Files/root/jail_raw.sh ${NANO_WORLDDIR}/usr/local/sbin/jail_raw.sh
cp ${NANO_TOOLS}/Customize/Files/root/ufs_create.sh ${NANO_WORLDDIR}/usr/local/sbin/ufs_create.sh
cp ${NANO_TOOLS}/Customize/Files/root/ufs_destroy.sh ${NANO_WORLDDIR}/usr/local/sbin/ufs_destroy.sh
cp ${NANO_TOOLS}/Customize/Files/root/ufs_mount.sh ${NANO_WORLDDIR}/usr/local/sbin/ufs_mount.sh
cp ${NANO_TOOLS}/Customize/Files/root/ufs_umount.sh ${NANO_WORLDDIR}/usr/local/sbin/ufs_umount.sh
cp ${NANO_TOOLS}/Customize/Files/root/zfs_create.sh ${NANO_WORLDDIR}/usr/local/sbin/zfs_create.sh
cp ${NANO_TOOLS}/Customize/Files/root/zfs_destroy.sh ${NANO_WORLDDIR}/usr/local/sbin/zfs_destroy.sh
}
my_late_customize () {
# Some extra dirs we need
mkdir -p ${NANO_WORLDDIR}/tank
mkdir -p ${NANO_WORLDDIR}/usr/src
mkdir -p ${NANO_WORLDDIR}/usr/obj
mkdir -p ${NANO_WORLDDIR}/usr/sup
mkdir -p ${NANO_WORLDDIR}/usr/ports
mkdir -p ${NANO_WORLDDIR}/usr/jails
}
customize_cmd my_custom
late_customize_cmd my_late_customize