Convert "vsftpd"
svn path=/nixos/branches/fix-style/; revision=14383
This commit is contained in:
parent
e7b7d62777
commit
4d0761beb2
@ -479,43 +479,6 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vsftpd = {
|
|
||||||
enable = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "
|
|
||||||
Whether to enable the vsftpd FTP server.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
anonymousUser = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "
|
|
||||||
Whether to enable the anonymous FTP user.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
writeEnable = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "
|
|
||||||
Whether any write activity is permitted to users.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
anonymousUploadEnable = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "
|
|
||||||
Whether any uploads are permitted to anonymous users.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
anonymousMkdirEnable = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "
|
|
||||||
Whether mkdir is permitted to anonymous users.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
printing = {
|
printing = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
@ -1062,6 +1025,7 @@ in
|
|||||||
(import ../upstart-jobs/tomcat.nix) # untested, too lazy to get that jdk
|
(import ../upstart-jobs/tomcat.nix) # untested, too lazy to get that jdk
|
||||||
(import ../upstart-jobs/httpd.nix) # Apache httpd (probably this can be removed ?)
|
(import ../upstart-jobs/httpd.nix) # Apache httpd (probably this can be removed ?)
|
||||||
(import ../upstart-jobs/apache-httpd) # Apache httpd (new style).
|
(import ../upstart-jobs/apache-httpd) # Apache httpd (new style).
|
||||||
|
(import ../upstart-jobs/vsftpd.nix)
|
||||||
|
|
||||||
# nix
|
# nix
|
||||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||||
|
@ -172,14 +172,6 @@ let
|
|||||||
inherit config pkgs modprobe;
|
inherit config pkgs modprobe;
|
||||||
})
|
})
|
||||||
|
|
||||||
# VSFTPd server
|
|
||||||
++ optional config.services.vsftpd.enable
|
|
||||||
(import ../upstart-jobs/vsftpd.nix {
|
|
||||||
inherit (pkgs) vsftpd;
|
|
||||||
inherit (config.services.vsftpd) anonymousUser
|
|
||||||
writeEnable anonymousUploadEnable anonymousMkdirEnable;
|
|
||||||
})
|
|
||||||
|
|
||||||
# X Font Server
|
# X Font Server
|
||||||
++ optional config.services.xfs.enable
|
++ optional config.services.xfs.enable
|
||||||
(import ../upstart-jobs/xfs.nix {
|
(import ../upstart-jobs/xfs.nix {
|
||||||
|
@ -1,69 +1,107 @@
|
|||||||
{ vsftpd, anonymousUser
|
{pkgs, config, ...}:
|
||||||
, anonymousUploadEnable, anonymousMkdirEnable, writeEnable
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
###### interface
|
||||||
name = "vsftpd";
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
|
||||||
groups = [
|
options = {
|
||||||
{ name = "ftp";
|
services = {
|
||||||
gid = (import ../system/ids.nix).gids.ftp;
|
vsftpd = {
|
||||||
}
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether to enable the vsftpd FTP server.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
anonymousUser = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether to enable the anonymous FTP user.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
writeEnable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether any write activity is permitted to users.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
anonymousUploadEnable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether any uploads are permitted to anonymous users.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
anonymousMkdirEnable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether mkdir is permitted to anonymous users.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (config.services.vsftpd) anonymousUser writeEnable anonymousUploadEnable anonymousMkdirEnable;
|
||||||
|
inherit (pkgs) vsftpd;
|
||||||
|
|
||||||
|
yesNoOption = p : name :
|
||||||
|
"${name}=${if p then "YES" else "NO"}";
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf config.services.vsftpd.enable {
|
||||||
|
require = [
|
||||||
|
options
|
||||||
];
|
];
|
||||||
|
|
||||||
users = [
|
users = {
|
||||||
|
extraUsers = [
|
||||||
{ name = "vsftpd";
|
{ name = "vsftpd";
|
||||||
uid = (import ../system/ids.nix).uids.vsftpd;
|
uid = (import ../system/ids.nix).uids.vsftpd;
|
||||||
description = "VSFTPD user";
|
description = "VSFTPD user";
|
||||||
home = "/homeless-shelter";
|
home = "/homeless-shelter";
|
||||||
}
|
}
|
||||||
] ++
|
] ++ pkgs.lib.optional anonymousUser
|
||||||
(if anonymousUser then [
|
|
||||||
{ name = "ftp";
|
{ name = "ftp";
|
||||||
uid = (import ../system/ids.nix).uids.ftp;
|
uid = (import ../system/ids.nix).uids.ftp;
|
||||||
group = "ftp";
|
group = "ftp";
|
||||||
description = "Anonymous ftp user";
|
description = "Anonymous ftp user";
|
||||||
home = "/home/ftp";
|
home = "/home/ftp";
|
||||||
}
|
};
|
||||||
]
|
|
||||||
else
|
|
||||||
[]);
|
|
||||||
|
|
||||||
job = "
|
extraGroups = [
|
||||||
description \"vsftpd server\"
|
{ name = "ftp";
|
||||||
|
gid = (import ../system/ids.nix).gids.ftp;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
extraJobs = [{
|
||||||
|
name = "vsftpd";
|
||||||
|
|
||||||
|
job = ''
|
||||||
|
description "vsftpd server"
|
||||||
|
|
||||||
start on network-interfaces/started
|
start on network-interfaces/started
|
||||||
stop on network-interfaces/stop
|
stop on network-interfaces/stop
|
||||||
|
|
||||||
start script
|
start script
|
||||||
cat > /etc/vsftpd.conf <<EOF
|
cat > /etc/vsftpd.conf <<EOF
|
||||||
" +
|
${yesNoOption anonymousUser "anonymous_enable"}
|
||||||
(if anonymousUser then
|
${yesNoOption writeEnable "write_enable"}
|
||||||
"anonymous_enable=YES"
|
${yesNoOption anonymousUploadEnable "anon_upload_enable"}
|
||||||
else
|
${yesNoOption anonymousMkdirEnable "anon_mkdir_write_enable"}
|
||||||
"anonymous_enable=NO") +
|
|
||||||
(if writeEnable then
|
|
||||||
"
|
|
||||||
write_enable=YES"
|
|
||||||
else
|
|
||||||
"
|
|
||||||
write_enable=NO"
|
|
||||||
) +
|
|
||||||
(if anonymousUploadEnable then
|
|
||||||
"
|
|
||||||
anon_upload_enable=YES"
|
|
||||||
else
|
|
||||||
"
|
|
||||||
anon_upload_enable=NO"
|
|
||||||
) +
|
|
||||||
(if anonymousMkdirEnable then
|
|
||||||
"
|
|
||||||
anon_mkdir_write_enable=YES"
|
|
||||||
else
|
|
||||||
"
|
|
||||||
anon_mkdir_write_enable=NO"
|
|
||||||
) +
|
|
||||||
"
|
|
||||||
background=NO
|
background=NO
|
||||||
listen=YES
|
listen=YES
|
||||||
nopriv_user=vsftpd
|
nopriv_user=vsftpd
|
||||||
@ -75,6 +113,8 @@ EOF
|
|||||||
end script
|
end script
|
||||||
|
|
||||||
respawn ${vsftpd}/sbin/vsftpd /etc/vsftpd.conf
|
respawn ${vsftpd}/sbin/vsftpd /etc/vsftpd.conf
|
||||||
";
|
'';
|
||||||
|
|
||||||
|
}];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user