Install VSFTPd on AWS EC2



sudo apt install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original
sudo nano /etc/vsftpd.conf

anonymous_enable=NO
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
local_root=/var/www
seccomp_sandbox=no
pam_service_name=ftp
pasv_enable=YES
pasv_min_port=13000
pasv_max_port=13100
port_enable=YES
pasv_address=__your_ec2_domain__
pasv_addr_resolve=YES

sudo useradd myftp
sudo passwd myftp
sudo usermod --home /var/www/ myftp

sudo addgroup ftpusers
sudo usermod -a -G ftpusers myftp
sudo usermod -a -G www-data myftp
sudo usermod -g ftpusers myftp

sudo nano /etc/vsftpd.chroot_list
ubuntu

sudo nano /etc/ssh/sshd_config

Match Group ftpusers
ForceCommand internal-sftp
ChrootDirectory /var/www/
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

sudo service ssh restart
sudo systemctl restart vsftpd

Set you EC2 Security Group to allow incoming tcp traffic to port 20-21, 13000-13100
Connect from you ftp client and set connection to passive mode

 

Shell – Check SSL Certificate


Just a few minutes after trying to check domain’s SSL Certificate expiry date with python which requires around ten lines of code, I found a shell script which doing that task in just one line, here’s the script

#!/bin/bash

echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates

 

source:

Python – Check SSL Certificate Expiry Date


Just playing with python 3 to make a simple utility to check my domain expiry date

# save as check_ssl.py

import OpenSSL
import ssl, socket
import argparse

# get domain
parser = argparse.ArgumentParser()
parser.add_argument(“domain”)
args = parser.parse_args()
domain = args.domain

# get SSL Cert info
cert = ssl.get_server_certificate((domain, 443))
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
x509info = x509.get_notAfter()

exp_day = x509info[6:8].decode(‘utf-8’)
exp_month = x509info[4:6].decode(‘utf-8’)
exp_year = x509info[:4].decode(‘utf-8’)

exp_date = str(exp_day) + “-” + str(exp_month) + “-” + str(exp_year)

print(“SSL Certificate for domain”, domain, “will be expired on (DD-MM-YYYY)”, exp_date)

then run with the domain you want to check as the argument

python check_ssl.py example.com

 

jQuery : Select All Checkbox


Yahoo! Mail and GMail both has a checkbox on top of their email list which will “checked” all chekboxes when clicked. Previously I use plain old javascript like those in this link, I just try to use jQuery to do this, its only 5 lines

$('#selectAll').click(function(event){
    $('input[type="checkbox"]').each(function(){
        this.checked = event.target.checked;
    });
});