Friday, June 30, 2006

Apache config, limiting some file type access on OpenBSD

Dissallow *.inc *.class from anywhere


<VirtualHost <server_ip>>
  ServerAdmin myname@mydomain
  DocumentRoot /var/www/htdocs/mydir
  ServerName myserver
  ErrorLog logs/error_log
  TransferLog logs/access_log
  <Directory "/var/www/htdocs/mydir">
    Satisfy All
    Order deny,allow
    Deny from all
    Allow from <trusted_ip>
    AuthType Basic
    AuthUserFile /var/www/htdocs/mydir/.htpasswd
    AuthName Auth_Here
    require valid-user
    <Files ~ "\.(inc|class)$*">
      Deny from all
    </Files>
  </Directory>
</VirtualHost>

cacti squid snmp on OpenBSD

on squid server

copy squid mib to snmp dir
#cp squid-x.x.xx/src/mib.txt /usr/local/share/snmp/mibs/SQUID-MIB.txt

in squid.conf

acl snmp src 127.0.0.0/8
acl snmppublic snmp_community myconfig
snmp_port 3401
snmp_access allow snmppublic snmp

#squid -k reconfigure

in snmpd.conf
proxy -v 1 -c mycommunity localhost:3401 .1.3.6.1.4.1.3495.1

#kill -9

re-run snmpd
#snmpd

trap testing
#snmpwalk -v 1 -c mycommunity localhost:3401 .1.3.6.1.4.1.3495.1

got some thing like this :
SNMPv2-SMI::enterprises.3495.1.1.1.0 = INTEGER: 6148
SNMPv2-SMI::enterprises.3495.1.1.2.0 = INTEGER: 2154718
SNMPv2-SMI::enterprises.3495.1.1.3.0 = Timeticks: (6303804) 17:30:38.04
...
...
...


on cacti server

donwload and install this, see README for detail :
http://forums.cacti.net/download.php?id=79

create device, and test using verbose query :), (sorry it's jumping step :D)

Thursday, June 29, 2006

sarg on OpenBSD

dulu pas install sarg ver 2.1 harus ngelakuin kayak gini dulu

diff index.c~ index.c
372c372
< sprintf(warea,"sort -t';' +6.5n +6.2M +6.0n '%s' -o '%s'", wdir_tmp, wdir_tmp2);
---
> sprintf(warea,"sort -t';' +6.5n +6.2 +6.0n '%s' -o '%s'", wdir_tmp, wdir_tmp2);
374c374
< sprintf(warea,"sort -t';' +6.5nr +6.2Mr +6.0nr '%s' -o '%s'", wdir_tmp, wdir_tmp2);
---
> sprintf(warea,"sort -t';' +6.5nr +6.2r +6.0nr '%s' -o '%s'", wdir_tmp, wdir_tmp2);

tapi baru aja install ver 2.2.1 langsung bisa :)

squid delay pools di OpenBSD manis juga

#####DELAY POOLS
#This is the most important part for shaping incoming traffic with Squid
#For detailed description see squid.conf file or docs at http://www.squid-cache.org

#We don't want to limit downloads on our local network
acl magic_words1 url_regex -i 192.168

#We want to limit downloads of these type of files
#Put this all in one line
acl magic_words2 url_regex -i ftp .exe .mp3 .vqf .tar.gz .gz .rpm .zip .rar .avi .mpeg .mpe .mpg .qt .ram .rm .iso .raw .wav
#We don't block .html, .gif, .jpg and similar files, because they
#generally don't consume much bandwidth

#We have two different delay_pools
delay_pools 2

#First delay pool
#W don't want to delay our local traffic
#There are three pool classes; here we will deal only with the second
delay_class 1 2

#-1/-1 mean that there are no limits
delay_parameters 1 -1/-1 -1/-1

#magic_words1: 192.168
delay_access 1 allow magic_words1

#Second delay pool
#we want to delay downloading files mentioned in magic_words2
delay_class 2 2

#The numbers here are values in bytes;
#we must remember that Squid doesn't consider start/stop bits
#5000/150000 are values for the whole network
#5000/120000 are values for the single IP
#after downloaded files exceed about 150000 bytes,
#(or even twice or three times as much)
#they will continue to download at about 5000 bytes/s

delay_parameters 2 5000/150000 5000/120000
delay_access 2 allow magic_words2

Friday, June 23, 2006

my uptime

iseng-iseng liat uptime komputer desktop yang tak pake :

arip@skimpi:~$ uptime
17:47:54 up 13 days, 11 min, 4 users, load average: 0.06, 0.11, 0.15
arip@skimpi:~$

udah 13 hari ga mati :p

Wednesday, June 14, 2006

PHP array_search() ... notice

Coba-coba kok ada yang aneh di array_search, gak bisa search first array element, ternyata harus ada perlakuan khusus.

if ( FALSE === array_search($qname,$this->qname_array) ) {
echo "Sorry, your queue name is suck :D";
exit;
}

Thursday, June 01, 2006

PF rate

Udah lama nggak mainan PF, setelah baca-baca and nyoba, HFSC nya pf top abis, kemaren nyoba limit koneksi 16kbps, share 2 point, 8kbps each. Selama ini blom pernah nyoba gimana tuh pake 'rate', setelah dicoba, ck ck ck ... keren, 1KBps bisa didapet tiap share point. Trus ini yang jadi masalah selama ini, software HFSC klo dihajar software kayak `massdownloader` tu gimana, selama ini asumsi gw, HFSC kalah/menceng :D, tapi pas liat kemaren waktu pake rate ... massdownloadernya KO tetep ke limit total 1KBps ... coool, selanjutnya .... max connection limiting (nik ra males :D)