abe openvpn timesift first release

This commit is contained in:
erkanisik
2021-05-10 14:54:38 +03:00
parent f73f51e77a
commit 33626f7ec4
20 changed files with 629 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file https://www.gnu.org/licenses/gpl-3.0.txt
from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
j = "--enable-ssl \
--enable-crypto \
--disable-static \
--disable-systemd \
--enable-iproute2 \
--disable-selinux \
--enable-password-save \
"
# this package needs a lot of work for init scripts etc.
#pisitools.cflags.add("-DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn\\\"")
#shelltools.export("CFLAGS", "%s -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn\\\"" % get.CFLAGS())
def setup():
autotools.configure(j)
def build():
autotools.make()
shelltools.cd("src/plugins/auth-pam")
autotools.make()
shelltools.cd("../down-root/")
autotools.make
shelltools.cd("..")
def check():
shelltools.system("./openvpn-test.sh")
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
for val in ["contrib", "sample/sample-config-files", "sample/sample-keys", "sample/sample-scripts"]:
pisitools.insinto("/%s/openvpn/%s" % (get.dataDIR(), val), "%s/*" % val)
pisitools.dodir("/etc/openvpn")
pisitools.dodir("/run/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/server.conf", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/client.conf", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/firewall.sh", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/xinetd-server-config", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/xinetd-client-config", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/loopback-server", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/loopback-client", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/openvpn-startup.sh", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-config-files/openvpn-shutdown.sh", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-keys/*.key", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-keys/*.crt", "/etc/openvpn")
pisitools.domove("/usr/share/openvpn/sample/sample-keys/*.pem", "/etc/openvpn")
pisitools.dodoc("COPYING", "COPYRIGHT.GPL", "README*")
@@ -0,0 +1,90 @@
from comar.service import *
import os
serviceType = "server"
serviceDefault = "off"
serviceDesc = _({"en": "OpenVPN",
"tr": "OpenVPN"})
OPENVPN = "/usr/sbin/openvpn"
PIDDIR = "/run/openvpn"
WORKDIR = "/etc/openvpn"
PIDFILE = ""
MSG_NOCONF = _({"en": "%s doesn't contain any OpenVPN configuration file." % WORKDIR,
"tr": "%s herhangi bir OpenVPN yapılandırma dosyası içermiyor." % WORKDIR,
})
@synchronized
def start():
# Load tun
os.system("modprobe -q tun")
# Run startup script if defined
if os.path.exists(os.path.join(WORKDIR, "openvpn-startup.sh")):
os.system(os.path.join(WORKDIR, "openvpn-startup.sh"))
configs = [_c for _c in os.listdir(WORKDIR) if _c.endswith(".conf")]
if len(configs) > 0:
# There's at least 1 OpenVPN configuration to start
# Start every .conf in WORKDIR and run .sh if it exists
for conf in configs:
conf_name = conf.split(".conf")[0]
sh_name = os.path.join(WORKDIR, "%s.sh" % conf_name)
PIDFILE = os.path.join(PIDDIR, "%s.pid" % conf_name)
if os.path.exists(sh_name):
os.system(sh_name)
# Clean stale pid files
if os.path.exists(PIDFILE):
os.unlink(PIDFILE)
startService(command=OPENVPN,
args="--daemon --writepid %s --config %s/%s --cd %s --script-security 2" % (PIDFILE, WORKDIR, conf, WORKDIR),
pidfile=PIDFILE,
donotify=True)
# Reset PIDFILE. This is a hack for status() calls from startService() problems..
PIDFILE = ""
else:
fail(MSG_NOCONF)
@synchronized
def stop():
for pidf in [pid for pid in os.listdir(PIDDIR) if pid.endswith(".pid")]:
stopService(pidfile="%s/%s" % (PIDDIR, pidf),
donotify=True)
try:
os.unlink(os.path.join(PIDDIR, pidf))
except OSError:
pass
# Run shutdown script if defined
if os.path.exists(os.path.join(WORKDIR, "openvpn-shutdown.sh")):
os.system(os.path.join(WORKDIR, "openvpn-shutdown.sh"))
@synchronized
def reload():
import signal
for pidf in [pid for pid in os.listdir(PIDDIR) if pid.endswith(".pid")]:
stopService(pidfile="%s/%s" % (PIDDIR, pidf),
signalno=signal.SIGHUP,
donotify=True)
def status():
if PIDFILE:
return isServiceRunning(pidfile=PIDFILE)
else:
state = False
for pidf in [pid for pid in os.listdir(PIDDIR) if pid.endswith(".pid")]:
PIDFILE = os.path.join(PIDDIR, pidf)
state = state and isServiceRunning(pidfile=PIDFILE)
return state
@@ -0,0 +1,25 @@
#!/bin/bash
# Test Crypto:
./openvpn --genkey --secret key
./openvpn --test-crypto --secret key
# Randomize ports for tests to avoid conflicts on the build servers.
cport=$[ 50000 + ($RANDOM % 15534) ]
sport=$[ $cport + 1 ]
sed -e 's/^\(rport\) .*$/\1 '$sport'/' \
-e 's/^\(lport\) .*$/\1 '$cport'/' \
< sample-config-files/loopback-client \
> tmp-loopback-client
sed -e 's/^\(rport\) .*$/\1 '$cport'/' \
-e 's/^\(lport\) .*$/\1 '$sport'/' \
< sample-config-files/loopback-server \
> tmp-loopback-server
# Test SSL/TLS negotiations (runs for 2 minutes):
./openvpn --config tmp-loopback-client &
./openvpn --config tmp-loopback-server
wait
rm -f tmp-loopback-client tmp-loopback-server
@@ -0,0 +1,10 @@
--- socket.c.orig 2010-01-14 16:26:16.880369350 +0200
+++ socket.c 2010-01-14 16:26:26.359374160 +0200
@@ -22,6 +22,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _GNU_SOURCE
#include "syshead.h"
#include "socket.h"
@@ -0,0 +1,17 @@
--- easy-rsa/2.0/openssl.cnf.orig 2010-01-14 16:27:51.977369194 +0200
+++ easy-rsa/2.0/openssl.cnf 2010-01-14 16:29:54.090381299 +0200
@@ -283,9 +283,9 @@
#pkcs11 = pkcs11_section
[ pkcs11_section ]
-engine_id = pkcs11
-dynamic_path = /usr/lib/engines/engine_pkcs11.so
-MODULE_PATH = $ENV::PKCS11_MODULE_PATH
-PIN = $ENV::PKCS11_PIN
-init = 0
+#engine_id = pkcs11
+#dynamic_path = /usr/lib/engines/engine_pkcs11.so
+#MODULE_PATH = $ENV::PKCS11_MODULE_PATH
+#PIN = $ENV::PKCS11_PIN
+#init = 0
@@ -0,0 +1,38 @@
#########################################
# Sample client-side OpenVPN config file
# for connecting to multi-client server.
#
# Adapted from http://openvpn.sourceforge.net/20notes.html
#
# The server can be pinged at 10.8.0.1.
#
# This configuration can be used by multiple
# clients, however each client should have
# its own cert and key files.
#
# tun-style tunnel
port 1194
dev tun
remote [my server hostname or IP address]
# TLS parms
tls-client
ca sample-keys/tmp-ca.crt
cert sample-keys/client.crt
key sample-keys/client.key
# This parm is required for connecting
# to a multi-client server. It tells
# the client to accept options which
# the server pushes to us.
pull
# Scripts can be used to do various
# things (change nameservers, for
# example.
#up scripts/ifup-post
#down scripts/ifdown-post
verb 4
@@ -0,0 +1,67 @@
########################################
# Sample OpenVPN config file for
# 2.0-style multi-client udp server
#
# Adapted from http://openvpn.sourceforge.net/20notes.html
#
# tun-style tunnel
port 1194
dev tun
# Use "local" to set the source address on multi-homed hosts
#local [IP address]
# TLS parms
tls-server
ca sample-keys/tmp-ca.crt
cert sample-keys/server.crt
key sample-keys/server.key
dh sample-keys/dh1024.pem
# Tell OpenVPN to be a multi-client udp server
mode server
# The server's virtual endpoints
ifconfig 10.8.0.1 10.8.0.2
# Pool of /30 subnets to be allocated to clients.
# When a client connects, an --ifconfig command
# will be automatically generated and pushed back to
# the client.
ifconfig-pool 10.8.0.4 10.8.0.255
# Push route to client to bind it to our local
# virtual endpoint.
push "route 10.8.0.1 255.255.255.255"
# Push any routes the client needs to get in
# to the local network.
push "route 192.168.0.0 255.255.255.0"
# Push DHCP options to Windows clients.
push "dhcp-option DOMAIN example.com"
push "dhcp-option DNS 192.168.0.1"
push "dhcp-option WINS 192.168.0.1"
# Client should attempt reconnection on link
# failure.
keepalive 10 60
# Delete client instances after some period
# of inactivity.
inactive 600
# Route the --ifconfig pool range into the
# OpenVPN server.
route 10.8.0.0 255.255.255.0
# The server doesn't need privileges
user openvpn
group openvpn
# Keep TUN devices and keys open across restarts.
persist-tun
persist-key
verb 4
@@ -0,0 +1 @@
d /run/openvpn 0755 root root
+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "https://pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>openvpn</Name>
<Homepage>https://openvpn.net/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>GPLv2</License>
<IsA>service</IsA>
<PartOf>network.connection</PartOf>
<Summary>A full featured SSL VPN solution</Summary>
<Description>OpenVPN is a full-featured SSL VPN solution which can accomodate a wide range of configurations, including remote access, site-to-site VPNs, WiFi security, and enterprise-scale remote access solutions with load balancing, failover, and fine-grained access-controls.</Description>
<Archive sha1sum="95953448917005845e8d3586f93cd5291a0730b6" type="tarxz">https://swupdate.openvpn.org/community/releases/openvpn-2.5.2.tar.xz</Archive>
<AdditionalFiles>
<AdditionalFile permission="0755" target="openvpn-test.sh">openvpn-test.sh</AdditionalFile>
</AdditionalFiles>
<BuildDependencies>
<Dependency>git</Dependency>
<Dependency>cmake</Dependency>
<Dependency>iproute2</Dependency>
<Dependency>pam-devel</Dependency>
<Dependency>lz4-devel</Dependency>
<Dependency>lzo-devel</Dependency>
<Dependency>openssl-devel</Dependency>
<Dependency>p11-kit-devel</Dependency>
</BuildDependencies>
</Source>
<Package>
<Name>openvpn</Name>
<Summary>A full featured SSL VPN solution</Summary>
<RuntimeDependencies>
<Dependency>lzo</Dependency>
<Dependency>lz4</Dependency>
<Dependency>pam</Dependency>
<Dependency>openssl</Dependency>
<Dependency>p11-kit</Dependency>
<Dependency>iproute2</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib</Path>
<Path fileType="data">/run/openvpn</Path>
<Path fileType="man">/usr/share/man</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="config">/etc/openvpn</Path>
<Path fileType="header">/usr/include</Path>
<Path fileType="executable">/usr/sbin</Path>
<Path fileType="data">/usr/share/openvpn</Path>
<Path fileType="config">/usr/lib/tmpfiles.d/openvpn.conf</Path>
</Files>
<AdditionalFiles>
<AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/openvpn.conf">tmpfiles.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/usr/share/openvpn/sample-config-files/roadwarrior-client.conf">roadwarrior-client.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/usr/share/openvpn/sample-config-files/roadwarrior-server.conf">roadwarrior-server.conf</AdditionalFile>
</AdditionalFiles>
<Provides>
<COMAR script="service.py">System.Service</COMAR>
</Provides>
</Package>
<History>
<Update release="1">
<Date>2021-05-10</Date>
<Version>2.5.2</Version>
<Comment>First release</Comment>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>openvpn</Name>
<Summary xml:lang="tr">Sanal özel ağ çözümü</Summary>
<Description xml:lang="tr">OpenVPN uzaktan bağlantı, kablosuz bağlantı güvenliği gibi konularda çok geniş ayarlar içeren bir sanal özel ağ (VPN) çözümüdür.</Description>
</Source>
</PISI>