OpenVPN не спрашивающий пароль
Есть у меня 1 сервак с SuSE Linux Enterprise Server 11 на борту, не надоедливый в принципе, стоит в углу и пылится мирно мограя лампочками. На серваке завязано несколько шифрованых соединений - OpenVPN, IPSec, и иже с ними. Так вот, последнее время участились случаи отключения электричества (причем света не бывает подолгу) сервак частенько перезапускается, а при запуске не стартовал OpenVPN, так как нужно было ввести пароль защищенного ключа сертификата. Ключ есть только у меня, консолью (в частности ssh) из всего офисного контингента юмею пользоваться только я, ну и соответственно в конце концов меня достало каждый раз лезть удаленно на сервак, запускать службу и вводить ее пароль.По совету человека обслуживающего VPN-сервер, с которым соединяется мой сервак я создал файл с паролем в папке с конфигой vpn:
Код: Выделить всё
# touch /etc/openvpn/pass
# cat > /etc/openvpn/pass
secret
(Ctrl+D)
Код: Выделить всё
# mcedit /etc/openvpn/client.conf
client
dev tap
proto tcp
remote server.vpn 4443
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/keys/CA.crt
cert /etc/openvpn/keys/client.crt
key /etc/openvpn/keys/client.key
comp-lzo
verb 3
askpass /etc/openvpn/pass
Код: Выделить всё
# service openvpn start
Код: Выделить всё
Jan 11 10:16:47 sms openvpn[21429]: OpenVPN 2.1.1 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Jul 5 2010
Jan 11 10:16:47 sms openvpn[21429]: Sorry, 'Private Key' password cannot be read from a file
Jan 11 10:16:47 sms openvpn[21429]: Exiting
Качаем и распаковываем тарболл:
Код: Выделить всё
# wget http://swupdate.openvpn.net/community/releases/openvpn-2.1.4.tar.gz
# tar -xvf openvpn-2.1.4.tar.gz
# cd openvpn-2.1.4
Код: Выделить всё
# ./configure --help
`configure' configures OpenVPN 2.1.4 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/openvpn]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-lzo Disable LZO compression support
--disable-crypto Disable OpenSSL crypto support
--disable-ssl Disable OpenSSL SSL support for TLS-based key exchange
--disable-multi Disable client/server support (--mode server + client mode)
--disable-server Disable server support only (but retain client support)
--disable-plugins Disable plug-in support
--disable-management Disable management server support
--disable-pkcs11 Disable pkcs11 support
--disable-socks Disable Socks support
--disable-http Disable HTTP proxy support
--disable-fragment Disable internal fragmentation support (--fragment)
--disable-multihome Disable multi-homed UDP server support (--multihome)
--disable-port-share Disable TCP server port-share support (--port-share)
--disable-debug Disable debugging support (disable gremlin and verb 7+ messages)
--enable-small Enable smaller executable size (disable OCC, usage message, and verb 4 parm list)
--enable-pthread Enable pthread support (Experimental for OpenVPN 2.0)
--enable-password-save Allow --askpass and --auth-user-pass passwords to be read from a file
--enable-iproute2 Enable support for iproute2
--disable-def-auth Disable deferred authentication
--disable-pf Disable internal packet filter
--enable-strict Enable strict compiler warnings (debugging option)
--enable-pedantic Enable pedantic compiler warnings, will not generate a working executable (debugging option)
--enable-profiling Enable profiling (debugging option)
--enable-strict-options Enable strict options check between peers (debugging option)
--disable-selinux Disable SELinux support
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-cygwin-native Compile native win32
--with-ssl-headers=DIR Crypto/SSL Include files location
--with-ssl-lib=DIR Crypto/SSL Library location
--with-lzo-headers=DIR LZO Include files location
--with-lzo-lib=DIR LZO Library location
--with-pkcs11-helper-headers=DIR pkcs11-helper Include files location
--with-pkcs11-helper-lib=DIR pkcs11-helper Library location
--with-ifconfig-path=PATH Path to ifconfig tool
--with-iproute-path=PATH Path to iproute tool
--with-route-path=PATH Path to route tool
--with-mem-check=TYPE Build with debug memory checking, TYPE = dmalloc or valgrind
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
MAN2HTML man2html utility
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <openvpn-users@lists.sourceforge.net>.
Код: Выделить всё
# ./configure --prefix=/usr/local --bindir=/usr/local/bin --sysconfdir=/usr/local/etc/openvpn --sbindir=/usr/local/sbin --libdir=/usr/local/lib/openvpn --oldincludedir=/usr/local/include --build=i686-suse-linux --host=i686-suse-linux --enable-password-save
Код: Выделить всё
# zypper install liblzo-devel
Код: Выделить всё
# make && make install
Код: Выделить всё
# cp /etc/openvpn /usr/local/etc
Теперь надо заняться init-скриптом для его автозапуска. На всякий случай созраняю копию:
Код: Выделить всё
# cp /etc/init.d/openvpn /etc/init.d/openvpn.org
Код: Выделить всё
openvpn=/usr/sbin/openvpn
confdir=/etc/openvpn
Код: Выделить всё
openvpn=/usr/local/sbin/openvpn
confdir=/usr/local/etc/openvpn
Код: Выделить всё
# cervice openvpn start
Пришлось опять пересобирать, включив еще кое-какие опции ./configure и в итоге команда стала выглядеть так:
Код: Выделить всё
./configure --prefix=/usr/local --bindir=/usr/local/bin --sysconfdir=/usr/local/etc/openvpn --sbindir=/usr/local/sbin --libdir=/usr/local/lib/openvpn --oldincludedir=/usr/local/include --build=i686-suse-linux --host=i686-suse-linux --enable-password-save --with-ssl-headers=/usr/include/ssl --with-ssl-lib=/usr/lib --with-lzo-headers=/usr/include/lzo --with-lzo-lib=/usr/lib --with-ifconfig-path=/sbin/ifconfig --with-route-path=/sbin/route