Question

VSFTPD hardening

Asked by: mxrider_420

Hi,
I have a VSFTPD server, i understand how to chroot users and allow and deny users. but my question or senerio is unique. here is what i am curious to see about.

I want to have certain users be FORCED to use AUTH SSL, SFTP or other secure certificate passing protocol when loggin into my server, and others i want to soley grant straight old FTP unencrypted access to their home directory via chroot.
Our company needs to see if this is possible and if so how?... or do i have to jail a server and use jail#1 as FTP access and jail#2 for secure access ?  ohh and im using FreeBSD


any help is appreciated. thanks

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-08 at 10:50:37ID24715671
Tags

ftp

,

vsftpd

,

security

,

limiting directory

Topics

FTP Servers

,

FTP Software

,

Secure Socket Layer (SSL) & HTTPS

Participating Experts
1
Points
500
Comments
22

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. vsftpd 2.0.2
    Dear Experts, I am trying to setup a ftp server I have downloaded and installed vsftpd 2.0.2 for some reason when I tried to run /usr/local/sbin/vsftpd & it yielded the below error message: [root@magichands vsftpd-2.0.2]# 500 OOPS: vsftpd: not configured for standalone,...
  2. Setup vsftpd and ssh
    Dear Experts, I am currently trying to configure vsftpd and ssh. 1. vsftpd currently I can connect to the ftp server with my local username however I can't upload any files? Which variable in the vsftpd.conf do I need to enable? I want to run it in the stand alone mode 2...
  3. SSL certificate
    Hello, Can someone please explain the purpose of a SSL web server certificate. We are running 2003 SBS with about 10 users, and access our e-mail through OWA when we are out of the office, and our certificate has expired. I'm fairly new at all this and I'm not sure how impor...
  4. FreeBSD ipsec vpn routing in jails
    I have a ipsec/vpn on FreeBSD 6.3 from one master server to another server the one has multiple jails. each jail has is own public IP and i need to do something like this: vpn point >----------------------< master server with jails <-------> jail (75.76.78.80) 6...
  5. Assign FreeBSD Jail Multiple IP's
    Is it possible to assign a freebsd jail multiple ip's? I have it working fine when the jail has a single ip.... i can't seem to assign the jail two ips..... ideas?
  6. FreeBSD Jail Hardware Security
    Is it possible to limit what devices a FreeBSD jail has access to? I am specifically interested in limiting jail access to a tape drive (/dev/nsa1) and an autoloader (/dev/ch0). Thanks, Jay

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: giltjrPosted on 2009-09-09 at 04:27:39ID: 25290014

Unfortunately I'm fairly sure you can't do it solely based on user id.  The problem is that the user-id is not known until after the connection is made.  It like saying I want all people named Bill to use door#1 and everybody else to use door#2, but you don't ask their name until after they have already entered the door.

What you would need to do is run two ftp servers, one for non-encrypted access and one for encrypted access.  Then tell the users which one to use and only allow them to connect to the one you want them to access.

You can run two instances of vsftpd on the same server, but you will need to use either a unique IP address or a unique TCP port to separate the two.

 

by: mxrider_420Posted on 2009-09-09 at 05:42:54ID: 25290524

Is it possible to activate (without jails) the regular FTP server that comes with Free BSD and VSFTPD at the same time? ... also as it stands now on my vsftpd testing server it allows regular ftp access amonth other encrypted methods as well. if i do take the path you duggested by having two servers then id like to make VSFTPD use ONLY encrypted standards. currently i use core FTP to connect to it when testing and it does sucessefully pass my open SSL certificate. but how can i deny regular FTP to VSFTPD/ thanks

 

by: giltjrPosted on 2009-09-09 at 06:42:49ID: 25291122

You should be able to have both running at the same time, but you either need to be able to assign each one their own IP address or have them listen on a different command/control port (typically 21).

 

by: mxrider_420Posted on 2009-09-09 at 06:47:40ID: 25291181

with vsftpd the command/control/listen directives are specified in vsftpd.conf however im not sure how i can create different user lists that are chrooted depending on what server they use.  can you explain. or perhaps better yet elaborate on how i can block straight old fassioned ftp access on VSFTPD and force users to authenticate with sftp or https, auth ssl etc...

 

by: giltjrPosted on 2009-09-09 at 06:56:20ID: 25291316

You can review the options for the vsftpd.conf file, but to start with you can add/change:

ssl_enable=yes
force_local_data_ssl=yes
force_local_logins_ssl=yes

This will enable SSL and force all data transfers and logins to use SSL.   Now sftp (SSH FTP) is different from ftps (FTP SSL'ed)

 

by: mxrider_420Posted on 2009-09-09 at 07:25:07ID: 25291601

ok so i have added this in the vsftpd.conf file yet with core ftp i can still log in via FTP (keep in mind i havent installed regular ftp yet as discussed above)

thanks.

 

by: mxrider_420Posted on 2009-09-09 at 07:51:40ID: 25291889

sorry i think my last reply was vague,
i tried that and it still logs in as FTP. so before in install and configure anything other than my currently installed and running VSFTPD. i want to deny all non secure log ins.

thanks

 

by: giltjrPosted on 2009-09-09 at 08:21:17ID: 25292204

Did you stop and restart the vsftpd daemon?

How can you tell that it logged in as 'ftp'?  The only difference between ftp and ftp ssl is that all information being passed is encrypted.

 

by: mxrider_420Posted on 2009-09-09 at 08:29:17ID: 25292311

yes i restarted it. well the reason i know is with core FTP you can select what method to log in with. and when i select FTP is works. when i want the level of security as you said with the ssl encryption etc...

 

by: mxrider_420Posted on 2009-09-09 at 08:31:49ID: 25292341

ok so the encryption works. it says 530:Non-anon sessions MUST use encryption. thanks. is SFTP set up similarily?

your a great help!

 

by: mxrider_420Posted on 2009-09-09 at 08:37:45ID: 25292390

and finally back to the original question now that users need to use SSL is there a way to create a group or shell users that CAN log in via regular FTP (via vsftpd) this would just save alot of configuration of another FTP server/service or jailing etc...

 

by: giltjrPosted on 2009-09-09 at 10:22:19ID: 25293506

I will have to check, but I'm not sure the vsftpd supports sftp. sftp is normally provided by a ssh server that support sftp.  sftp is a ftp like enviroment that runs over ssh.  

I don't think, using a single vsftpd instance you can have  one set of users doing clear text ftp and another group of users using ftp ssl.

You would need to instances, one configured to force ssl and one configured not to use ssl at all.  They would need to be setup so that they had their own set of "ftpuser" files.

The "clear text" ftpuser file would list users that you want to allow using clear text.  The "ssl" ftpuser file would list users that you want to use ssl.

You can specify using local user file lists by doing:

userlist_enable=YES
userlist_file=/etc/vsftpd/userlist

So you would need two ".conf"  files, say vsftpdSSL.conf and vsftpdNON.conf.

In the vsftpSSL.conf you could have:

userlist_enable=YES
userlist_file=/etc/vsftpd/SSLUserlist

and in the vsftpdNON.conf you could have:

userlist_enable=YES
userlist_file=/etc/vsftpd/NONUserlist

In the NONUSer list you would specify all of the userid's that you want to allow clear text ftp sessions.  If they are not in this list, they can't login.

In the SSLUserlist you would specify all of the userids that you want to allow SSL.

 

by: mxrider_420Posted on 2009-09-09 at 10:45:00ID: 25293746

excellent response. thanks. This is kind of what i was assuming might need to be done. now my final question is if i create another .conf file do i need to specify somewhere else to look for the seconf .conf file?

 

by: giltjrPosted on 2009-09-09 at 11:09:06ID: 25293968

When you start the vsftpd instances you specify what configuration file to use.  Examples:

     vsftpd /etc/vsftpd/SSLvsftpd.conf
     vsftpd /etc/vsftpd/NONvsftpd.conf

 

by: mxrider_420Posted on 2009-09-09 at 11:40:23ID: 25294248

This is my vsftpdNON.conf file is this looking about the correct way:


# Example config file /usr/local/etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#listen_port=22
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=NO
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
#You may fully customise the login banner string:
ftpd_banner=Welcome to Foobar FTP.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_list_enable=YES
chroot_local_user=YES
#(default follows)
chroot_list_file=/usr/local/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty
#If using vsftpd in standalone mode, uncomment the next two lines:
#listen=NO
#background=YES
chroot_local_user=YES
userlist_enable=YES
userlist_deny=NO
#user_file=/usr/local/etc/vsftpd.user_list
ssl_enable=NO
allow_anon_ssl=NO
#force_local_data_ssl=NO
#force_local_logins_ssl=NO
#ssl_tlsv1=NO
#ssl_sslv2=NO
#ssl_sslv3=NO
#rsa_cert_file=/etc/vsftpd/privkey.pem
#require_ssl_reuse=NO
#force_local_data_ssl=yes
#force_local_logins_ssl=yes

 

by: giltjrPosted on 2009-09-09 at 19:50:30ID: 25297098

That looks good.

 

by: mxrider_420Posted on 2009-09-10 at 06:10:29ID: 25299761

excellent. so i guess all i need to do is configure different ports for each vsftpd install?  id assume there has to be some  kind of identification port based that allows the instances to identify which session is for which configuration. or i could use a virtual host?...

 

by: giltjrPosted on 2009-09-10 at 10:58:01ID: 25302685

Either different ports or each ftp service instances (daemon) needs to have its own IP address.

I personally like using unqiue IP addresses.  That way if I need to move a server function to another host, I don't need to update NAT tables or inform users, I just move the IP address that service was using to the new host.

 

by: mxrider_420Posted on 2009-09-10 at 11:07:27ID: 25302760

That makes sense. only thing is is if i use the IP address method would there be a way to create the server on the otside withonly 1IP address? because even with 1-1NAT id need to reserve another routable IP for the clients of each server. i guess the only work around is a FTP Proxy correct? ... wow that gets complicated fast. haha

 

by: mxrider_420Posted on 2009-09-10 at 11:08:20ID: 31626222

Expert was a true expert and provided feedback to all questions in a thorough manner.

Thanks

 

by: giltjrPosted on 2009-09-10 at 12:07:20ID: 25303246

If you only have a single public IP address, then you need to get into port forwarding, which means the customers/users need to know to ftp in "clear text" they need to use port "x" when logging on to the ftp server and the ftp ssl customers would need to know to use port "y" when logging on.

 

by: mxrider_420Posted on 2009-09-10 at 12:11:05ID: 25303276

as i assumed... thanks. you have been a great help!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...