alterator-vsftpd-0.10/000075500000000000000000000000001131272176500147365ustar00rootroot00000000000000alterator-vsftpd-0.10/Makefile000064400000000000000000000001721131272176500163760ustar00rootroot00000000000000NAME=vsftpd INSTALL=/usr/bin/install all: clean: install: install-module include /usr/share/alterator/build/module.mak alterator-vsftpd-0.10/applications/000075500000000000000000000000001131272176500174245ustar00rootroot00000000000000alterator-vsftpd-0.10/applications/vsftpd.desktop000064400000000000000000000003701131272176500223250ustar00rootroot00000000000000[Desktop Entry] Type=Application Categories=X-Alterator-Servers Icon=vsftpd Terminal=false Name=FTP server X-Alterator-URI=/vsftpd X-Alterator-UI=html X-Alterator-Help=vsftpd Name[ru]=FTP-сервер Name[pt_BR]=Servidor FTP Name[es]=Servidor FTP alterator-vsftpd-0.10/backend3/000075500000000000000000000000001131272176500164105ustar00rootroot00000000000000alterator-vsftpd-0.10/backend3/vsftpd000075500000000000000000000115331131272176500176470ustar00rootroot00000000000000#!/bin/sh alterator_api_version=1 ### variables MAIN_CONFIG_DIR=/etc/vsftpd USER_CONFIG_DIR=/etc/vsftpd/user_conf MAIN_CONFIG=$MAIN_CONFIG_DIR/conf UPLOAD_DIR=/var/ftp/incoming USER_CONFIG() { echo $USER_CONFIG_DIR/$1 } set -f . alterator-sh-functions . shell-config ### helper functions #get default param value #arg0: param-name default_param() { if [ "$1" = "anonymous_enable" ];then echo "YES" else echo "NO" fi } #read some parameter from config #arg0:config-name #arg1:param-name read_param() { [ -f "$1" ] || return 1 local retval="$(shell_config_get "$1" "$2")" [ -n "$retval" ] || retval="$(default_param "$2")" echo "$retval" } from_scm() { sed -r 's,#t,YES,;s,#f,NO,i' } to_string() { sed -r "s,YES,`_ "yes"`,;s,NO,`_ "no"`,;s,DEFAULT,`_ "default"`," } ### high level API ## main ftp settings read_settings() { ! LANG=C /sbin/chkconfig vsftpd --list|grep -qs 'on$' write_bool_param service_state "$?" write_bool_param anon_state "$(read_param "$MAIN_CONFIG" anonymous_enable)" write_bool_param anon_mkdir "$(read_param "$MAIN_CONFIG" anon_mkdir_write_enable)" write_bool_param anon_upload "$(read_param "$MAIN_CONFIG" anon_upload_enable)" ! [ -d "$UPLOAD_DIR" ] write_bool_param anon_upload_dir "$?" write_bool_param anon_other "$(read_param "$MAIN_CONFIG" anon_other_write_enable)" write_bool_param write_state "$(read_param "$MAIN_CONFIG" write_enable)" write_bool_param local_state "$(read_param "$MAIN_CONFIG" local_enable)" read_param "$MAIN_CONFIG" user_config_dir|grep -qs 'NO' write_bool_param local_detailed "$?" } write_settings() { [ -z "$in_anon_state" ] || shell_config_set "$MAIN_CONFIG" "anonymous_enable" "$(echo "$in_anon_state"|from_scm)" [ -z "$in_anon_mkdir" ] || shell_config_set "$MAIN_CONFIG" "anon_mkdir_write_enable" "$(echo "$in_anon_mkdir"|from_scm)" [ -z "$in_anon_upload" ] || shell_config_set "$MAIN_CONFIG" "anon_upload_enable" "$(echo "$in_anon_upload"|from_scm)" if test_bool "$in_anon_upload_dir"; then mkdir -p "$UPLOAD_DIR" >&2 chgrp vsftpd "$UPLOAD_DIR" >&2 chmod 02775 "$UPLOAD_DIR" else rmdir "$UPLOAD_DIR" >/dev/null 2>/dev/null fi [ -z "$in_anon_other" ] || shell_config_set "$MAIN_CONFIG" "anon_other_write_enable" "$(echo "$in_anon_other"|from_scm)" [ -z "$in_write_state" ] || shell_config_set "$MAIN_CONFIG" "write_enable" "$(echo "$in_write_state"|from_scm)" [ -z "$in_local_state" ] || shell_config_set "$MAIN_CONFIG" "local_enable" "$(echo "$in_local_state"|from_scm)" if test_bool "$in_local_detailed";then shell_config_set "$MAIN_CONFIG" "user_config_dir" "$USER_CONFIG_DIR" else shell_config_del "$MAIN_CONFIG" "user_config_dir" fi if test_bool "$in_service_state";then /sbin/chkconfig vsftpd on /sbin/chkconfig xinetd on /sbin/service xinetd start >&2 #chkconfig can stop xinetd else /sbin/chkconfig vsftpd off /sbin/service xinetd reload >&2 #chkconfig can stop xinetd fi } ## users enable_user() { local IFS=';' [ -z "$in_user" ] || for i in $in_user;do shell_config_set "$(USER_CONFIG "$i")" "write_enable" "YES" done } disable_user() { local IFS=';' [ -z "$in_user" ] || for i in $in_user;do shell_config_set "$(USER_CONFIG "$i")" "write_enable" "NO" done } add_user() { [ -n "$in_new_user" ] || return 0 local path="$(USER_CONFIG "$in_new_user")" if [ -f "$path" ];then write_error "`_ "Same user already exists"`" else shell_config_set "$path" "write_enable" "YES" fi } delete_user() { local IFS=';' [ -z "$in_user" ] || for i in $in_user;do rm -f -- "$(USER_CONFIG "$i")" done } list_user() { find "$USER_CONFIG_DIR" -mindepth 1 -maxdepth 1 -type f | while read name;do local name=${name##*/} write_table_item \ name "$name" \ user_state "$(read_param "$(USER_CONFIG "$name")" "write_enable"|to_string)" #" done } list_avail_user() { local UID_MIN="$(grep -s ^UID_MIN /etc/login.defs |awk '{print $2;exit}')" [ -n "$UID_MIN" ] || UID_MIN=500 local installed="$(mktemp -t installed.XXXXXX)" find "$USER_CONFIG_DIR" -mindepth 1 -maxdepth 1 -type f -printf '%f\n' | sort >"$installed" getent passwd | awk -F: -v "uid_min=$UID_MIN" '$3>=uid_min && $1!="root" && $7!="/dev/null"{print $1}'| sort | comm -23 - "$installed" | write_enum rm -f -- "$installed" } list_action() { write_enum_item "enable_user" "`_ "enable write access"`" write_enum_item "disable_user" "`_ "disable write access"`" write_enum_item "delete_user" "`_ "remove from list"`" } alterator_export_proc enable_user alterator_export_proc disable_user alterator_export_proc add_user alterator_export_proc delete_user alterator_export_proc list_user alterator_export_proc list_avail_user alterator_export_proc list_action alterator_export_proc read_settings alterator_export_proc write_settings message_loop alterator-vsftpd-0.10/ui/000075500000000000000000000000001131272176500153535ustar00rootroot00000000000000alterator-vsftpd-0.10/ui/vsftpd/000075500000000000000000000000001131272176500166615ustar00rootroot00000000000000alterator-vsftpd-0.10/ui/vsftpd/ajax.scm000064400000000000000000000055231131272176500203150ustar00rootroot00000000000000(define-module (ui vsftpd ajax) :use-module (srfi srfi-1) :use-module (alterator ajax) :use-module (alterator effect) :use-module (alterator woo) :export (init)) (define (ui-users-list) (form-update-enum "user" (woo-call "/vsftpd/list_user" 'language (form-value "language"))) (form-update-enum "new_user" (woo-call "/vsftpd/list_avail_user" 'language (form-value "language")))) (define (ui-users-new) (catch/message (lambda() (let ((new_user (form-value "new_user"))) (and (string? new_user) (begin (woo-call "/vsftpd/add_user" 'new_user new_user 'language (form-value "language")) (ui-users-list))))))) (define (ui-users-write) (catch/message (lambda() (let ((user (form-value "user")) (action (form-value "user_action"))) (and (string? user) (string? action) (begin (woo-call (string-append "/vsftpd/" action) 'user user) (ui-users-list))))))) (define *parameters* '("service_state" "anon_state" "write_state" "local_state" "local_detailed" "anon_mkdir" "anon_upload" "anon_upload_dir" "anon_other")) (define (ui-read) (catch/message (lambda() (form-update-value-list *parameters* (woo-call "/vsftpd/read_settings")) (update-effect)))) (define (ui-write) (catch/message (lambda() ;;note: (form-value-list) filters available paremeters, but checkbox values ;; absent in html request when widget was not selected (apply woo-call "/vsftpd/write_settings" (fold (lambda(x rest) (cons* (string->symbol x) (form-value x) rest)) '() *parameters*)) (ui-read)))) (define (init) ;; effects (effect-disable "anon_upload" "write_state" #f) (effect-disable "anon_upload_dir" "write_state" #f) (effect-disable "anon_mkdir" "write_state" #f) (effect-disable "anon_other" "write_state" #f) (effect-disable "anon_mkdir" "anon_state" #f) (effect-disable "anon_upload" "anon_state" #f) (effect-disable "anon_other" "anon_state" #f) (effect-disable "anon_upload_dir" "anon_upload" #f) (effect-disable "anon_state" "service_state" #f) (effect-disable "anon_mkdir" "service_state" #f) (effect-disable "anon_upload" "service_state" #f) (effect-disable "anon_other" "service_state" #f) (effect-disable "write_state" "service_state" #f) (effect-disable "local_state" "service_state" #f) (effect-disable "local_detailed" "service_state" #f) (init-effect) ;; lists (form-update-enum "user_action" (woo-call "/vsftpd/list_action" 'language (form-value "language"))) (ui-users-list) (ui-read) ;; buttons (form-bind "new_user_button" "click" ui-users-new) (form-bind "write_user_button" "click" ui-users-write) (form-bind "apply" "click" ui-write) (form-bind "reset" "click" ui-read)) alterator-vsftpd-0.10/ui/vsftpd/index.html000064400000000000000000000055371131272176500206700ustar00rootroot00000000000000

General options

Enable FTP service
Allow write
Allow anonymous login
Allow local users login
Enable per user settings

Anonymous user write options

Allow mkdir
Allow upload
Default upload directory (/var/ftp/incoming)
Allow rename/delete




Local users settings

User Write access
For selected:
Add user: