2008-02-07 14:37:20 +01:00
|
|
|
{ vsftpd, anonymousUser }:
|
2008-02-07 13:41:18 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "vsftpd";
|
|
|
|
|
|
|
|
groups = [
|
|
|
|
{ name = "ftp";
|
|
|
|
gid = (import ../system/ids.nix).gids.ftp;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
users = [
|
|
|
|
{ name = "vsftpd";
|
|
|
|
uid = (import ../system/ids.nix).uids.vsftpd;
|
|
|
|
description = "VSFTPD user";
|
|
|
|
home = "/homeless-shelter";
|
|
|
|
}
|
|
|
|
] ++
|
2008-02-07 14:37:20 +01:00
|
|
|
(if anonymousUser then [
|
2008-02-07 13:41:18 +01:00
|
|
|
{ name = "ftp";
|
|
|
|
uid = (import ../system/ids.nix).uids.ftp;
|
|
|
|
group = "ftp";
|
|
|
|
description = "Anonymous ftp user";
|
|
|
|
home = "/home/ftp";
|
|
|
|
}
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[]);
|
|
|
|
|
|
|
|
job = "
|
|
|
|
description \"vsftpd server\"
|
|
|
|
|
|
|
|
start on network-interfaces/started
|
|
|
|
stop on network-interfaces/stop
|
|
|
|
|
|
|
|
start script
|
|
|
|
cat > /etc/vsftpd.conf <<EOF
|
|
|
|
" +
|
2008-02-07 14:37:20 +01:00
|
|
|
(if anonymousUser then
|
2008-02-07 13:41:18 +01:00
|
|
|
"anonymous_enable=YES"
|
|
|
|
else
|
|
|
|
"anonymous_enable=NO") +
|
|
|
|
"
|
|
|
|
background=NO
|
|
|
|
listen=YES
|
|
|
|
nopriv_user=vsftpd
|
|
|
|
secure_chroot_dir=/var/ftp/empty
|
|
|
|
EOF
|
|
|
|
|
|
|
|
mkdir -p /home/ftp &&
|
|
|
|
chown -R ftp:ftp /home/ftp
|
|
|
|
end script
|
|
|
|
|
|
|
|
respawn ${vsftpd}/sbin/vsftpd /etc/vsftpd.conf
|
|
|
|
";
|
|
|
|
|
|
|
|
}
|