~ibm-demo/charms/trusty/vsftpd/trunk

« back to all changes in this revision

Viewing changes to hooks/install

  • Committer: Nathan Williams
  • Date: 2012-05-03 22:26:30 UTC
  • Revision ID: nathan@nathanewilliams.com-20120503222630-zfh9na9zla2o4bbd
re-introduced config-changed hook

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
set -eux
4
4
 
5
5
# Install the service
6
 
juju-log "Installing vsftpd via apt-get"
7
 
apt-get install -y vsftpd
8
 
juju-log "vsftpd installation complete"
 
6
apt-get install -y vsftpd libpam-pwdfile apache2-utils
 
7
 
 
8
mkdir -p /srv/ftp/
9
9
 
10
10
# Configure vsftpd
11
 
juju-log "Installing default configuration"
12
 
 
13
11
cat > /etc/vsftpd.conf <<EOF
14
12
anon_max_rate=0
15
 
anonymous_enable=YES
16
 
chown_uploads=NO
17
 
chroot_local_user=NO
 
13
anon_upload_enable=NO
 
14
anon_mkdir_write_enable=NO
 
15
anonymous_enable=NO
 
16
chroot_local_user=YES
18
17
connect_from_port_20=YES
19
18
dirlist_enable=YES
20
19
dirmessage_enable=YES
21
20
download_enable=YES
22
21
ftpd_banner=All activity is logged. Act up and you will be banned.
 
22
guest_enable=YES
 
23
guest_username=ftp
 
24
hide_ids=YES
23
25
listen=YES
24
26
listen_port=21
25
27
local_max_rate=0
26
 
local_enable=NO
27
 
max_clients=0
28
 
max_per_ip=0
 
28
local_enable=YES
 
29
local_root=/srv/ftp/\$USER
 
30
local_umask=022
 
31
max_clients=200
 
32
max_per_ip=5
29
33
pam_service_name=vsftpd
 
34
pasv_min_port=30000
 
35
pasv_max_port=30999
30
36
rsa_cert_file=/etc/ssl/private/vsftpd.pem
31
 
secure_chroot_dir=/var/run/vsftpd/empty
 
37
secure_chroot_dir=/var/run/vsftpd
32
38
session_support=NO
33
39
syslog_enable=NO
34
40
use_localtime=YES
35
 
write_enable=NO
 
41
user_sub_token=\$USER
 
42
write_enable=YES
36
43
xferlog_enable=YES
37
 
EOF
38
 
 
39
 
juju-log "Configuration installed"
40
 
 
41
 
juju-log "Restarting vsftpd"
 
44
virtual_use_local_privs=YES
 
45
EOF
 
46
 
 
47
cat > /etc/pam.d/vsftpd <<EOF
 
48
auth    required        pam_pwdfile.so  pwdfile /etc/ftpd.passwd
 
49
account required        pam_permit.so
 
50
EOF
42
51
 
43
52
service vsftpd restart || service vsftpd start
 
53
 
 
54
open-port 21/tcp