]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/ftp/recipes/default.rb
civi ext version bump
[chef.git] / cookbooks / ftp / recipes / default.rb
index 58fc9c80b7d0f7114b3614489b417f5bbb281e26..9cd534a0b98d7022f9c43a845ceebcdd4d7121c5 100644 (file)
@@ -1,8 +1,8 @@
 #
-# Cookbook Name:: FTP
+# Cookbook:: FTP
 # Recipe:: default
 #
-# Copyright 2018, OpenStreetMap Foundation
+# Copyright:: 2018, OpenStreetMap Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # limitations under the License.
 #
 
-package "vsftpd"
+package %w[
+  vsftpd
+  libpam-pwdfile
+]
 
 template "/etc/vsftpd.conf" do
   source "vsftpd.conf.erb"
   owner "root"
   group "root"
-  mode 0o644
+  mode "644"
+end
+
+template "/etc/pam.d/vsftpd" do
+  source "pam-vsftpd.erb"
+  owner "root"
+  group "root"
+  mode "644"
 end
 
 service "vsftpd" do
-  action [:enable] # Do not start the service as config may be broken from failed chef run
+  action [:enable, :start]
   supports :status => true, :restart => true, :reload => true
   subscribes :restart, "template[/etc/vsftpd.conf]"
+  subscribes :restart, "template[/etc/pam.d/vsftpd]"
 end
 
 firewall_rule "accept-ftp-tcp" do
-  action :helper
-  source "net"
-  dest "fw"
-  proto "tcp"
+  action :accept
+  context :incoming
+  protocol :tcp
   dest_ports "ftp"
-  source_ports "-"
+  helper "ftp"
 end