Automatically deny hosts from SSH brute force attacks

Friday August 15thUncategorized Category

1. Download denyhosts from:

http://denyhosts.sourceforge.net/

2. Extract file and follow README.txt

Mini GnuPG (gpg) howto

Friday August 15thLinux, Mac Category

Mini GnuPG (gpg) howto

A. Creating your own gpg key.
1. Download and install gpg from http://www.gnupg.org

2. Generate gpg key
***BEGIN shell***
# gpg –gen-key
gpg (GnuPG) 1.4.7; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection?1
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 1024
Requested keysize is 1024 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
“Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>”

Real name: Test User
Email address: testuser@foo.com
Comment: test user only
You selected this USER-ID:
“Test User (test user only) <testuser@foo.com>”

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++++++++++++++++++++++.++++++++++++++++++++.

gpg: key 3C32C24C marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u
gpg: next trustdb check due at 2012-03-27
pub 1024D/3C32C24C 2007-12-18
Key fingerprint = 3D63 CBA7 07CB 9646 E191 EBBB 3801 3C09 3C32 C24C
uid Test User (test user only) <testuser@foo.com>
sub 1024g/FDAFFDE3 2007-12-18

***END shell***

3. Check your new key
***BEGIN shell***
# gpg –list-keys “test user”
pub 1024D/3C32C24C 2007-12-18
uid Test User (test user only) <testuser@foo.com>
sub 1024g/FDAFFDE3 2007-12-18
***END shell***
Note: Your key ID is 3C32C24C

4. Send your key to a public key server
#gpg –keyserver <keyserver> –send-keys <key ID>

B. Signing keys to affirm that the sender is valid.

1. Trust sender key ID if you can verify the source. Ex. Face-to-face comfirmation, phone, video, gut feel :), and other means you can think of.

2. Receive keys from other users by downloading from a trusted key server
#gpg –keyserver <keyserver> –recv-keys <key id>
#gpg –keyserver wwwkeys.pgp.net –recv-key B6CFD174

3. Sign the sender’s key ID
# gpg –sign-key <key ID>

4. Once you have signed the key, you can send it back to the key server
# gpg –keyserver <keyserver> –send-keys B6CFD174

5. After sending the sender’s key, other people can now download it along with your signature

C. Sending encrypted messages
1. To encrypt a file into an *.gpg binary file
# gpg –encrypt <filename>

2. To encrypt a file into an *.asc ASCII-armored file
# gpg –armor –encrypt <file>

D. Decrypting received messages
# gpg <filename>

E. Generating ASCII-armored versions of your key ID.
1. Some servers or people prefer the ASCII-armored version of your public key. Just enter the following line:
# gpg -a –export <public key ID> > your_public_key.asc

LVM Mini Howto

Friday August 15thLinux Category

LVM Mini Howto

(1) Create LVM partitions
*** BEGIN shell ***
#fdisk /dev/sdb
Command (m for help): p

Disk /dev/sdb (Sun disk label): 255 heads, 63 sectors, 2202 cylinders
Units = cylinders of 16065 * 512 bytes

Device Flag Start End Blocks Id System
/dev/sdb1 0 2202 17687565 83 Linux native
/dev/sdb3 0 2202 17687565 5 Whole disk

Command (m for help): t
Partition number (1-8): 1
Hex code (type L to list codes): 8e
Command (m for help): w
*** END shell ***

(2) Repeat (1) for additional partitions

(3) If pvcreate is missing (in Debian), install lvm2
#apt-get install lvm2

(4) Create physical volume
# pvcreate /dev/sdb1

(5) Repeat (4) for additional volumes

(6) Create and name the volume group. Ex. volume group name “backup.”
#vgcreate backup /dev/sdb1 /dev/sdc1 /dev/sdd1

(7) Create and name the logical volume group. E. lvg name “backup-lvm”
# lvcreate -n backup-lvm –size 84.68g backup

(8) Format LVM with ext3
# mkfs.ext3 /dev/backup/backup-lvm

(9) Mount to any partition you want

ssl self signed cert

Friday August 15thLinux Category

openssl genrsa -out jopoy.com.key 1024
openssl req -new -key /etc/httpd/conf/ssl.key/jopoy.com.key -out jopoy.com.csr
openssl x509 -req -days 365 -in ../ssl.csr/jopoy.com.csr -signkey ../ssl.key/jopoy.com.key -out jopoy.com.crt

CheckInstall

Friday August 15thLinux Category

CheckInstall keeps track of all files installed by a “make install” or equivalent, creates a Slackware, RPM, or Debian package with those files, and adds it to the installed packages database, allowing for easy package removal or distribution.

http://freshmeat.net/projects/checkinstall

Disable Dashboard on OS X Tiger

Friday August 15thMac Category

>defaults write com.apple.dashboard mcx-disabled -boolean YES
>killall Dock

Postfix+MailScanner+Spamassassin

Friday August 15thLinux Category

1. Install Postfix
2. Download and Install MailScanner
3. Install Spamassassin

4. /etc/postfix/main.cf
header_checks = regexp:/etc/postfix/header_checks

5. /etc/postfix/header_checks
/^Received:/ HOLD

6. /etc/MailScanner/MailScanner.conf
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix

7. #chown postfix.postfix /var/spool/MailScanner/incoming

8. #chown postfix.postfix /var/spool/MailScanner/quarantine

9. mkdir /var/spool/MailScanner/spamassassin

10. chown postfix.postfix /var/spool/MailScanner/spamassassin

11. Restart postfix and MailScanner

Pismo Battery Time Remaining Fix on Tiger

Friday August 15thMac Category

Yehey!

After scouring the web all morning, I finally found a fix here and downloaded the needed file here.

Steps I took:
1. Download file and extract.
2. Go to “/System/Library/SystemConfiguration”
3. Rename “PowerManagement.bundle”
4. Copy the downloaded PowerManagement.bundle to the same path.
5. Change ownership to root:wheel
6. Restart Tiger
7. Watch in awe :)

Rsync Basic Config

Friday August 15thLinux, Networking Category

##On rsync source computer:

#vi /etc/rsyncd.conf

max connections = 2
log file = /var/log/rsync.log
timeout = 300

[pub]
comment = Squid Blocked Sites
path = /etc/squid/blockedsites
read only = yes
list = yes
uid = nobody
gid = nobody
auth users = pub
secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.1.2

#vi /etc/rsyncd.secrets
pub:pub

#chmod 600 /etc/rsyncd.secrets

#vi /etc/xinetd.d/rsync
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = –daemon
log_on_failure += USERID
}

##On Client PC:

#vi /root/rsync.password
pub

#rsync -avz -e ssh rsync://pub@192.168.1.1/pub/sites.txt /etc/squid/blockedsites/sites.txt –password-file /root/rsync.password

## Sources:
http://transamrit.net/docs/rsync/
http://www.freebsddiary.org/rsync.php

mod_ssl FAQ

Friday August 15thLinux Category

http://www.modssl.org/docs/2.8/ssl_faq.html

Size

Colors