Editing
Infrastructure Machines
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== build == <pre>partition map: / 58g swap 4g /var 512m /tmp 512m /usr 5.5g 4. edit /etc/make.conf echo "WITHOUT_X11=yes \ KERNCONF=firewall3 \ BOOT_COMCONSOLE_SPEED=115200" >> /etc/make.conf 5. add settings to /boot/loader.conf and /boot.config echo "-Dh" >> /boot.config echo 'console="comconsole,vidconsole" \ boot_multicons="YES" \ boot_serial="YES" \ comconsole_speed="115200"' >> /boot/loader.conf 6. turn off all ttyv's except 0 and 1 in /etc/ttys also turn on ttyd0, change type to vt100: vi /etc/ttys ttyv2 "/usr/libexec/getty Pc" cons25 off secure ttyv3 "/usr/libexec/getty Pc" cons25 off secure ttyv4 "/usr/libexec/getty Pc" cons25 off secure ttyv5 "/usr/libexec/getty Pc" cons25 off secure ttyv6 "/usr/libexec/getty Pc" cons25 off secure ttyv7 "/usr/libexec/getty Pc" cons25 off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. ttyd0 "/usr/libexec/getty std.9600" vt100 on secure kill -1 1 on console server: vi /etc/remote (rename port to jail8 depending on where and which digi plugged into) test serial console 7. populate hosts echo "69.55.230.10 backup2" >> /etc/hosts echo "69.55.230.11 backup1" >> /etc/hosts echo "10.1.2.3 backup3" >> /etc/hosts 8. put key in authorized_keys on backup3 cd ssh-keygen -t dsa -b 1024 (default location, leave password blank) Punch a hole in firewall1 to allow traffic to backup servers @ castle: ipfw add 99 allow ip from 66.181.18.0/27 to 69.55.230.10 22 ipfw add 95 allow ip from 66.181.18.0/27 to 69.55.230.11 22 cat /root/.ssh/id_dsa.pub | ssh backup3 'cat - >> /root/.ssh/authorized_keys' cat /root/.ssh/id_dsa.pub | ssh backup2 'cat - >> /root/.ssh/authorized_keys' cat /root/.ssh/id_dsa.pub | ssh backup1 'cat - >> /root/.ssh/authorized_keys' confirm that you can ssh to backup3 and backup 2 without getting a login prompt ssh backup3 hostname ssh backup2 hostname ssh backup1 hostname 10. edit root's path and login script: vi /root/.cshrc Change alias entries (add G): alias la ls -aG alias lf ls -FAG alias ll ls -lAG alias ls ls -AG alias mbm mb mount alias mbu mb umount and alter the prompt, set the following: set prompt = "`/bin/hostname -s` %/# " 11. install cvsup cd /usr/ports/net/cvsup-without-gui make install clean; rehash; mail -s 'cvs installed' 8583619553@vtext.com < /dev/null 12. get latest sources for this release: cd /usr/src echo "*default host=cvsup4.freebsd.org\ *default base=/usr\ *default prefix=/usr\ *default release=cvs tag=RELENG_9_1\ *default delete use-rel-suffix\ *default compress\ src-all" > sup cvsup sup ; mail -s 'cvs sup done' 8583619553@vtext.com < /dev/null 13. configure new kernel. cd /usr/src/sys/amd64/conf scp backup2:/mnt/data4/build/freebsd/firewall3-9.1 ./firewall3 15. build, install kernel and world cd /boot mv kernel kernel.GENERIC cd kernel.GENERIC cd /usr/src make buildkernel installkernel make buildworld ; mail -s 'buildworld done' 8583619553@vtext.com < /dev/null (supermicro: 2:15 mins, 2950: 38? mins) make installworld (2450: 3min, supermicro: 1min, 2950: :34) mergemaster -i 17. populate /etc/rc.conf with IPs and NFS settings vi /etc/rc.conf kern_securelevel_enable="NO" portmap_enable="NO" sendmail_enable="NO" usbd_enable="YES" gateway_enable="YES" xntpd_enable="YES" nfs_client_enable="YES" nfs_reserved_port_only="YES" fsck_y_enable="YES" background_fsck="NO" hostname="firewall3.johncompanies.com" # external network ifconfig_em0="inet 66.181.18.3 netmask 255.255.255.224" # internal network ifconfig_em1="inet 69.55.229.1 netmask 255.255.255.0" ifconfig_em1_alias0="inet 69.55.231.1 netmask 255.255.255.0" ifconfig_em1_alias1="inet 65.50.228.1 netmask 255.255.255.0" ifconfig_em1_alias2="inet 65.50.229.1 netmask 255.255.255.0" ifconfig_em1_alias3="inet 65.50.230.1 netmask 255.255.255.0" ifconfig_em1_alias4="inet 65.50.231.1 netmask 255.255.255.0" ifconfig_em1_alias5="inet 65.50.232.1 netmask 255.255.255.0" ifconfig_em1_alias6="inet 65.50.233.1 netmask 255.255.255.0" ifconfig_em1_alias7="inet 65.50.234.1 netmask 255.255.255.0" ifconfig_em1_alias8="inet 65.50.235.1 netmask 255.255.255.0" defaultrouter="66.181.18.2" # private network ifconfig_fxp0="inet 10.1.2.5 netmask 255.255.255.0" inetd_enable="YES" inetd_flags="-wW -a 10.1.2.5" sshd_enable="YES" usbd_enable="YES" ntpd_enable="YES" # powerd_enable="YES" 20. reboot. Confirm new kernel is loaded uname -a 21. update ports: cd /usr/ports echo "*default host=cvsup4.FreeBSD.org\ *default base=/usr\ *default prefix=/usr\ *default release=cvs tag=RELENG_9_1\ *default delete use-rel-suffix\ *default compress\ ports-all tag=." > sup cvsup sup; mail -s 'cvs sup ports done' 8583619553@vtext.com < /dev/null 22. Install raid mgmt tool # linux base cd /usr/ports/devel/libtool22 make install base cd /usr/ports/emulators/linux_base-fc4 make install clean scp backup2:/d4/build/3ware/tw_cli-freebsd-x86_64-9.5.0.1.tgz /usr/local/sbin cd /usr/local/sbin tar xzvf tw_cli-freebsd-x86_64-9.5.0.1.tgz rm tw_cli-freebsd-x86_64-9.5.0.1.tgz 23. install rsync from ports cd /usr/ports/net/rsync make install clean choose default options 25. install bb client adduser Username: bb Full name: bb Uid (Leave empty for default): 1984 Login group [bb]: Login group is bb. Invite bb into other groups? []: Login class [default]: Shell (sh csh tcsh nologin) [sh]: Home directory [/home/bb]: Use password-based authentication? [yes]: Use an empty password? (yes/no) [no]: Use a random password? (yes/no) [no]: yes Lock out the account after creation? [no]: Username : bb Password : <random> Full Name : bb Uid : 1984 Class : Groups : bb Home : /home/bb Shell : /bin/sh Locked : no OK? (yes/no): yes cd /usr/home/bb scp backup2:/mnt/data4/build/bb/bb-freebsd.tar . tar xvf bb-freebsd.tar edit /home/bb/bbc1.9e-btf/etc/bb-hosts with something like: echo "69.55.230.2 mail.johncompanies.com # BBPAGER BBNET BBDISPLAY smtp ssh \ 10.1.2.5 firewall3.johncompanies.com # ssh" > /home/bb/bbc1.9e-btf/etc/bb-hosts vi /home/bb/bbc1.9e-btf/ext/openfiles MACHINE="firewall3,johncompanies,com" # HAS TO BE IN A,B,C FORM cd /usr/home/bb/bbc1.9e-btf/etc ./bbchkcfg.sh (y to questions) ./bbchkhosts.sh (ignore ssh errors) cd ../.. chown -R bb . su bb cd cd bbc1.9e-btf/src make; make install cd .. vi /usr/home/bb/bbc1.9e-btf/bin/bb-cpu.sh $1 $TOPARGS > $BBTMP/TOP.$$ # /usr/local/jail/bin/jtop > $BBTMP/TOP.$$ ./runbb.sh start more BBOUT (look for errors) exit echo 'su - bb -c "cd /home/bb/bbc1.9e-btf; ./runbb.sh start"' > /usr/local/etc/rc.d/bb.sh chmod +x /usr/local/etc/rc.d/bb.sh Punch a hole in the firewall to allow it to communicate with bb monitor: ipfw add 00096 allow ip from 66.181.18.0/27 to 69.55.230.2 27. configure bb on mail: vi /usr/home/bb/bbsrc/bb1.9e-btf/etc/bb-hosts 66.181.18.3 firewall3.johncompanies.com # ssh su bb cd bbsrc/bb/runbb.sh restart ; exit 29. configure ntp echo "server 10.1.2.1" > /etc/ntp.conf /usr/sbin/ntpd -p /var/run/ntpd.pid sleep 2; ntpq -p (confirm itβs able to reach our time server) echo '/usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid -f /var/db/ntpd.drift' > /usr/local/etc/rc.d/ntp.sh chmod 0700 /usr/local/etc/rc.d/ntp.sh 30. fwd and reverse lookups on ns1c vr johncompanies.com (edit the PTR too) 33. setup backups echo '#\!/bin/sh\ backupdir=/data/firewall2/current\ \ ## ENTRY /etc ' > /usr/local/etc/backup.config on backup3: setup backup dirs: ssh backup3 mkdir -p /data/firewall2/current on backup3, add the system to vi /usr/local/sbin/snapshot_archive scp 69.55.230.2:/usr/local/etc/rsync.backup /usr/local/etc/rsync.backup vi /usr/local/etc/rsync.backup backup1 > backup3 crontab -e 1 0 * * * /usr/local/etc/rsync.backup 34. mkdir /root/logs 35. edit sshd_config for security vi /etc/ssh/sshd_config ListenAddress 66.181.18.3 ListenAddress 10.1.2.5 kill -1 `cat /var/run/sshd.pid` 35. raid chk cat > /usr/local/sbin/lsiraidchk #!/usr/bin/perl my @out = split "\n", `megarc -ldInfo -a0 -Lall|grep Status:`; foreach (@out) { if ($_ =~ /DEGRADED/) { $date = `date`; chomp $date; `echo "$date: RAID ARRAY DEGRADED" >> /var/log/messages`; } #print $_; } 36. add crontab entries crontab -e 30 3 * * * /usr/local/etc/rsync.backup 0 0 1 * * /sbin/ipfw zero 0 0 1 * * /sbin/ipfw del 3 4 5 59 23 30 * * /sbin/ipfw show > /tmp/ipfw_count 3 0 30 * * /sbin/ipfw show > /tmp/ipfw_count 0 3 * * * /etc/makefwrules.pl; /etc/makepiperules.pl; */5 * * * * /usr/local/sbin/lsiraidchk #10 0 * * * rm /var/spool/clientmqueue/* scp /etc/makefwrules.pl user@64.163.14.48:~ scp /etc/makepiperules.pl user@64.163.14.48:~ mv /home/user/makefwrules.pl /etc mv /home/user/makepiperules.pl /etc touch /etc/firewall.sh mkdir /etc/oldrules/ other binaries scp /usr/local/bin/rulemaker user@64.163.14.48:~ mv ~user/rulemaker /usr/local/sbin scp ~user/Sendmail.pm user@64.163.14.48:~ scp ~user/doswatch.pl user@64.163.14.48:~ Setup basic ruleset ipfw add 00009 count udp from any to any ipfw add 00010 allow tcp from any to any established ipfw add 00012 deny tcp from any to any tcpflags syn tcpoptions !mss ipfw add 00012 deny icmp from any to any icmptypes 4,5,9,10,12,13,14,15,16,17,18 ipfw add 00012 deny tcp from any to any tcpflags syn,fin ipfw add 00012 deny tcp from any to any tcpflags fin,psh,rst,urg ipfw add 00012 allow icmp from any to any ipfw add 00014 deny tcp from any to any dst-port 135 ipfw add 00150 skipto 65535 ip from any to any via em1 in IPKVM3: 00098 allow ip from { 69.55.230.6 or 69.55.230.7 } to 69.55.230.10 dst-port 139 00098 deny ip from any to 69.55.230.10 dst-port 139 </pre>
Summary:
Please note that all contributions to JCWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JCWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information