#!/usr/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/proftpd-check-vusers - check proftpd virtual users # # Creation: 2019-09-13 ap # Last Update: $Id$ # # Copyright (c) 2019-2022 Ansgar Puester, ansgar.puester(at)freenet(dot)de # Copyright (c) 2024-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib proftpd_virtual_user_auth='/etc/proftpd/auth' proftpd_virtual_user_passwd="${proftpd_virtual_user_auth}/passwd" proftpd_virtual_user_group="${proftpd_virtual_user_auth}/group" # --------------------------------------------------------------------------- # check if console minium 80x24 # --------------------------------------------------------------------------- check_screensize case ${?} in 0) : # nothing to do ;; *) exit 1 ;; esac gotoyx() { echo -e "\033[$1;$2H\c"; } config_file='/etc/config.d/proftpd' . ${config_file} # --------------------------------------------------------------------------- # print header line # --------------------------------------------------------------------------- print_header_line() { techo --row ' ' --info 'User' --info 'Home' --info 'Home exists' --info 'Unix User' } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- clrhome mecho --info "Check ProFTPD virtual users" mecho techo --begin '2 19 35 14 10' print_header_line if [ ! ${PROFTPD_ENABLE_VIRTUAL_USERS} = 'yes' ] then mecho --error "ProFTPD virtual users are not enabled" mecho --error "no users are checked" techo --end echo anykey exit fi row=0 header_row=0 cat $proftpd_virtual_user_passwd | while read line do user=$(echo "$line" | cut -d: -f 1) uid=$(echo "$line" | cut -d: -f 3) gid=$(echo "$line" | cut -d: -f 4) home=$(echo "$line" | cut -d: -f 6) [ -d $home ] && hexists='yes' || hexists='no' if getent passwd "${user}" >/dev/null 2>&1 then pexists='yes' else pexists='no' fi techo --row ' ' "$user" "$home" "$hexists" "$pexists" row=$((${row} + 1)) header_row=$((${header_row} + 1)) refresh_screensize if [ ${_EISLIB_SCREENSIZE_Y} -lt $((${header_row} + 6)) ] then print_header_line header_row=0 fi done refresh_screensize echo echo echo echo techo --end gotoyx $((${_EISLIB_SCREENSIZE_Y} - 3)) 1 echo # set info line to screen is $row + 6 -gt $LINES if [ ${_EISLIB_SCREENSIZE_Y} -lt $((${row} + 6)) ] then mecho --info "Use SHIFT + PAGE-UP to scroll up" fi echo anykey # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------