Archive for the ‘Linux’ Category

Test HTTP with Telnet

# Telnet to server on port 80 GET /index.html HTTP/1.0 Host: www.test.com For HTTPS you will need to use openssl: openssl s_client -connect localhost:443 GET /index.html HTTP/1.0 openssl s_client -connect localhost:443

ProFTP Enable Transfer Resume

Edit proftpd.conf # Allow uploads to resume AllowStoreRestart    on # Allow downloads to resume AllowRetrieveRestart    on

RedHat Enabled Passive FTP

// List the modules installed lsmod // Load the ip_conntrack_ftp module modprobe ip_conntrack_ftp Edit /etc/sysconfig/iptables-config to include: IPTABLES_MODULES=”ip_nat_ftp ip_conntrack_ftp”

ProFTP enable FXP

Edit /etc/proftp.conf <Global> AllowForeignAddress on </Global>

ProFTP login Delay

Edit /etc/proftpd.conf adding the following lines: UseReverseDNS       off IdentLookups        off

Curl Error: openssl missing CA

This seems to happen with different versions on libcurl on el4. Just make sure that there is a ca-bundle in the right place: mkdir -p /etc/pki/tls/certs && ln -s /usr/share/ssl/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt You can find where its looking for the bundle using curl -v : curl -v https://www.google.co.uk * About to connect() to www.google.co.uk port 443 […]

Convert SSL from pfx to pem

Convert an SSL certificate from IIS pfx to Apache pem format: # Export the private key file from the pfx file openssl pkcs12 -in filename.pfx -nocerts -out key.pem # Export the certificate file from the pfx file openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem # This removes the passphrase from the private key so […]

Compare RPM’s on two servers

Useful if your migrating from an old server to a new one and want to check everything needed is installed. First, pull a list of RPM package by name only: rpm -qa –queryformat=’%{NAME}\n’ | sort > server.txt Once you’ve done that on both servers, just use diff to compare the two files: diff serverold.txt servernew.txt […]

Recursively change file permissions

If you chmod -R it will recursively chmod everything whether it be a file or directory. A more sensible way is: # Change directories find . -type d -exec chmod 755 {} \; # Change files find . -type f -exec chmod 644 {} \; Obviously chowning is similar: find . -type f -exec chown […]

Run CGI scripts in httpdocs

Plesk only allows .cgi files to be executed from cgi-bin but allows .pl files to be executed from anywhere. To allow .cgi to be executed from httpdocs add line to .htaccess: AddHandler cgi-script .cgi