Commit cbcd0285 authored by pcbaldwin's avatar pcbaldwin

Added systemd support and ClearOS 7 tuning

parent 6813a2f1
......@@ -5,7 +5,7 @@
/////////////////////////////////////////////////////////////////////////////
$app['basename'] = 'openvpn';
$app['version'] = '1.6.5';
$app['version'] = '2.0.0';
$app['release'] = '1';
$app['vendor'] = 'ClearFoundation';
$app['packager'] = 'ClearFoundation';
......
......@@ -5,10 +5,10 @@
if [ -e /etc/pki/CA/sys-0-cert.pem ]; then
logger -p local6.notice -t installer "app-openvpn-core - enabling OpenVPN server"
chkconfig openvpn on
chkconfig openvpn on >/dev/null 2>&1
logger -p local6.notice -t installer "app-openvpn-core - starting OpenVPN server"
service openvpn start
service openvpn start >/dev/null 2>&1
fi
# PAM check
......@@ -19,8 +19,9 @@ CONFIGS="/etc/openvpn/clients.conf /etc/openvpn/clients-tcp.conf"
for CONFIG in $CONFIGS; do
CHECK=`grep "^plugin[[:space:]].*openvpn-auth-pam.so" $CONFIG`
if [ -z "$CHECK" ]; then
# note: upgrade script will handle lib vs lib64 path
logger -p local6.notice -t installer "app-openvpn-core - adding plugin path"
echo "plugin /usr/lib/openvpn/plugin/lib/openvpn-auth-pam.so openvpn" >> $CONFIG
echo "plugin /usr/lib/openvpn/plugins/openvpn-plugin-auth-pam.so openvpn" >> $CONFIG
fi
done
......
......@@ -33,6 +33,17 @@ if [ -n "$CHECK" ]; then
sed -i -e 's/^key \/etc\/openvpn\/ssl\/server.key/key \/etc\/pki\/CA\/private\/sys-0-key.pem/' /etc/openvpn/clients.conf
fi
# Plugin file name change
#------------------------
for CONFIG in $CONFIGS; do
CHECKOLD=`grep "^plugin[[:space:]].*openvpn-auth-pam.so" $CONFIG`
if [ -n "$CHECKOLD" ]; then
logger -p local6.notice -t installer "app-openvpn-core - upgrading plugin path in $CONFIG"
sed -i -e "s/^plugin.*openvpn-auth-pam.so.*/plugin \/usr\/lib64\/openvpn\/plugins\/openvpn-plugin-auth-pam.so openvpn/" $CONFIG
fi
done
# Check arch for annoying lib64 path name in config file
#-------------------------------------------------------
......@@ -67,7 +78,7 @@ CHECK=`grep "^ifconfig-pool-persist /var/lib/openvpn/ipp.txt" /etc/openvpn/clien
if [ -n "$CHECK" ]; then
logger -p local6.notice -t installer "app-openvpn-core - updating ifconfig-pool-persist filename for TCP"
sed -i -e 's/^ifconfig-pool-persist \/var\/lib\/openvpn\/ipp.txt/ifconfig-pool-persist \/var\/lib\/openvpn\/ipp-tcp.txt/' /etc/openvpn/clients-tcp.conf
/sbin/service openvpn restart
/sbin/service openvpn restart >/dev/null 2>&1
fi
# Sync action: updates configuration using clearsync hook
......
......@@ -57,6 +57,7 @@ clearos_load_language('base');
use \clearos\apps\base\Daemon as Daemon;
use \clearos\apps\base\File as File;
use \clearos\apps\base\Folder as Folder;
use \clearos\apps\network\Domain as Domain;
use \clearos\apps\network\Hostname as Hostname;
use \clearos\apps\network\Iface_Manager as Iface_Manager;
......@@ -65,6 +66,7 @@ use \clearos\apps\network\Routes as Routes;
clearos_load_library('base/Daemon');
clearos_load_library('base/File');
clearos_load_library('base/Folder');
clearos_load_library('network/Domain');
clearos_load_library('network/Hostname');
clearos_load_library('network/Iface_Manager');
......@@ -110,6 +112,7 @@ class OpenVPN extends Daemon
const FILE_APP_CONFIG = '/etc/clearos/openvpn.conf';
const FILE_CLIENTS_CONFIG = '/etc/openvpn/clients.conf';
const FILE_CLIENTS_CONFIG_TCP = '/etc/openvpn/clients-tcp.conf';
const PATH_CONFIG = '/etc/openvpn';
const DEFAULT_PORT = 1194;
const DEFAULT_PROTOCOL = "udp";
const DEFAULT_DNS = '8.8.8.8';
......@@ -418,6 +421,31 @@ auth-user-pass
return $hostname->get_internet_hostname();
}
/**
* Returns list of systemd services.
*
* @return array list of systemd services
* @throws Engine_Exception
*/
public function get_systemd_services()
{
clearos_profile(__METHOD__, __LINE__);
$folder = new Folder(self::PATH_CONFIG);
$files = $folder->get_listing();
$services = array();
foreach ($files as $file) {
$matches = array();
if (preg_match('/(.*)\.conf$/', $file, $matches))
$services[] = '[email protected]' . $matches[1] . '.service';
}
return $services;
}
/**
* Returns WINS server pushed out to clients.
*
......
Name: app-openvpn
Epoch: 1
Version: 1.6.5
Version: 2.0.0
Release: 1%{dist}
Summary: OpenVPN
License: GPLv3
......
......@@ -19,7 +19,7 @@ persist-key
persist-tun
ifconfig-pool-persist /var/lib/openvpn/ipp-tcp.txt 120
status /var/lib/openvpn/openvpn-status.log
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
plugin /usr/lib64/openvpn/plugins/openvpn-plugin-auth-pam.so openvpn
verb 3
push "dhcp-option DNS 192.168.1.1"
push "dhcp-option WINS 192.168.1.1"
......
......@@ -20,7 +20,7 @@ persist-key
persist-tun
ifconfig-pool-persist /var/lib/openvpn/ipp.txt 120
status /var/lib/openvpn/openvpn-status.log
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
plugin /usr/lib64/openvpn/plugins/openvpn-plugin-auth-pam.so openvpn
verb 3
push "dhcp-option DNS 192.168.1.1"
push "dhcp-option WINS 192.168.1.1"
......
......@@ -19,9 +19,12 @@ clearos_load_language('openvpn');
// pid_file - openvpn utilizes multiple pid files
$configlet = array(
'title' => lang('openvpn_app_name'),
'package' => 'openvpn',
'process_name' => 'openvpn',
'reloadable' => FALSE,
'url' => '/app/openvpn'
'title' => lang('openvpn_app_name'),
'package' => 'openvpn',
'process_name' => 'openvpn',
'multiservice' => TRUE,
'api_class' => 'OpenVPN',
'api_namespace' => 'openvpn',
'reloadable' => FALSE,
'url' => '/app/openvpn'
);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment