-1

ProFTPD module mod_sftp

I want to set up a file server with sftp and virtual account,so i use ProFTPD.

system info:red hat enterprise linux 6.8-x86_64

proftpd info:proftpd-1.3.6

OpenSSL 1.0.1e-fips 11 Feb 2013

error: openssl/rand.h: No such file or directory

what i do:

mkdir /usr/local/proftpd
mkdir /etc/proftpd
cd /usr/local/src
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.6.tar.gz
tar -zxvf proftpd-1.3.6.tar.gz 
cd /usr/local/src/proftpd-1.3.6    
./configure --prefix=/usr/local/proftpd --sysconfdir=/etc/proftpd --enable-openssl --with-modules=mod_sftp
make

ERROR INFO:

--------------
Build Summary
--------------
Building the following static modules:
  mod_ident
  mod_quotatab
  mod_quotatab_file
  mod_sftp
  mod_cap

--------------
[root@slave1 proftpd-1.3.6]# make && make install
echo \#define BUILD_STAMP \"`date +"%a %b %e %Y %H:%M:%S %Z"`\" > include/buildstamp.h
cd lib/ && make lib
make[1]: Entering directory `/usr/local/src/proftpd-1.3.6/lib'
gcc -DHAVE_CONFIG_H  -DLINUX  -I.. -I../include  -g2 -O2 -Wall -fno-omit-
........
gcc -DHAVE_CONFIG_H  -DLINUX  -I.. -I../include  -g2 -O2 -Wall -fno-omit-frame-pointer -c table.c
table.c:30:26: error: openssl/rand.h: No such file or directory
table.c: In function ‘tab_get_seed’:
table.c:366: warning: implicit declaration of function ‘RAND_bytes’
make[1]: *** [table.o] Error 1
make[1]: Leaving directory `/usr/local/src/proftpd-1.3.6/src'
make: *** [src] Error 2

Installation

The mod_sftp module is distributed with ProFTPD. For including mod_sftp as a staticly linked module, use:
  $ ./configure --enable-openssl --with-modules=mod_sftp ...
Alternatively, mod_sftp can be built as a DSO module:
  $ ./configure --enable-dso --enable-openssl --with-shared=mod_sftp ...
Then follow the usual steps:
  $ make
  $ make install
Note that if the libsodium library is available, mod_sftp will auto-detect this, which enables other supported algorithms. You can ensure that mod_sftp compiles with the libsodium library like so:
  $ ./configure --enable-openssl --with-modules=mod_sftp ... \
    --with-includes=/path/to/libsodium/include \
    --with-libraries=/path/to/libsodium/lib
B.Rabbit
  • 3
  • 1
  • 3
  • Before you run ProFTPD's `configure` script, you need to make sure the OpenSSL development libraries are installed, using _e.g._ `yum install openssl-dev`. Then you can run your `./configure` command, do a `make clean`, then `make` and `make install`. – Castaglia Jul 31 '17 at 00:25
  • Your answer is very helpful. Now I have a new problem.I need to install proftpd with mod_sftp:mod_sql:mod_sql_mysql – B.Rabbit Jul 31 '17 at 01:28
  • mod_sql is capable of using OpenSSL for different ways of encrypting passwords stored in database tables. http://www.proftpd.org/docs/howto/SQL.html – B.Rabbit Jul 31 '17 at 03:07
  • i can't find the mysql.h and libmysqlclient.a files for MySQL – B.Rabbit Jul 31 '17 at 03:08
  • You might try `yum install mysql-devel mysql-lib`, and then re-run `./configure`, `make clean`, `make`, and `make install`. – Castaglia Jul 31 '17 at 03:11
  • if i use rpm install MySQL,how can i get the directory of header files of MySQL(mysql.h),i wiil edit my question later – B.Rabbit Jul 31 '17 at 03:36
  • You are not _required_ to provide the location of those headers (using `--with-includes`); the ProFTPD build system is usually smart enough to find them, assuming a default install. – Castaglia Jul 31 '17 at 03:49
  • Maybe I need to put a new question, rather than edit this one. – B.Rabbit Jul 31 '17 at 03:49
  • Your answer is very clear and correct,Thanks a lot.It can be successfully compiled now.I forgot to install mysql-devel yet QAQ.... – B.Rabbit Jul 31 '17 at 06:00

1 Answers1

0

The ProFTPD mod_sftp module requires the OpenSSL library; this build error you encountered:

error: openssl/rand.h: No such file or directory

indicates that OpenSSL is not installed on your system.

Before you run ProFTPD's configure script, you need to make sure the OpenSSL development libraries are installed, using e.g.:

$ yum install openssl-dev

Then you can run your build commands for ProFTPD again:

$ ./configure ...
$ make clean
$ make
$ make install

Later, if you find you want to use the mod_sql and mod_sql_mysql modules, then you will need to install the MySQL libraries:

$ yum install mysql-devel mysql-lib

You are not required to provide the location of the MySQL headers (using --with-includes for the ProFTPD configure script); the ProFTPD build system is usually smart enough to find them, assuming a default install.

Putting this altogether, then:

$ mkdir /usr/local/proftpd
$ mkdir /etc/proftpd
$ cd /usr/local/src
$ yum install mysql-devel mysql-lib openssl-dev
$ wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.6.tar.gz
$ tar -zxvf proftpd-1.3.6.tar.gz 
$ cd /usr/local/src/proftpd-1.3.6    
$ ./configure --prefix=/usr/local/proftpd --sysconfdir=/etc/proftpd --enable-openssl --with-modules=mod_sftp:mod_sql:mod_sql_mysql
$ make
$ make install

Hope this helps!

Castaglia
  • 3,349
  • 3
  • 21
  • 42