How to login with SSH without enter password
[Client]
$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/XXXX/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
$scp .ssh/id_rsa.pub mylogin@192.168.1.1:.ssh/authorized_keys
Password:
#Testing
$ssh mylogin@192.168.1.1
Friday, January 29, 2010
How to login with SSH without enter password
Thursday, October 1, 2009
[Lighttpd] Config lighttpd support SSL
Test on FreeBSD 7.2
lighttpd-1.4.22 (ssl) - a light and fast webserver
Build-Date: Apr 18 2009 13:02:03
1. Generate key
#mkdir /etc/ssl/private
#cd /etc/ssl/private/
#openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes
2. vi /usr/local/etc/lighttpd.conf
# Uncomment mod_redirect in server.modules.
$SERVER["socket"] == "0.0.0.0:443" {
#### SSL engine
ssl.engine = "enable"
ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
}
else $HTTP["host"] =~ "(.*)" {
url.redirect = ( "^/(.*)" => "https://%1/$1" )
}
3. Start lighttpd
#/usr/local/etc/rc.d/lighttpd restart
Thursday, August 13, 2009
[FreeBSD] ลงโปรแกรม netatalk เอาไว้ share ให้ mac
Wednesday, August 12, 2009
[FreeBSD] Create RamDisk on FreeBSD
vi mkramdisk.sh
#!/bin/sh
MOUNT_DIR="/dynamips/cache"
SIZE=512M
case "$1" in
start)
/sbin/mdmfs -S -s $SIZE md0 $MOUNT_DIR
echo "$SIZE ramdisk created on /dev/md0 and mounted on $MOUNT_DIR"
exit 0
;;
stop)
/sbin/umount $MOUNT_DIR
/sbin/mdconfig -d -u 0
echo "ramdisk unmounted from $MOUNT_DIR and deleted from /dev/md0"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` {start|stop|restart}" >&2
exit 64
;;
esac
[FreeBSD] Example /etc/pf.conf
vi /etc/rc.conf
pf_enable="YES" <== enable pf
vi /etc/pf.conf
## Macros
SYN_ONLY="S/FSRA"
EXT_NIC="bge0"
INT_NIC="bge1"
ALLOWED_ICMP="echoreq"
ALLOWED_TCP="{ 22,80 }"
TRUSTED_IP="{ 10.0.0.0/24, 1.1.1.1 }"
# Your Internet IP goes in the EXT_IP variable
EXT_IP="1.2.3.4"
# Your private network IP goes in the INT_IP variable
# if you have two NICs on the machine
INT_IP="192.168.1.1"
## TABLES
## GLOBAL OPTIONS
set block-policy drop
## TRAFFIC NORMALIZATION
## QUEUEING RULES
## TRANSLATION RULES (NAT)
## FILTER RULES
# Block everything (inbound AND outbound on ALL interfaces) by default (catch-all)
block all
# Default TCP policy
block return-rst in log on $EXT_NIC proto TCP all
pass in log quick on $EXT_NIC proto TCP from any to $EXT_IP port $ALLOWED_TCP flags $SYN_ONLY keep state
# Default UDP policy
block in log on $EXT_NIC proto udp all
# It's rare to be hosting a service that requires UDP (unless you are hosting
# a dns server for example), so there typically won't be any entries here.
# Default ICMP policy
block in log on $EXT_NIC proto icmp all
pass in log quick on $EXT_NIC proto icmp from any to $EXT_IP icmp-type $ALLOWED_ICMP keep state
# Default IP Policy
block in log on $EXT_NIC all
pass in log quick on $EXT_NIC from $TRUSTED_IP to $EXT_IP keep state
block out on $EXT_NIC all
pass out quick on $EXT_NIC from $EXT_IP to any keep state
# Allow the local interface to talk unrestricted
pass in quick on lo0 all
pass out quick on lo0 all
Thursday, May 21, 2009
[Juniper] How to simulate JUNOS w/ FreeBSD & VirtualBox on MacBook or Linux
Thursday, April 24, 2008
[FreeBSD] Basic commands for pfctl
# basic pfctl control
# ==
# This document: http://www.rdrs.net/document/
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
#### General PFCTL Commands ####
# pfctl -q run quiet
# pfctl -v -v run even more verbose
#### Loading PF Rules ####
# pfctl -f /etc/pf.conf load /etc/pf.conf
# pfctl -n -f /etc/pf.conf parse /etc/pf.conf, but dont load it
# pfctl -R -f /etc/pf.conf load only the FILTER rules
# pfctl -N -f /etc/pf.conf load only the NAT rules
# pfctl -O -f /etc/pf.conf load only the OPTION rules
#### Clearing PF Rules & Counters ####
# pfctl -F all flush ALL
# pfctl -F rules flush only the RULES
# pfctl -F queue flush only queue's
# pfctl -F nat flush only NAT
# pfctl -F info flush all stats that are not part of any rule.
# pfctl -z clear all counters
# note: flushing rules do not touch any existing stateful connections
#### Output PF Information ####
# pfctl -s rules show filter information
# pfctl -v -s rules show filter information for what FILTER rules hit..
# pfctl -vvsr show filter information as above and prepend rule numbers
# pfctl -v -s nat show NAT information, for which NAT rules hit..
# pfctl -s nat -i xl1 show NAT information for interface xl1
# pfctl -s queue show QUEUE information
# pfctl -s label show LABEL information
# pfctl -s state show contents of the STATE table
# pfctl -s info show statistics for state tables and packet normalization
# pfctl -s all show everything
#### Maintaining PF Tables ####
# pfctl -t addvhosts -T show show table addvhosts
# pfctl -vvsTables view global information about all tables
# pfctl -t addvhosts -T add 192.168.1.50 add entry to table addvhosts
# pfctl -t addvhosts -T add 192.168.1.0/16 add a network to table addvhosts
# pfctl -t addvhosts -T delete 192.168.1.0/16 delete nework from table addvhosts
# pfctl -t addvhosts -T flush remove all entries from table addvhosts
# pfctl -t addvhosts -T kill delete table addvhosts entirely
# pfctl -t addvhosts -T replace -f /etc/addvhosts reload table addvhosts on the fly
# pfctl -t addvhosts -T test 192.168.1.40 find ip address 192.168.1.40 in table addvhosts
# pfctl -T load -f /etc/pf.conf load a new table definition
# pfctl -t addvhosts -T show -v output stats for each ip address in table addvhosts
# pfctl -t addvhosts -T zero reset all counters for table addvhosts
Thursday, February 28, 2008
[FreeBSD] FreeBSD 7.0 ออกแล้ว
วันนี้ผมเข้าไปดู freebsd ปรากฏว่า freebsd 7.0 ออกแล้ว ซึ่งดูจาก release announce แล้วดูดีมากเลยครับสำหรับไปใช้กับ multiprocessing
Dramatic improvements in performance and SMP scalability shown by various database and other benchmarks, in some cases showing peak performance improvements as high as 350% over FreeBSD 6.X under normal loads and 1500% at high loads. When compared with the best performing Linux kernel (2.6.22 or 2.6.24) performance is 15% better. Results are from benchmarks used to analyze and improve system performance, results with your specific work load may vary. Some of the changes that contribute to this improvement are:
-
The 1:1 libthr threading model is now the default.
-
Finer-grained IPC, networking, and scheduler locking.
-
A major focus on optimizing the SMP architecture that was put in place during the 5.x and 6.x branches.
Friday, April 13, 2007
[FreeBSD] พอ install OS แล้วผมก็เตรียมพร้อมสำหรับโหลดบิต
ต้องทำให้เครื่อง pentium3 แรงๆเพื่อจะได้โหลดบิต (ทำแบบมั่วๆ search ใน google เรื่อง optimize, tunning บ้างมารวมๆกัน)
Thursday, April 12, 2007
[FreeBSD] ต้องการ compile Kernel ใหม่แต่ตอน Install เราไม่ได้เลือกให้ลง src
#/usr/sbin/sysinstall
- configure -> Distributions -> src -> All -> Ok -> FTP or CD/DVD
เมื่อเสร็จแล้ว
/usr/src/sys/i386/conf