From 76897682c4d812da1343d427974ae221685f9467 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Thu, 7 Feb 2008 12:41:18 +0000 Subject: [PATCH] Added vsftpd upstart job svn path=/nixos/trunk/; revision=10540 --- system/ids.nix | 4 +++ system/options.nix | 17 +++++++++++- upstart-jobs/default.nix | 7 +++++ upstart-jobs/vsftpd.nix | 57 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 upstart-jobs/vsftpd.nix diff --git a/system/ids.nix b/system/ids.nix index abbd5c58c6ed..fd6ff9f6a15b 100644 --- a/system/ids.nix +++ b/system/ids.nix @@ -8,6 +8,8 @@ messagebus = 4; # D-Bus haldaemon = 5; nagios = 6; + vsftpd = 7; + ftp = 8; nixbld = 30000; # start of range of uids nobody = 65534; }; @@ -16,6 +18,8 @@ root = 0; wheel = 1; haldaemon = 5; + vsftpd = 7; + ftp = 8; audio = 17; users = 100; nixbld = 30000; diff --git a/system/options.nix b/system/options.nix index e449a036cad7..caa1ec4e19ce 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1365,7 +1365,22 @@ }; - + vsftpd = { + enable = mkOption { + default = false; + description = " + Whether to enable the vsftpd FTP server. + "; + }; + + anonymous_user = mkOption { + default = false; + description = " + Whether to enable the anonymous FTP user. + "; + }; + }; + printing = { enable = mkOption { diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index a926233afa03..83b363503380 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -218,6 +218,13 @@ let inherit config pkgs; }) + # VSFTPd server + ++ optional config.services.vsftpd.enable + (import ../upstart-jobs/vsftpd.nix { + inherit (pkgs) vsftpd; + inherit (config.services.vsftpd) anonymous_user; + }) + # X Font Server ++ optional config.services.xfs.enable (import ../upstart-jobs/xfs.nix { diff --git a/upstart-jobs/vsftpd.nix b/upstart-jobs/vsftpd.nix new file mode 100644 index 000000000000..adbc3f82e61b --- /dev/null +++ b/upstart-jobs/vsftpd.nix @@ -0,0 +1,57 @@ +{ vsftpd, anonymous_user }: + +{ + 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"; + } + ] ++ + (if anonymous_user then [ + { 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 <