L2TP/IPSec VPN client on Fedora

Standard

Follow the next steps to establish “road warrior” pre-shared secret L2TP VPN connection to remote VPN server (running RouterOS 5.24 in my case) from your Fedora system.

Install ipsec and l2tp packages.

$ yum install libreswan xl2tpd

Main IPSec configuration is located in /etc/ipsec.conf and /etc/ipsec.secrets. You can review it, but no changes are required to Fedora’s default that basically enables NAT traversal and includes /etc/ipsec.d/*.conf and /etc/ipsec.d/*.secrets files into the configuration.

Create new configuration file in /etc/ipsec.d/desired_vpn_name.conf with following content and replace connection name and local and remote IPs.

conn VPN_CONNECTION_NAME
 authby=secret
 pfs=no
 auto=add
 keyingtries=3
 dpddelay=30
 dpdtimeout=120
 dpdaction=clear
 rekey=yes
 ikelifetime=8h
 keylife=1h
 type=transport
 left=YOUR_LOCAL_IP_ADDRESS
 leftnexthop=%defaultroute
 leftprotoport=17/1701
 right=REMOTE_VPN_SERVER_IP_ADDRESS
 rightprotoport=17/1701

Create new secrets file in /etc/ipsec.d/desired_vpn_name.secrets with following content and replace remote server IP and pre-shared secret.

%any REMOTE_VPN_SERVER_IP_ADDRESS : PSK "YOUR-PRE-SHARED-SECRET"

Start IPSec daemon in foreground to ensure IPSec stack is in your kernel and testing your configuration later.

$ ipsec pluto --stderrlog --config /etc/ipsec.conf --nofork

If you find out following section in the output:

No Kernel XFRM/NETKEY interface detected
No Kernel KLIPS interface detected
No Kernel MASTKLIPS interface detected
Using 'no_kernel' interface code on 3.16.3-200.fc20.i686

it means there is no IPSec stack in your kernel and you have to load apropriate module into the kernel manually by:

$ modprobe af_key

If you have no IPSec stack in the kernel and continue you will get completely misleading error when trying to connect the tunnel.

022 "VPN_CONNECTION_NAME": We cannot identify ourselves with either end of this connection.

When everything is alright you should see just:

Using Linux XFRM/NETKEY IPsec interface code on 3.16.3-200.fc20.i686

Add your new connection by:

$ ipsec auto --add VPN_CONNECTION_NAME

Now configure L2TP part. Add a new section to /etc/xl2tpd/xl2tpd.conf and replace connection name and remote server IP.

[lac VPN_CONNECTION_NAME]
lns = REMOTE_VPN_SERVER_IP_ADDRESS
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd.VPN_CONNECTION_NAME
length bit = yes

And create new file /etc/ppp/options.xl2tpd.VPN_CONNECTION_NAME with your new PPP options and put there following configuration (replace username and password for authentication).

ipcp-accept-local
ipcp-accept-remote
refuse-eap
require-mschap-v2
noccp
noauth
idle 1800
mtu 1410
mru 1410
defaultroute
usepeerdns
debug
lock
connect-delay 5000
name AUTH_USERNAME
password AUTH_PASSWORD

Start all daemons and connect the tunnel

$ systemctl start ipsec
$ systemctl start xl2tpd
$ echo "c VPN_CONNECTION_NAME" > /var/run/xl2tpd/l2tp-control

To disconnect do

$ echo "d VPN_CONNECTION_NAME" > /var/run/xl2tpd/l2tp-control

Remind: if you successfully reached this point you have the tunnel only and you need to add your routes manually to access the networks behind the tunnel!

Broken Fedora 20 MariaDB/MySQL packages

Standard

Just tried to install MariaDB and later MySQL databases on Fedora 20, but could not start the server. The log file shows:


[root@localhost ~]# cat /var/log/mysqld.log
140108 15:11:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140108 15:11:19 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13)
140108 15:11:19 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
140108 15:11:19 [ERROR] Plugin 'Aria' init function returned error.
140108 15:11:19 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
140108 15:11:19 InnoDB: The InnoDB memory heap is disabled
140108 15:11:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140108 15:11:19 InnoDB: Compressed tables use zlib 1.2.8
140108 15:11:19 InnoDB: Using Linux native AIO
140108 15:11:19 InnoDB: Initializing buffer pool, size = 128.0M
140108 15:11:20 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
140108 15:11:20 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140108 15:11:20 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
140108 15:11:20 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
140108 15:11:20 InnoDB: Waiting for the background threads to start
140108 15:11:21 Percona XtraDB (http://www.percona.com) 5.5.34-MariaDB-31.1 started; log sequence number 0
140108 15:11:21 [Note] Plugin 'FEEDBACK' is disabled.
140108 15:11:21 [ERROR] mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
140108 15:11:21 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140108 15:11:21 [ERROR] Aria engine is not enabled or did not start. The Aria engine must be enabled to continue as mysqld was configured with --with-aria-tmp-tables
140108 15:11:21 [ERROR] Aborting

140108 15:11:21 InnoDB: Starting shutdown...
140108 15:11:22 InnoDB: Shutdown completed; log sequence number 1597945
140108 15:11:22 [Note] /usr/libexec/mysqld: Shutdown complete

140108 15:11:22 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
[root@localhost ~]#

The problem is mysql_install_db script in packages mariadb-server-5.5.34-2.fc20 and community-mysql-server-5.5.35-1.fc20 does not set up proper permissions on server data directory. Run following command under root to fix it:

chown -R mysql:mysql /var/lib/mysql