# cat /etc/hostname.re0 inet 192.168.254.1 255.255.255.0 inet alias 192.168.254.10 255.255.255.255 # # cat /etc/hostname.rl0 inet 10.110.1.103 255.255.255.224
# cd /tmp # ftp http://ftp://ftp.openbsd.org/pub/OpenBSD/4.7/ports.tar.gz # cd /usr # tar -zxvf /tmp/ports.tar.gz
# cd /usr/ports # make search key=cvsup Port: cvsup-16.1hp2-no_x11 Path: net/cvsup,-main,no_x11 Info: network file distribution system Maint: The OpenBSD ports mailing-list <ports@openbsd.org> Index: net devel L-deps: B-deps: :lang/ezm3 R-deps: Archs: i386 # cd net/cvsup # make show=FLAVORS no_x11 # env FLAVOR="no_x11" make install
# make clean # make clean=depends
#cat /etc/cvsup-file-ports *default release=cvs *default delete use-rel-suffix *default umask=002 *default host=obsd.cec.mtu.edu *default base=/usr *default prefix=/usr *default tag=OPENBSD_4_7 OpenBSD-ports
# cvsup -g -L 2 /etc/cvsup-file-ports
#export PKG_PATH=http://ftp.gamma.ru/pub/OpenBSD/`uname -r`/packages/`machine -a`/ #pkg_add libxml mod_scgi nut p5-XML-Parser php5-core php5-extensions\ php5-xmlrpc pptp screen xmlrpc-c bash
named_flags="" named_user=named named_chroot=/var/named
forwarders { 10.5.0.2;};
namesrver 127.0.0.1
# dmesg |grep WD wd2 at pciide0 channel 1 drive 0: WDC WD5000AAKS-00UU3A0 wd3 at pciide0 channel 1 drive 1: WDC WD5000AAKS-00UU3A0
# fdisk -iy wd2 # fdisk -iy wd3
# printf "a\n\n\n\nRAID\nw\nq\n\n" | disklabel -E wd2 # printf "a\n\n\n\nRAID\nw\nq\n\n" | disklabel -E wd3
# bioctl -c 1 -l /dev/wd2a,/dev/wd3a softraid0
# dd if=/dev/zero of=/dev/rsd0c bs=1m count=1
# fdisk -iy sd0 # printf "a\n\n\n\n4.2BSD\nw\nq\n\n" | disklabel -E sd0 # newfs /dev/rsd0a
#mkdir /raid #mount /deb/sd0a /raid #cat /etc/fstab ---skip--- /dev/sd0a /raid ffs rw,nodev,nosuid 1 2 ---skip---
# cd /usr/ports/net/rtorrent/
CONFIGURE_ARGS= ${CONFIGURE_SHARED} --disable-debug --with-xmlrpc-c
# ls -la /data/ total 16 drwxr-xr-x 4 root wheel 512 Dec 11 18:41 . drwxr-xr-x 16 root wheel 512 Dec 20 13:13 .. drwxr-xr-x 12 p2p p2p 1024 Dec 20 20:19 torrents
# adduser Use option ``-silent'' if you don't want to see all warnings and questions. Reading /etc/shells Check /etc/master.passwd Check /etc/group Ok, let's go. Don't worry about mistakes. There will be a chance later to correct any input. Enter username []: p2p ---skip---
if [ -x /etc/rtorrent.sh ]; then echo -n ' rtorrent'; /etc/rtorrent.sh fi
# cat /etc/rtorrent.sh su p2p -c '/usr/local/bin/screen -m -d -S rtorrent /usr/local/bin/rtorrent'
# cd /var/www/ # mkdir sites/ # cd sites/ # wget http://rutorrent.googlecode.com/files/rutorrent-3.2.tar.gz # tar xzvf rutorrent-3.2.tar.gz # chown -R www:www rutorrent # chmod -R 777 rutorrent/share/
#cat /etc/rc.conf.local httpd_flags="-u"
# cat /var/www/conf/Includes/rutorrent.home.local.conf <VirtualHost 192.168.254.10:80> DocumentRoot /var/www/sites/rutorrent ServerName rutorrent.home.local ServerAlias www.rutorrent.home.local ErrorLog "|/usr/local/sbin/rotatelogs2 /var/log/httpd/http.rutorrent.home.local-error_log.%Y-%m-%d-%H_%M_%S 86400" CustomLog "|/usr/local/sbin/rotatelogs2 /var/log/httpd/http.rutorrent.home.local-access_log.%Y-%m-%d-%H_%M_%S 86400" common VirtualHost <b>!!! - , </b> <Directory /> AllowOverride AuthConfig DirectoryIndex index.html Order Deny,Allow Deny from all Allow from 192.168.0.0/16 Directory <b>!!! - , </b> SCGIMount /RPC2 127.0.0.1:5000
# cat /var/www/sites/rutorrent/.htaccess AuthName "Ololo can be found here!" AuthType Basic AuthUserFile /home/onotole/.htpasswd
#htpasswd -c /home/onotole/.htpasswd admin
#apachectl start
# sed '/ *#/d; /^$/d' /etc/exports /data -alldirs -mapall=nobody -network=192.168.254 -mask=255.255.255.0 /raid -alldirs -mapall=nobody -network=192.168.254 -mask=255.255.255.0
#chmod 777 /raid
# grep nfs /etc/rc.conf.local nfs_server=YES
#grep gateway /etc/fstab gateway:/data /home/onotole/data nfs ro 0 0 gateway:/raid /home/onotole/share nfs rw 0 0 #mount ~/data #mount ~/share
startup: set user onotole ololo admin set console self 127.0.0.1 5005 set console open set web self 192.168.0.1 5006 set web open default: load pptp_vpn pptp_vpn: create bundle static pptp1 set ipcp ranges 10.255.255.1/32 10.255.255.2/32 set iface route 192.168.254.0/24 set iface enable proxy-arp set iface enable on-demand set bundle enable compression set bundle enable crypt-reqd set ccp yes mppc set mppc yes compress set mppc yes e128 set mppc yes stateless create link static lpptp1 pptp set link action bundle pptp1 set link no pap set link yes chap set auth authname "ololo" set auth password "123" set link mtu 1460 set link keep-alive 0 0 set link max-redial -1 set pptp self 1.2.3.4 set pptp peer 0.0.0.0/0 set link enable incoming
# sysctl -w net.inet.gre.allow=1 net.inet.gre.allow: 0 -> 1
# grep gre /etc/sysctl.conf net.inet.gre.allow=1
# sed '/ *#/d; /^$/d' /etc/ppp/ppp.conf default: set log Phase Chat LCP IPCP CCP tun command disable ipv6cp vpn: set device "!/usr/local/sbin/pptp --nolaunchpppd work-onotole.com" set timeout 0 set lqrperiod 600 set redial 30 set authname ololo set authkey 123 set dial set login set mppe 128 stateless accept chap enable mssfixup disable acfcomp protocomp deny acfcom #
# cat /etc/ppp/ppp.linkup vpn: add work-onotole.com 10.110.1.97 add 192.168.0.0 255.255.255.0 10.255.255.1 ! sh -c "/sbin/pfctl -f /etc/pf.conf"
# cat /etc/ppp/ppp.linkdown vpn: delete 192.168.0.0/24 delete work-onotole.com ! sh -c "/sbin/pfctl -f /etc/pf.conf"
# cat /etc/hostname.tun0 !/usr/sbin/ppp -ddial vpn >/dev/null 2>&1
# cat /etc/nut/ups.conf [myups] driver = megatec port = /dev/tty00 # com1 desc = "Server"
# cat /etc/nut/upsd.users [admin] password = ups123 allowfrom = localhost actions = SET instcmds = ALL [monuser] password = mon123 allowfrom = localhost upsmon master
# cat /etc/nut/upsd.conf LISTEN 127.0.0.1 3493
# cat /etc/nut/upsmon.conf MONITOR myups@localhost 1 monuser mon123 master MINSUPPLIES 1 # SHUTDOWNCMD "/sbin/shutdown -h now" # POLLFREQALERT 5 # DEADTIME 15 # , POWERDOWNFLAG /etc/killpower # FINALDELAY 60 # ,
# chown _ups:wheel /dev/tty00 # chmod 600 /dev/tty00 # /usr/local/bin/upsdrvctl start
# /usr/local/sbin/upsd # /usr/local/sbin/upsmon
# upsc myups@localhost battery.charge: 97.5 battery.voltage: 13.60 battery.voltage.nominal: 12.0 driver.name: megatec driver.parameter.pollinterval: 2 driver.parameter.port: /dev/tty00 driver.version: 2.4.1 driver.version.internal: 1.6 input.frequency: 50.1 input.frequency.nominal: 50.0 input.voltage: 221.5 input.voltage.fault: 221.5 input.voltage.maximum: 245.0 input.voltage.minimum: 206.8 input.voltage.nominal: 220.0 output.voltage: 221.5 ups.beeper.status: enabled ups.delay.shutdown: 0 ups.delay.start: 2 ups.load: 19.0 ups.mfr: unknown ups.model: unknown ups.serial: unknown ups.status: OL # , OB - LB - ups.temperature: 25.0 ups.type: standby
if [ -x /usr/local/bin/upsdrvctl ]; then echo -n ' nut' chown _ups:wheel /dev/tty00 chmod 600 /dev/tty00 /usr/local/bin/upsdrvctl start > /dev/null 2>&1 /usr/local/sbin/upsd > /dev/null 2>&1 /usr/local/sbin/upsmon > /dev/null 2>&1 fi
if [ -f /etc/killpower ]; then /usr/local/bin/upsdrvctl shutdown sleep 60 fi
#sysctl -w net.inet.ip.forwarding=1
#grep ip.forwarding /etc/sysctl.conf net.inet.ip.forwarding=1 # 1=Permit forwarding (routing) of IPv4 packets
# sed '/ *#/d; /^$/d' /etc/pf.conf ext_if="rl0" int_if="re0" vpn_if="tun0" set block-policy return set skip on lo0 match in all scrub (no-df) block all pass on $int_if pass on $vpn_if pass out on $ext_if # pass out on $ext_if from $int_if:network to any nat-to ($ext_if) # 3333(tcp,udp) dc++ pass in on $ext_if proto {tcp,udp} from any port 3333 rdr-to 192.168.254.2 synproxy state
Source: https://habr.com/ru/post/110477/
All Articles