diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cbb3a13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.rpm
+*.log
+*spec-20*
+*.tar.gz
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b1d778a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+# Makefile for source rpm: smeserver-libreswan-xl2tpd
+# $Id: Makefile,v 1.1 2021/02/22 16:04:02 brianr Exp $
+NAME := smeserver-libreswan-xl2tpd
+SPECFILE = $(firstword $(wildcard *.spec))
+
+define find-makefile-common
+for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
+endef
+
+MAKEFILE_COMMON := $(shell $(find-makefile-common))
+
+ifeq ($(MAKEFILE_COMMON),)
+# attept a checkout
+define checkout-makefile-common
+test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
+endef
+
+MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
+endif
+
+include $(MAKEFILE_COMMON)
diff --git a/README.md b/README.md
index d96d3a4..6eacbc6 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,16 @@
-# smeserver-libreswan-xl2tpd
+# smeserver-libreswan-xl2tpd
-SMEServer Koozali developed git repo for smeserver-libreswan-xl2tpd smecontribs
\ No newline at end of file
+SMEServer Koozali developed git repo for smeserver-libreswan-xl2tpd smecontribs
+
+## Wiki
+
https://wiki.koozali.org/Libreswan-xl2tpd
+
https://wiki.koozali.org/Smeserver-libreswan-xl2tpd
+
+## Bugzilla
+Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-libreswan-xl2tpd&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
+
+## Description
+
+
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
+*Once it has been checked, then this comment will be deleted*
+
diff --git a/additional/COPYING b/additional/COPYING
new file mode 100644
index 0000000..eeb586b
--- /dev/null
+++ b/additional/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C) 19yy
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/contriborbase b/contriborbase
new file mode 100644
index 0000000..9b7fd51
--- /dev/null
+++ b/contriborbase
@@ -0,0 +1 @@
+contribs10
diff --git a/createlinks b/createlinks
new file mode 100644
index 0000000..9fd2d58
--- /dev/null
+++ b/createlinks
@@ -0,0 +1,103 @@
+#! /usr/bin/perl -w
+
+# Need some thought on when the templates should be expanded and when the action should be called.
+
+# Need to
+
+# On ipsec-update expand xl2tpd.conf & secrets
+
+# Need to stop xl2tpd if disabled. Key ?
+
+use esmith::Build::CreateLinks qw(:all);
+
+# our event specific for updating with yum without reboot
+$event = "smeserver-libreswan-xl2tpd-update";
+#add here the path to your templates needed to expand
+#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
+
+foreach my $file (qw(
+ /etc/systemd/system-preset/49-koozali.preset
+))
+{
+ templates2events( $file, $event );
+}
+
+#action needed in case we have a systemd unit
+event_link("systemd-default", $event, "10");
+event_link("systemd-reload", $event, "50");
+
+#action specific to this package
+event_link("ip-up.xl2tpd", $event, "60");
+
+#services we need to restart
+safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/xl2tpd");
+
+#--------------------------------------------------
+# templates for events
+#--------------------------------------------------
+
+foreach (
+ qw(
+ /etc/pam.d/ppp
+ /etc/ppp/ip-up.local
+ /etc/ppp/options.xl2tpd
+ /etc/ppp/pap-secrets
+ /etc/xl2tpd/xl2tpd.conf
+ /etc/sysconfig/modules/ip_xl2tpd.modules
+ )
+ ) {
+ templates2events(
+ "$_", qw(
+ post-upgrade
+ console-save
+ bootstrap-console-save
+ remoteaccess-update
+ ipsec-update
+ )
+ );
+}
+
+#--------------------------------------------------
+# actions for ipsec-update event
+#--------------------------------------------------
+
+my $eventIpsec = "ipsec-update";
+
+#--------------------------------------------------
+# actions for ip-up.xl2tpd event
+#--------------------------------------------------
+
+my $eventXl2tpd = "ip-up.xl2tpd";
+safe_symlink( "adjust", "root/etc/e-smith/events/$eventXl2tpd/services2adjust/masq" );
+event_link( "xl2tpd-interface-access", $eventXl2tpd, "70" );
+
+# Runlevel init links.
+#service_link_enhanced( "xl2tpd", "S95", "7" );
+#service_link_enhanced( "xl2tpd", "K21", "6" );
+#service_link_enhanced( "xl2tpd", "K21", "0" );
+#service_link_enhanced( "xl2tpd", "K21", "1" );
+
+# On ip-up.xl2tpd expand and restart masq
+
+foreach (
+ qw(
+ /etc/rc.d/init.d/masq
+ )
+ ) {
+ templates2events(
+ "$_", qw(
+ ip-up.xl2tpd
+ )
+ );
+}
+
+
+#--------------------------------------------------
+# actions for ip-up.xl2tpd event
+# On ip-down clear the interface
+# masq gets restarted anyway via existing event
+#--------------------------------------------------
+
+my $eventXl2tpd = "ip-down";
+
+event_link( "xl2tpd-interface-access", $eventXl2tpd, "70" );
diff --git a/root/etc/e-smith/db/configuration/defaults/xl2tpd/UDPPort b/root/etc/e-smith/db/configuration/defaults/xl2tpd/UDPPort
new file mode 100644
index 0000000..3a2ac0e
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/xl2tpd/UDPPort
@@ -0,0 +1 @@
+1701
\ No newline at end of file
diff --git a/root/etc/e-smith/db/configuration/defaults/xl2tpd/access b/root/etc/e-smith/db/configuration/defaults/xl2tpd/access
new file mode 100644
index 0000000..c8c6761
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/xl2tpd/access
@@ -0,0 +1 @@
+private
\ No newline at end of file
diff --git a/root/etc/e-smith/db/configuration/defaults/xl2tpd/status b/root/etc/e-smith/db/configuration/defaults/xl2tpd/status
new file mode 100644
index 0000000..87e7bda
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/xl2tpd/status
@@ -0,0 +1 @@
+disabled
\ No newline at end of file
diff --git a/root/etc/e-smith/db/configuration/defaults/xl2tpd/type b/root/etc/e-smith/db/configuration/defaults/xl2tpd/type
new file mode 100644
index 0000000..ce93fac
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/xl2tpd/type
@@ -0,0 +1 @@
+service
\ No newline at end of file
diff --git a/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/connectiontype b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/connectiontype
new file mode 100644
index 0000000..62c4730
--- /dev/null
+++ b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/connectiontype
@@ -0,0 +1 @@
+transport
diff --git a/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpdaction b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpdaction
new file mode 100644
index 0000000..9c7d34f
--- /dev/null
+++ b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpdaction
@@ -0,0 +1 @@
+clear
\ No newline at end of file
diff --git a/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpddelay b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpddelay
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpddelay
@@ -0,0 +1 @@
+10
diff --git a/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpdtimeout b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpdtimeout
new file mode 100644
index 0000000..d61f00d
--- /dev/null
+++ b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/dpdtimeout
@@ -0,0 +1 @@
+90
diff --git a/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/status b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/status
new file mode 100644
index 0000000..87e7bda
--- /dev/null
+++ b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/status
@@ -0,0 +1 @@
+disabled
\ No newline at end of file
diff --git a/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/type b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/type
new file mode 100644
index 0000000..8da4e8d
--- /dev/null
+++ b/root/etc/e-smith/db/ipsec_connections/defaults/L2TPD-PSK/type
@@ -0,0 +1 @@
+xl2tpd
\ No newline at end of file
diff --git a/root/etc/e-smith/events/actions/xl2tpd-interface-access b/root/etc/e-smith/events/actions/xl2tpd-interface-access
new file mode 100644
index 0000000..8501c58
--- /dev/null
+++ b/root/etc/e-smith/events/actions/xl2tpd-interface-access
@@ -0,0 +1,63 @@
+#!/usr/bin/perl -w
+
+#----------------------------------------------------------------------
+# copyright (C) 2002 Mitel Networks Corporaton.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Technical support for this program is available from e-smith, inc.
+# For details, please visit our web site at www.e-smith.com or
+# call us on 1 888 ESMITH 1 (US/Canada toll free) or +1 613 564 8000
+#----------------------------------------------------------------------
+
+package esmith;
+
+use strict;
+use Errno;
+use esmith::util;
+use esmith::ConfigDB;
+
+use constant SIGEVENT => '/sbin/e-smith/signal-event';
+
+my $db = esmith::ConfigDB->open;
+my $xl2tpd = $db->get('xl2tpd');
+my %ifaces = map { $_ => 1 } split /,/, $xl2tpd->prop('Interfaces') || '';
+
+my $event = $ARGV[0] || die "Event name must be given\n";
+my $ipparam = $ARGV[6] || "(none)";
+exit 0 unless ($ipparam eq "xl2tpd");
+my $interface = $ARGV[1] || die "Couldn't determine interface name\n";
+
+if ($event eq "ip-down")
+{
+ # Remove this interface.
+ if (exists $ifaces{$interface})
+ {
+ delete $ifaces{$interface};
+ }
+}
+elsif ($event eq "ip-up.xl2tpd")
+{
+ # Add this interface.
+ $ifaces{$interface} = 1;
+}
+else
+{
+ die "Don't know what to do for event $event\n";
+}
+
+$xl2tpd->set_prop('Interfaces', join ',', keys %ifaces);
+
+exit(0);
diff --git a/root/etc/e-smith/templates.metadata/etc/sysconfig/modules/ip_xl2tpd.modules b/root/etc/e-smith/templates.metadata/etc/sysconfig/modules/ip_xl2tpd.modules
new file mode 100644
index 0000000..5531d85
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/sysconfig/modules/ip_xl2tpd.modules
@@ -0,0 +1 @@
+PERMS=0755
\ No newline at end of file
diff --git a/root/etc/e-smith/templates/etc/ipsec.d/ipsec.conf/20defaultL2tpd b/root/etc/e-smith/templates/etc/ipsec.d/ipsec.conf/20defaultL2tpd
new file mode 100644
index 0000000..9b8eb4f
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/ipsec.d/ipsec.conf/20defaultL2tpd
@@ -0,0 +1,94 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+ my $ipsecDBkey = "ipsec";
+ my $xl2tpdDBkey = "xl2tpd";
+ my $ipsecprop = "L2TPD-PSK";
+ my $systemMode = $configDB->get("SystemMode")->value;
+
+ if ( $systemMode ne 'servergateway' ) {
+ $OUT .= "# L2TPD - System not in Server Gateway mode\n";
+ }
+
+ elsif ( $configDB->get_prop( $ipsecDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# ipsec is disabled\n";
+ }
+
+ elsif ( $configDB->get_prop( $xl2tpdDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# xl2tpd is disabled\n";
+ }
+
+ elsif ( $ipsecDB->get_prop( $ipsecprop, 'status' ) ne 'enabled' ) {
+ $OUT .= "# l2tpd connection is disabled\n";
+ }
+
+ else {
+
+ # Currently most of these are hard coded but could come from the DB key
+
+ # For nat connections you can use "vhost:%no,%priv"
+ # See above
+ # https://github.com/libreswan/libreswan/blob/master/docs/examples/l2tp-psk.conf
+ # see https://libreswan.org/man/ipsec.conf.5.html -> leftsubnet
+
+ $OUT .= "conn $ipsecprop\n";
+ $OUT .= " authby=secret\n";
+ $OUT .= " pfs=no\n";
+ $OUT .= " auto=add\n";
+ $OUT .= " keyingtries=3\n";
+ $OUT .= " rekey=no\n";
+ $OUT .= " type=transport\n";
+ $OUT .= " encapsulation=yes\n";
+ $OUT .= " right=%any\n";
+ $OUT .= " rightprotoport=17/%any\n";
+ $OUT .= " # Using the magic port of \"0\" means \"any one single port\". This is\n";
+ $OUT .= " # a work around required for Apple OSX clients that use a randomly\n";
+ $OUT .= " # high port, but propose \"0\" instead of their port.\n";
+ $OUT .= " left=%defaultroute\n";
+ $OUT .= " leftprotoport=17/1701\n";
+ $OUT .= " # Permit Ike v1 for older xl2tpd connections/clients\n";
+ $OUT .= " ikev2=never\n";
+
+ $OUT .= " # Apple iOS doesn't send delete notify so we need dead peer detection\n";
+ $OUT .= " # to detect vanishing clients\n";
+
+ my $dpddelay = $ipsecDB->get_prop( $ipsecprop, 'dpddelay' ) || "10\n";
+ $OUT .= " dpddelay=$dpddelay\n";
+
+ my $dpdtimeout = $ipsecDB->get_prop( $ipsecprop, 'dpdtimeout' ) || "90\n";
+ $OUT .= " dpdtimeout=$dpdtimeout\n";
+
+ my $dpdaction = $ipsecDB->get_prop( $ipsecprop, 'dpdaction' ) || "clear\n";
+ $OUT .= " dpdaction=$dpdaction\n";
+
+ # Some additional config entries if required
+ # right subnet would not normally be used as it is used above
+
+ # Removing rightsubnet entirely. If required it is added in the -NAT section
+ # Unlike standard ipsec we use the rightsubnet key to fix
+ # the vhosts in /etc/ipsec.conf only
+
+ my $leftsourceip = $ipsecDB->get_prop( $ipsecprop, 'leftsourceip' ) || '';
+ if ( $leftsourceip ne '' ) {
+ $OUT .= " leftsourceip=$leftsourceip\n";
+ }
+
+ my $leftsubnet = $ipsecDB->get_prop( $ipsecprop, 'leftsubnet' ) || '';
+ if ( $leftsubnet ne '' ) {
+ $OUT .= " leftsubnet=$leftsubnet\n";
+ }
+
+ # For L2TPD we really want vhost:%priv unless someone has a really good reason not too
+ # We leave that option in
+ my $rightsubnet = $ipsecDB->get_prop( $ipsecprop, 'rightsubnet' ) || "vhost:%priv";
+
+ $OUT .= "conn $ipsecprop-NAT\n";
+ $OUT .= " rightsubnet=$rightsubnet\n";
+ $OUT .= " also=$ipsecprop\n";
+
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/ipsec.d/ipsec.secrets/20PasswordsL2tpd b/root/etc/e-smith/templates/etc/ipsec.d/ipsec.secrets/20PasswordsL2tpd
new file mode 100644
index 0000000..3d0ecd9
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/ipsec.d/ipsec.secrets/20PasswordsL2tpd
@@ -0,0 +1,37 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+ my $ipsecDBkey = "ipsec";
+ my $xl2tpdDBkey = "xl2tpd";
+ my $ipsecprop = "L2TPD-PSK";
+
+ my $systemMode = $configDB->get("SystemMode")->value;
+ my $ExternalIP = $configDB->get_prop( "ExternalInterface", "IPAddress" );
+
+ if ( $systemMode ne 'servergateway' ) {
+ $OUT .= "# L2TPD - System not in Server Gateway mode\n";
+ }
+
+ elsif ( $configDB->get_prop( $ipsecDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# ipsec is disabled\n";
+ }
+
+ elsif ( $configDB->get_prop( $xl2tpdDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# xl2tpd is disabled\n";
+ }
+
+ elsif ( $ipsecDB->get_prop( $ipsecprop, 'status' ) ne 'enabled' ) {
+ $OUT .= "# l2tpd connection is disabled\n";
+ }
+
+ else {
+ my $right = $ipsecDB->get_prop( $ipsecprop, 'right' ) || '%any';
+ my $passwd = $ipsecDB->get_prop( $ipsecprop, 'passwd' ) || '';
+ $OUT .= "$ExternalIP $right \: PSK \"$passwd\"";
+ $OUT .= "\n";
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/pam.d/ppp/10defaults b/root/etc/e-smith/templates/etc/pam.d/ppp/10defaults
new file mode 100644
index 0000000..27ad725
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/pam.d/ppp/10defaults
@@ -0,0 +1,43 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+ my $ipsecDBkey = "ipsec";
+ my $xl2tpdDBkey = "xl2tpd";
+ my $ipsecprop = "L2TPD-PSK";
+ my $systemMode = $configDB->get("SystemMode")->value;
+
+ if ( $systemMode ne 'servergateway' ) {
+ $OUT .= "# L2TPD - System not in Server Gateway mode\n";
+ }
+
+ elsif ( $configDB->get_prop( $ipsecDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# ipsec is disabled\n";
+ }
+
+ elsif ( $configDB->get_prop( $xl2tpdDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# xl2tpd is disabled\n";
+ }
+
+ elsif ( $ipsecDB->get_prop( $ipsecprop, 'status' ) ne 'enabled' ) {
+ $OUT .= "# ipsec l2tpd connection is disabled\n";
+ }
+
+ else {
+ $OUT .= "#x2ltpd\n";
+# This was the original L2TPD code
+# $OUT .= "auth required pam_nologin.so\n";
+# $OUT .= "auth required pam_unix.so\n";
+# $OUT .= "account required pam_unix.so\n";
+# $OUT .= "session required pam_unix.so\n";
+
+# This is the original untemplated ppp code which works with L2TPD
+ $OUT .= "auth include password-auth\n";
+ $OUT .= "account required pam_nologin.so\n";
+ $OUT .= "account include password-auth\n";
+ $OUT .= "session include password-auth\n";
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/ppp/ip-up.local/30ipparam30xl2tpd b/root/etc/e-smith/templates/etc/ppp/ip-up.local/30ipparam30xl2tpd
new file mode 100644
index 0000000..5b430e4
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/ppp/ip-up.local/30ipparam30xl2tpd
@@ -0,0 +1,11 @@
+{
+ my $status = ${'xl2tpd'}{'debug'} || 'disabled';
+
+ $OUT .= " xl2tpd)\n";
+
+ if ( $status eq 'enabled' ) {
+ $OUT .= " echo xl2tpd \"$@\" |logger -t \"xl2tpd-ip-up\" \n";
+ }
+ $OUT .= " /sbin/e-smith/signal-event ip-up.xl2tpd \"\$@\" \n";
+ $OUT .= " ;;";
+}
diff --git a/root/etc/e-smith/templates/etc/ppp/options.xl2tpd/10default b/root/etc/e-smith/templates/etc/ppp/options.xl2tpd/10default
new file mode 100644
index 0000000..b985445
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/ppp/options.xl2tpd/10default
@@ -0,0 +1,78 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+
+ my $ipsecDBkey = "ipsec";
+ my $xl2tpdDBkey = "xl2tpd";
+ my $ipsecprop = "L2TPD-PSK";
+
+ if ( $configDB->get_prop( $ipsecDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# ipsec is disabled\n";
+ }
+
+ elsif ( $configDB->get_prop( $xl2tpdDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# xl2tpd is disabled\n";
+ }
+
+ elsif ( $ipsecDB->get_prop( $ipsecprop, 'status' ) ne 'enabled' ) {
+ $OUT .= "# l2tpd connection is disabled\n";
+ }
+ else {
+ my $InternalIP = $configDB->get_prop( "InternalInterface", 'IPAddress' );
+ my $DNS = $configDB->get_prop( "xl2tpd", 'DNS' ) || '';
+ my $debug = $configDB->get_prop( "xl2tpd", 'debug' ) || 'disabled';
+ my $mtu = $configDB->get_prop( "xl2tpd", 'mtu' ) || '1400';
+ my @DNSArray = split( /,/, $DNS );
+
+ $OUT .= "#x2ltpd\n";
+ $OUT .= "login\n";
+
+ # https://github.com/xelerance/xl2tpd/blob/master/examples/ppp-options.xl2tpd
+
+ $OUT .= "ipparam xl2tpd\n";
+ $OUT .= "ipcp-accept-local\n";
+ $OUT .= "ipcp-accept-remote\n";
+ if ( $InternalIP ne '' ) {
+ $OUT .= "ms-dns $InternalIP\n";
+ }
+ unless ($DNS eq ''){
+ foreach my $IP (@DNSArray) {
+ $OUT .= "ms-dns $IP\n";
+ }
+ }
+ $OUT .= "noccp\n";
+ $OUT .= "auth\n";
+ $OUT .= "idle 800\n";
+ $OUT .= "mtu $mtu\n";
+ $OUT .= "mru $mtu\n";
+ $OUT .= "nodefaultroute\n";
+ if ( $debug eq 'enabled' ) {
+ $OUT .= "debug\n";
+ }
+ $OUT .= "proxyarp\n";
+ $OUT .= "connect-delay 5000\n";
+
+ # Beyond here are additional parameters required
+
+ $OUT .= "hide-password\n";
+ $OUT .= "name l2tpd\n";
+
+ # Following the main examples we shoudln't need these
+ # $OUT .= "lcp-echo-interval 30\n";
+ # $OUT .= "lcp-echo-failure 4\n";
+
+ # This section allows us to authenticate against SME users
+ $OUT .= "plugin radius.so\n";
+ $OUT .= "radius-config-file /etc/radiusclient-ng/radiusclient.conf\n";
+ $OUT .= "refuse-pap\n";
+ $OUT .= "refuse-chap\n";
+ $OUT .= "refuse-mschap\n";
+ $OUT .= "require-mschap-v2 # Need MSCHAP-v2 to initialise encryption key\n";
+
+
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/ppp/pap-secrets/10defaults b/root/etc/e-smith/templates/etc/ppp/pap-secrets/10defaults
new file mode 100644
index 0000000..bf7b2bd
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/ppp/pap-secrets/10defaults
@@ -0,0 +1,20 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+
+ my $ipsecprop = "L2TPD-PSK";
+
+ if ( $ipsecDB->get_prop( $ipsecprop, 'status' ) ne 'enabled' ) {
+ $OUT .= "# l2tpd connection is disabled\n";
+ }
+ else {
+ $OUT .= "# x2ltpd - for use with PAM authentication\n";
+ # Not required for radius authent
+ # $OUT .= "\* l2tpd \"\" \*\n";
+ $OUT .= "\n";
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/rc.d/init.d/masq/40AllowIPsecL2TPD b/root/etc/e-smith/templates/etc/rc.d/init.d/masq/40AllowIPsecL2TPD
new file mode 100644
index 0000000..91fea20
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/rc.d/init.d/masq/40AllowIPsecL2TPD
@@ -0,0 +1,14 @@
+{
+ my $xl2tpd_status = $xl2tpd{status} || '';
+ my $xl2tpd_dport = $xl2tpd{UDPPort} || '1701';
+ if ( $xl2tpd_status eq 'enabled' ) {
+ $OUT .= " # Ports for Libreswan / xl2tpd\n";
+ $OUT .= " # Allow 1701 or other port via ipsec\n";
+ $OUT .= " /sbin/iptables -A INPUT -m policy --dir in --pol ipsec -p udp --dport $xl2tpd_dport -j ACCEPT\n";
+ $OUT .= " # Disallow generic 1701 or other port\n";
+ $OUT .= " /sbin/iptables -A INPUT -p udp --dport $xl2tpd_dport -j DROP\n";
+ }
+ else {
+ $OUT .= " # 40AllowIPsecL2TPD access disabled\n";
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/sysconfig/modules/ip_xl2tpd.modules b/root/etc/e-smith/templates/etc/sysconfig/modules/ip_xl2tpd.modules
new file mode 100644
index 0000000..162f9d6
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/sysconfig/modules/ip_xl2tpd.modules
@@ -0,0 +1,19 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+ my $ipsecDBkey = "ipsec";
+ my $xl2tpdDBkey = "xl2tpd";
+ my $ipsecprop = "L2TPD-PSK";
+
+ if ( $configDB->get_prop( $xl2tpdDBkey, 'status' ) eq 'enabled' ) {
+ $OUT .= "#!/bin/sh\n";
+ $OUT .= "exec /sbin/modprobe pppol2tp 2>&1\n";
+ }
+ else {
+ $OUT .= "# xl2tpd is disabled\n";
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/xl2tpd/xl2tpd.conf/20default b/root/etc/e-smith/templates/etc/xl2tpd/xl2tpd.conf/20default
new file mode 100644
index 0000000..2a61791
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/xl2tpd/xl2tpd.conf/20default
@@ -0,0 +1,63 @@
+{
+ use strict;
+ use warnings;
+ use esmith::ConfigDB;
+
+ my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
+ my $ipsecDB = esmith::ConfigDB->open_ro('ipsec_connections') or die("cant connect to ipsec database");
+ my $ipsecDBkey = "ipsec";
+ my $xl2tpdDBkey = "xl2tpd";
+ my $ipsecprop = "L2TPD-PSK";
+
+ if ( $configDB->get_prop( $ipsecDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# ipsec is disabled\n";
+ }
+
+ elsif ( $configDB->get_prop( $xl2tpdDBkey, 'status' ) ne 'enabled' ) {
+ $OUT .= "# xl2tpd is disabled\n";
+ }
+
+ elsif ( $ipsecDB->get_prop( $ipsecprop, 'status' ) ne 'enabled' ) {
+ $OUT .= "# No LTPD Ipsec connection found\n";
+ }
+
+ else {
+ my $listenAddr = $configDB->get_prop( 'ExternalInterface', 'IPAddress');
+ my $InternalIP = $configDB->get_prop( 'InternalInterface', 'IPAddress' );
+ my $ipRangeStart = $ipsecDB->get_prop( $ipsecprop, 'IPRangeStart' );
+ my $ipRangeFinish = $ipsecDB->get_prop( $ipsecprop, 'IPRangeFinish' );
+ my $debug = $configDB->get_prop( $xl2tpdDBkey, 'debug' ) || 'disabled';
+ my $maxRetries = $configDB->get_prop( $xl2tpdDBkey, 'maxRetries' ) || '5';
+
+ # https://libreswan.org/wiki/VPN_server_for_remote_clients_using_IKEv1_with_L2TP
+ # Now have kernel support with modprobe pppol2tpd
+ # So userspace and saref disabled/left at default
+ $OUT .= "[global]\n";
+ $OUT .= ";ipsec saref = yes\n";
+ $OUT .= ";force userspace = yes\n";
+ $OUT .= "listen-addr = $listenAddr\n";
+ $OUT .= "max retries = $maxRetries\n";
+
+ if ( $debug eq 'enabled' ) {
+ $OUT .= "debug avp = yes\n";
+ $OUT .= "debug network = yes\n";
+ $OUT .= "debug state = yes\n";
+ $OUT .= "debug tunnel = yes\n";
+ }
+ $OUT .= "\n";
+ $OUT .= "[lns default]\n";
+ $OUT .= "name=L2TP-VPN\n";
+ $OUT .= "ip range = $ipRangeStart-$ipRangeFinish\n";
+ $OUT .= "local ip = $InternalIP\n";
+
+ # Following removed for local radious authentication
+ # $OUT .= "unix authentication = yes\n";
+ $OUT .= "require authentication = yes\n";
+ if ( $debug eq 'enabled' ) {
+ $OUT .= "ppp debug = yes\n";
+ }
+ $OUT .= "pppoptfile = /etc/ppp/options.xl2tpd\n";
+ $OUT .= "length bit = yes\n";
+
+ }
+}
diff --git a/root/etc/e-smith/templates/etc/xl2tpd/xl2tpd.conf/template-begin b/root/etc/e-smith/templates/etc/xl2tpd/xl2tpd.conf/template-begin
new file mode 100644
index 0000000..e69de29
diff --git a/root/usr/lib/systemd/system/ipsec.service.d/50koozali.conf b/root/usr/lib/systemd/system/ipsec.service.d/50koozali.conf
new file mode 100644
index 0000000..58ea56d
--- /dev/null
+++ b/root/usr/lib/systemd/system/ipsec.service.d/50koozali.conf
@@ -0,0 +1,5 @@
+[Unit]
+After=network.target network.service wan.service
+[Install]
+WantedBy=sme-server.target
+
diff --git a/root/usr/lib/systemd/system/xl2tpd.service.d/50koozali.conf b/root/usr/lib/systemd/system/xl2tpd.service.d/50koozali.conf
new file mode 100644
index 0000000..58ea56d
--- /dev/null
+++ b/root/usr/lib/systemd/system/xl2tpd.service.d/50koozali.conf
@@ -0,0 +1,5 @@
+[Unit]
+After=network.target network.service wan.service
+[Install]
+WantedBy=sme-server.target
+
diff --git a/smeserver-libreswan-xl2tpd.spec b/smeserver-libreswan-xl2tpd.spec
new file mode 100644
index 0000000..a7663da
--- /dev/null
+++ b/smeserver-libreswan-xl2tpd.spec
@@ -0,0 +1,169 @@
+%define name smeserver-libreswan-xl2tpd
+%define version 0.5
+%define release 11
+Summary: Plugin to enable LT2P/IPSEC connections
+Name: %{name}
+Version: %{version}
+Release: %{release}
+License: GNU GPL version 2
+URL: https://www.libreswan.org/
+Group: SMEserver/addon
+Source: %{name}-%{version}.tar.xz
+
+BuildRoot: /var/tmp/%{name}-%{version}
+BuildArchitectures: noarch
+BuildRequires: e-smith-devtools
+Requires: e-smith-release >= 9.2
+Requires: libreswan >= 3.29
+Requires: smeserver-libreswan >= 0.5
+Requires: xl2tpd >= 1.3.15
+AutoReqProv: no
+
+%description
+xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661). L2TP allows you to tunnel PPP over UDP
+
+%changelog
+* Sat Sep 07 2024 cvs2git.sh aka Brian Read 0.5-11.sme
+- Roll up patches and move to git repo [SME: 12338]
+
+* Sat Sep 07 2024 BogusDateBot
+- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
+ by assuming the date is correct and changing the weekday.
+ Fri Feb 15 2015 --> Fri Feb 13 2015 or Sun Feb 15 2015 or Fri Feb 20 2015 or ....
+
+* Tue Mar 02 2021 Brian Read 0.5-10.sme
+- Initial import to SME10 tree [SME: 11409]
+- Add-event-for-systemd-in-createlinks
+
+* Tue Feb 18 2020 John Crisp 0.5-9.sme
+- remove crtscts fropm options.xl2tpd for xl2tpd 1.3.15
+
+* Fri Feb 14 2020 John Crisp 0.5-8.sme
+- Update for xl2tpd 1.3.15
+- Update createlinks to regenerate masq on connection
+- Modify Nat/non Nat sections
+- remove rightsubnet as normal configuration item
+- set IKE v1 only and other updates to ipsec.conf
+- update file layouts to match samples
+- load pppol2tp on startup if xl2tpd is enabled
+- Bump requires to newer xl2tpd
+
+* Thu Jan 30 2020 John Crisp 0.5-7
+- Update ip-up.local to add debug and enhance setting
+- update ipsec.conf to for NAT/noNAT
+- add $mtu key - defaults to 1400
+
+* Tue Sep 03 2019 John Crisp 0.5-6
+- Add ipsec connection status key (disabled as default)
+- Update Libreswan depends
+- Add ikev2 permit to allow ike v1
+
+* Thu Jun 21 2018 John Crisp 0.5-5
+- Fix obsolete forecencaps
+- Update required Libreswan version
+
+* Thu Nov 30 2017 John Crisp 0.5-4
+ - template cleanup pending - not yet committed to CVS but in git
+
+* Wed Nov 29 2017 John Crisp 0.5-3
+- remove unneeded default right subnet setting to clear error
+- added variables for leftsourceip and leftsubnet if required
+
+* Wed Nov 29 2017 John Crisp 0.5-2
+- add xl2tpd access private as default
+
+* Fri Nov 24 2017 John Crisp 0.5-1
+- First import to contribs
+
+* Wed Sep 20 2017 John Crisp 0.2-4
+- Fix typo error in ipsec.secrets
+
+* Wed Sep 20 2017 John Crisp 0.2-3
+- Modified client authent to work with existing VPN Client Access via Server Manager
+
+* Mon Jul 31 2017 John Crisp 0.2-2
+- Modify rightsubnet
+
+* Wed Jun 14 2017 John Crisp 0.2-1
+- New v 0.2 release
+
+* Wed Jun 14 2017 John Crisp 0.1-15
+- template masq fragment
+
+* Mon Jun 12 2017 John Crisp 0.1-14
+- Big reformat of code to disable templates when items are disabled
+- Remove service link in spec as xl2tpd will need starting via ipsec-update
+
+* Fri Jun 09 2017 John Crisp 0.1-13
+- add options to /etc/ppp/options.xl2tpd
+
+* Thu Jun 08 2017 John Crisp 0.1-12
+- Fix more templates
+
++* Wed Jun 07 2017 John Crisp 0.1-11
++- Fix various templates
+
+* Thu Jun 1 2017 John Crisp 0.1-10
+- Update notes
+- Note SME bugs: 8890,8891,8897
+- Fix mistakes in createlinks file
+- Add event link
+
+* Wed Nov 18 2015 John Crisp 0.1-9
+- Add UDP DB variable and modify masq temnplate
+
+* Mon Jun 29 2015 John Crisp 0.1-8
+- Remove Incorrect template file from /etc/ip-up.local
+
+* Wed Apr 08 2015 John Crisp 0.1-6
+- Add ip-up.local template - variosu other mods
+
+* Tue Mar 24 2015 John Crisp 0.1-5
+- Few more mods to syntax - this appears to work
+
+* Thu Mar 19 2015 John Crisp 0.1-4
+- Escape quotes in template
+- Remove comments from db
+
+* Thu Mar 5 2015 John Crisp 0.1-3
+- Amend firewall fragment
+
+* Tue Mar 3 2015 John Crisp 0.1-2
+- More of code tidying
+
+* Sun Feb 15 2015 John Crisp 0.1-1
+ Fri Feb 15 2015 --> Fri Feb 13 2015 or Sun Feb 15 2015 or Fri Feb 20 2015 or ....
+- initial release
+
+%prep
+%setup
+
+%build
+perl createlinks
+
+%install
+rm -rf $RPM_BUILD_ROOT
+(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
+rm -f %{name}-%{version}-filelist
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist
+echo "%doc COPYING" >> %{name}-%{version}-filelist
+
+
+%clean
+cd ..
+rm -rf %{name}-%{version}
+
+%files -f %{name}-%{version}-filelist
+%defattr(-,root,root)
+
+%pre
+%preun
+%post
+/sbin/e-smith/expand-template /etc/rc.d/init.d/masq
+/sbin/e-smith/expand-template /etc/inittab
+/sbin/init q
+
+%postun
+/sbin/e-smith/expand-template /etc/rc.d/init.d/masq
+/sbin/e-smith/expand-template /etc/inittab
+/sbin/init q