fix: no need for unnecessary dependencies

fix(vsftpd): a few bugs
This commit is contained in:
Mahdi Dibaiee 2017-03-21 13:35:37 +03:30
parent 5550b17522
commit 46eaf3e4f6
6 changed files with 19 additions and 21 deletions

View File

@ -18,7 +18,6 @@ executable mongodb
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, data-default-class
, mtl
, mongoDB >= 2.1.1.1 && < 3
, bytestring
, text

View File

@ -18,5 +18,4 @@ executable mysql
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, data-default-class
, mtl
, mysql >= 0.1.4 && < 1

View File

@ -19,6 +19,4 @@ executable nginx
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, data-default-class
, monad-control
, mtl
, free

View File

@ -18,4 +18,3 @@ executable vsftpd
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, data-default-class
, mtl

View File

@ -14,7 +14,7 @@ module Main (call, main) where
import Control.Monad.Free
import Data.List
import Data.Either
import Control.Monad.State
import Control.Monad.State hiding (liftIO)
call :: Service -> App ()
@ -33,10 +33,13 @@ module Main (call, main) where
(Right opensslResponse) <- execute "openssl" ["passwd", "-1", pass] "" True
let encryptedPassword = head . lines $ opensslResponse
executeRoot "useradd" [user, "-d", directory, "-G", "ftp", "-p", encryptedPassword] "" True
executeRoot "groupadd" ["-f", "ftp"] "" False
executeRoot "useradd" [user, "-d", directory, "-G", "ftp", "-p", encryptedPassword] "" False
liftIO $ do
renameFileIfMissing original (original ++ ".backup")
execIfExists original $ do
renameFileIfMissing original (original ++ ".backup")
writeFile original content
writeFile userList user

View File

@ -35,21 +35,21 @@ module Types ( FileSharingParams (..)
, anonymousWrite = False
, recreateUser = False
}
instance Show FileSharingParams where
show (FileSharingParams { directory, user, pass, port, writable, anonymous, anonymousWrite }) =
let boolToEnglish True = "YES"
boolToEnglish False = "NO"
in
keyvalue [ ("anonymous_enable", boolToEnglish anonymous)
, ("write_enable", boolToEnglish writable)
, ("allow_writeable_chroot", boolToEnglish writable)
, ("anon_upload_enable", boolToEnglish anonymousWrite)
, ("anon_mkdir_write_enable", boolToEnglish anonymousWrite)
, ("listen", "YES")
, ("userlist_enable", "YES")
, ("userlist_file", "/etc/vsftpd-serverman-user-list")
, ("userlist_deny", "NO")
, ("chroot_local_user", "YES")
, ("xferlog_enable", "YES")
, ("local_enable", "YES")] "="
, ("write_enable", boolToEnglish writable)
, ("allow_writeable_chroot", boolToEnglish writable)
, ("anon_upload_enable", boolToEnglish anonymousWrite)
, ("anon_mkdir_write_enable", boolToEnglish anonymousWrite)
, ("listen", "YES")
, ("userlist_enable", "YES")
, ("userlist_file", "/etc/vsftpd-serverman-user-list")
, ("userlist_deny", "NO")
, ("local_root", directory)
, ("xferlog_enable", "YES")
, ("local_enable", "YES")
, ("pam_service_name", "ftp")] "="