Hviidnet.com
27Dec/090

Check Ubuntu swap is allocated

swapon -s

Checks what paths are currently accepted for swap

Tagged as: No Comments
27Dec/092

Ubuntu wrong disk size with DF

Is your linux reporting the wrong disk size after expanding the disk?

get this: http://www.sysresccd.org/

1. Boot you system with a CDROM/USB using any of the rescue linux or knoppix etc. I used sysresccd.
2. After boot up

umount /dev/sda3 (just in case if it is mounted)

3. do a file system check
Code:

fsck -n /dev/sda3

Output shuld be

/dev/sda3: clean, >

4.Removed the journal from /dev/sda3, this will make it an ext2 partition

tune2fs -O ^has_journal /dev/sda3

5. run

e2fsck -f /dev/sda3

6. resize the partition (with resize2fs without options takes your max size of the disk)

resize2fs /dev/sda3

7. Next run

fsck -n /dev/sda3

8. Create journal on /dev/sda3, this will turn sda3 to ext3 partition again
Code:

tune2fs -j /dev/sda3

9. Reboot the system using your original OS

Tagged as: 2 Comments
16Jul/090

Proftpd and TLS

OpenSSL is needed by TLS; to install ProFTPd and OpenSSL, we simply run:

apt-get install proftpd openssl

You will be asked a question:

Run proftpd: <-- standalone

Creating The SSL Certificate For TLS

In order to use TLS, we must create an SSL certificate. I create it in /etc/proftpd/ssl, therefore I create that directory first:

mkdir /etc/proftpd/ssl

Afterwards, we can generate the SSL certificate as follows:

openssl req -new -x509 -days 365 -nodes -out /etc/proftpd/ssl/proftpd.cert.pem -keyout /etc/proftpd/ssl/proftpd.key.pem

Country Name (2 letter code) [AU]: <-- Enter your Country Name (e.g., "DE").
State or Province Name (full name) [Some-State]: <-- Enter your State or Province Name.
Locality Name (eg, city) []: <-- Enter your City.
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter your Organization Name (e.g., the name of your company).
Organizational Unit Name (eg, section) []: <-- Enter your Organizational Unit Name (e.g. "IT Department").
Common Name (eg, YOUR name) []: <-- Enter the Fully Qualified Domain Name of the system (e.g. "server1.example.com").
Email Address []: <-- Enter your Email Address.
4 Enabling TLS In ProFTPd

In order to enable TLS in ProFTPd, open /etc/proftpd/proftpd.conf...

vi /etc/proftpd/proftpd.conf

... and uncomment the Include /etc/proftpd/tls.conf line:

[...]
#

# This is used for FTPS connections
#
Include /etc/proftpd/tls.conf
[...]

Then open /etc/proftpd/tls.conf and make it look as follows:

<IfModule mod_tls.c>
TLSEngine                  on
TLSLog                     /var/log/proftpd/tls.log
TLSProtocol                SSLv23
TLSOptions                 NoCertRequest
TLSRSACertificateFile      /etc/proftpd/ssl/proftpd.cert.pem
TLSRSACertificateKeyFile   /etc/proftpd/ssl/proftpd.key.pem
TLSVerifyClient            off
TLSRequired                on
</IfModule>

If you use TLSRequired on, then only TLS connections are allowed (this locks out any users with old FTP clients that don't have TLS support); by commenting out that line or using TLSRequired off both TLS and non-TLS connections are allowed, depending on what the FTP client supports.

Restart ProFTPd afterwards:

/etc/init.d/proftpd restart

That's it. You can now try to connect using your FTP client; however, you should configure your FTP client to use TLS (this is a must if you use TLSRequired on) - see the next chapter how to do this with FileZilla.

If you're having problems with TLS, you can take a look at the TLS log file /var/log/proftpd/tls.log.

24Jun/090

Linux commands to test website speed

ngrep -q 'HTTP Error 503' port 80

this command gets all trafic on eth0 and on port 80 that includes the line "HTTP Error 503"

tcpdump -i eth0

gets tcp traffic on eth0

ulimit -n 300000

Sets the max numbers of open files

ab -n 100000 -c 500  http://blog.hviidnet.com/

Benchmarks blog.hviidnet.com with 500 concurent connections 100000 times.. (needs to have apache installed)

7Apr/090

Ubuntu 8.04 network after vmware ESX 3i clone

vi /etc/udev/rules.d/70-persistent-net.rules

when you clone a vm, it will assign the nic a new mac.

if you didn’t clear these rules prior to cloning the disk, the mac will be assigned to the next available ethernet interface ie: eth1

delete the eth0 line, rename the eth1 to eth0, reboot.

Alteratively just delete the file. For template clone images just delete the file as the last thing you do and it will create a new on boot (when its cloned and has new mac addresses).