<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Larena</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Larena"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Larena"/>
	<updated>2026-04-30T06:44:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=26693</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=26693"/>
		<updated>2024-05-07T11:01:06Z</updated>

		<summary type="html">&lt;p&gt;Larena: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Todo|This material has been re-organized..., but grouping should be checked: &#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; and &#039;&#039;&#039;tutorials are more detailed document&#039;&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The tutorials are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; contributions on those pages must be complete articles as well as requesting topics to be covered, don&#039;t override already made contributions. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&lt;br /&gt;
= Howtos =&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Matomo]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance; for alpine 3.10-3.12 only)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
** [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
&lt;br /&gt;
* Alpine Wall &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
** [[Alpine Wall]]&lt;br /&gt;
** [https://git.alpinelinux.org/awall/about/ Alpine Wall User&#039;s Guide]&lt;br /&gt;
** [[How-To Alpine Wall]]&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
* [[Setting up a OpenVPN server|OpenVPN server]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)|Wireguard]]&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
&lt;br /&gt;
* [[FreePBX|FreePBX on Alpine Linux]]&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Backup and data migration ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]]&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Rsnapshot]] - setting up periodic backups&lt;br /&gt;
&lt;br /&gt;
== Desktop ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine and UEFI]]&lt;br /&gt;
* [[Default applications]]&lt;br /&gt;
* Desktop cloud&lt;br /&gt;
** [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Desktop environments and Window managers]] (overall information only)&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* Sound Systems&lt;br /&gt;
** [[ALSA]]&lt;br /&gt;
** [[PipeWire]]&lt;br /&gt;
** [[PulseAudio]]&lt;br /&gt;
* [[Configure action when power-button is pressed]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Alpine setup scripts#setup-xorg-base|Xorg Setup]]&lt;br /&gt;
* Wayland compositors:&lt;br /&gt;
** [[Sway]]&lt;br /&gt;
** [[River]]&lt;br /&gt;
** [[LabWC]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]] - Instructions for installing and configuring Bluetooth&lt;br /&gt;
* [[Bonding]] - Bond (or aggregate) multiple ethernet interfaces&lt;br /&gt;
* [[Bridge]] - Configuring a network bridge&lt;br /&gt;
** [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* Modem&lt;br /&gt;
** [[Using HSDPA modem]]&lt;br /&gt;
** [[Using serial modem]]&lt;br /&gt;
* [[mDNS]] - Howto implement multicast DNS resolution in Alpine. &lt;br /&gt;
* [[Multi ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
* Wi-Fi&lt;br /&gt;
** [[Wi-Fi|Connecting to a wireless access point]]&lt;br /&gt;
** [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[VLAN]]&lt;br /&gt;
&lt;br /&gt;
== Other Architectures ==&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
==== Raspberry Pi ====&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker|Raspberry Pi - Bluetooth Speaker]]&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi - Installation]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi|Raspberry Pi - Router with VPN]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)|Raspberry Pi - Router with VPN (IPv6)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi|Raspberry Pi - Sys mode install]]&lt;br /&gt;
* [[RPI Video Receiver|Raspberry Pi - Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[How to set up Alpine as a wireless router|Raspberry Pi Zero W - Wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== IBM Z (IBM z Systems) ===&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x - Installation]]&lt;br /&gt;
&lt;br /&gt;
=== PowerPC ===&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le - Installation]]&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
* [[Repositories#Enabling_the_community_repository|Enable Community repository]] &#039;&#039;(Providing additional packages)&#039;&#039;&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services|Init System - Multiple Instances of Services]]&lt;br /&gt;
** [[Writing Init Scripts|Init System - Writing Init Scripts]]&lt;br /&gt;
* [[Installing Oracle Java|Oracle Java (installation)]]&lt;br /&gt;
* [[IGMPproxy]]&lt;br /&gt;
* [[Alpine Package Keeper|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
** [[Comparison with other distros|Package Management - Comparison with other distros]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[Setting up a new user]]&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
* [[Daily driver guide]]&lt;br /&gt;
&lt;br /&gt;
== Remote Administration ==&lt;br /&gt;
&lt;br /&gt;
* ACF&lt;br /&gt;
** [[Changing passwords for ACF|ACF - changing passwords]]&lt;br /&gt;
** [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
** [[setup-acf| ACF - setup]] &#039;&#039;(Configures ACF (webconfiguration/webmin) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator |OpenSSH 2FA]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Server ==&lt;br /&gt;
&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
* [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
&lt;br /&gt;
=== DNS ===&lt;br /&gt;
&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Advanced security]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
** [[Nginx with PHP]]&lt;br /&gt;
* Squid Proxy&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
** [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
** [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
&lt;br /&gt;
==== Hostable Content ====&lt;br /&gt;
&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== IRC ===&lt;br /&gt;
&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
&lt;br /&gt;
* Exim/Dovecot&lt;br /&gt;
** [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
** [[Setting up dovecot with imap and tls]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* Server protection&lt;br /&gt;
** [[Setting up clamsmtp]]&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
&lt;br /&gt;
* [[Chrony and GPSD | Chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Setting up an NFS server|nfs-server]]&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
* [[Configure OpenLDAP | OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc|samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
* [[Setting up a Samba server|samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
=== Software development ===&lt;br /&gt;
&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually|Disk setup (manual)]]&lt;br /&gt;
* [[Filesystems]]&lt;br /&gt;
** [[Burning ISOs]]&lt;br /&gt;
* [[Setting up iSCSI|iSCSI Setup]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
** [[Linux iSCSI Target (TCM)|iSCSI Target (TCM)/LinuxIO (LIO)]]&lt;br /&gt;
** [[Linux iSCSI Target (tgt)|User space iSCSI Target (tgt)]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM|LVM Setup]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks|LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM|LVM on GPT-labeled disks (updated)]]&lt;br /&gt;
** [[LVM on LUKS]]&lt;br /&gt;
* RAID&lt;br /&gt;
** [[Raid Administration]]&lt;br /&gt;
** [[Setting up a software RAID array]]&lt;br /&gt;
* ZFS&lt;br /&gt;
** [[Root on ZFS with native encryption]]&lt;br /&gt;
** [[Setting up ZFS on LUKS]]&lt;br /&gt;
** [[Setting up ZFS with native encryption]]&lt;br /&gt;
** [[ZFS scrub and trim]]&lt;br /&gt;
* [[CEPH|CEPH]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Installing Alpine in a virtual machine]]&lt;br /&gt;
** [[Install Alpine on VMware ESXi]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* Xen&lt;br /&gt;
** [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
** [[Xen Dom0 on USB or SD]]&lt;br /&gt;
** [[Create Alpine Linux PV DomU|Xen DomU (paravirtualized)]]&lt;br /&gt;
** [[Xen LiveCD]]&lt;br /&gt;
** [[Xen PCI Passthrough]]&lt;br /&gt;
&lt;br /&gt;
= Tutorials =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
* [[TTY_Autologin|TTY Autologin]]&lt;br /&gt;
* [[Kexec|Faster rebooting with kexec]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[ISP Mail Server 3.x HowTo]]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-service ISP mail server)&#039;&#039;&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
&lt;br /&gt;
== Newbie corner ==&lt;br /&gt;
&lt;br /&gt;
* [[How to get regular stuff working]] &#039;&#039;some notes on need-to-know topics&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Servers ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine production deploy]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
** [[MySQL|Production database: MySQL]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
* Alpine production monitoring&lt;br /&gt;
** [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
** [[Zabbix|Zabbix - the professional complete manager]]&lt;br /&gt;
* Kubernetes&lt;br /&gt;
** [[K8s]] Building a K8s Cluster on Alpine Linux&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26692</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26692"/>
		<updated>2024-05-07T10:58:48Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Bootstrap the first MONITOR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, we will see how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrapping the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor and manager roles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false # change as needed&lt;br /&gt;
ms_bind_ipv6 = true # change as needed&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Adding other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;ceph -s&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;mon is allowing insecure global_id reclaim&amp;lt;/code&amp;gt; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;br /&gt;
&lt;br /&gt;
== Installing MANAGERs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME&lt;br /&gt;
# note this keyring is unique per manager, does not need to be copied across the cluster!&lt;br /&gt;
ceph auth get-or-create mgr.$HOSTNAME mon &#039;allow profile mgr&#039; osd &#039;allow *&#039; mds &#039;allow *&#039; &amp;gt; /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME/keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mgr.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster Manager component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mgr&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mgr&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mgr&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
apk add ceph$VERSION-mgr ceph$VERSION-mgr-dashboard&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mgr.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mgr.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected issues:&lt;br /&gt;
&lt;br /&gt;
Module &#039;restful&#039; has failed dependency: PyO3 modules may only be initialized once per interpreter process&lt;br /&gt;
&lt;br /&gt;
https://github.com/bazaah/aur-ceph/issues/20&lt;br /&gt;
&lt;br /&gt;
https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA/#FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA&lt;br /&gt;
&lt;br /&gt;
Workaround: &amp;lt;code&amp;gt;ceph mgr module disable restful&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing OSDs ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setup-devd udev #alpine eudev drop-in replacement for udev&lt;br /&gt;
apk add ceph$VERSION-osd ceph$VERSION-osd-daemon ceph$VERSION-osd-tools eudev ceph$VERSION-openrc&lt;br /&gt;
mkdir -p /var/lib/ceph/bootstrap-osd /etc/ceph&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring from a monitor node to /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
Copy /etc/ceph/ceph.conf from a monitor node to /etc/ceph/ceph.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-client-mon&lt;br /&gt;
awall enable ceph-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
ln -s /var/lib/ceph/bootstrap-osd/ceph.keyring /etc/ceph/ceph.client.bootstrap-osd.keyring #it seems it wants the keyring in this location&lt;br /&gt;
ceph-volume lvm create --data /dev/sdX --no-systemd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26691</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26691"/>
		<updated>2024-05-07T10:58:34Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Add other MONITOR nodes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, we will see how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrap the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor and manager roles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false # change as needed&lt;br /&gt;
ms_bind_ipv6 = true # change as needed&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Adding other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;ceph -s&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;mon is allowing insecure global_id reclaim&amp;lt;/code&amp;gt; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;br /&gt;
&lt;br /&gt;
== Installing MANAGERs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME&lt;br /&gt;
# note this keyring is unique per manager, does not need to be copied across the cluster!&lt;br /&gt;
ceph auth get-or-create mgr.$HOSTNAME mon &#039;allow profile mgr&#039; osd &#039;allow *&#039; mds &#039;allow *&#039; &amp;gt; /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME/keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mgr.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster Manager component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mgr&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mgr&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mgr&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
apk add ceph$VERSION-mgr ceph$VERSION-mgr-dashboard&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mgr.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mgr.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected issues:&lt;br /&gt;
&lt;br /&gt;
Module &#039;restful&#039; has failed dependency: PyO3 modules may only be initialized once per interpreter process&lt;br /&gt;
&lt;br /&gt;
https://github.com/bazaah/aur-ceph/issues/20&lt;br /&gt;
&lt;br /&gt;
https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA/#FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA&lt;br /&gt;
&lt;br /&gt;
Workaround: &amp;lt;code&amp;gt;ceph mgr module disable restful&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing OSDs ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setup-devd udev #alpine eudev drop-in replacement for udev&lt;br /&gt;
apk add ceph$VERSION-osd ceph$VERSION-osd-daemon ceph$VERSION-osd-tools eudev ceph$VERSION-openrc&lt;br /&gt;
mkdir -p /var/lib/ceph/bootstrap-osd /etc/ceph&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring from a monitor node to /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
Copy /etc/ceph/ceph.conf from a monitor node to /etc/ceph/ceph.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-client-mon&lt;br /&gt;
awall enable ceph-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
ln -s /var/lib/ceph/bootstrap-osd/ceph.keyring /etc/ceph/ceph.client.bootstrap-osd.keyring #it seems it wants the keyring in this location&lt;br /&gt;
ceph-volume lvm create --data /dev/sdX --no-systemd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26690</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26690"/>
		<updated>2024-05-07T10:57:32Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Bootstrap the first MONITOR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, we will see how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrap the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor and manager roles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false # change as needed&lt;br /&gt;
ms_bind_ipv6 = true # change as needed&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Add other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;ceph -s&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;mon is allowing insecure global_id reclaim&amp;lt;/code&amp;gt; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing MANAGERs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME&lt;br /&gt;
# note this keyring is unique per manager, does not need to be copied across the cluster!&lt;br /&gt;
ceph auth get-or-create mgr.$HOSTNAME mon &#039;allow profile mgr&#039; osd &#039;allow *&#039; mds &#039;allow *&#039; &amp;gt; /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME/keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mgr.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster Manager component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mgr&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mgr&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mgr&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
apk add ceph$VERSION-mgr ceph$VERSION-mgr-dashboard&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mgr.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mgr.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected issues:&lt;br /&gt;
&lt;br /&gt;
Module &#039;restful&#039; has failed dependency: PyO3 modules may only be initialized once per interpreter process&lt;br /&gt;
&lt;br /&gt;
https://github.com/bazaah/aur-ceph/issues/20&lt;br /&gt;
&lt;br /&gt;
https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA/#FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA&lt;br /&gt;
&lt;br /&gt;
Workaround: &amp;lt;code&amp;gt;ceph mgr module disable restful&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing OSDs ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setup-devd udev #alpine eudev drop-in replacement for udev&lt;br /&gt;
apk add ceph$VERSION-osd ceph$VERSION-osd-daemon ceph$VERSION-osd-tools eudev ceph$VERSION-openrc&lt;br /&gt;
mkdir -p /var/lib/ceph/bootstrap-osd /etc/ceph&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring from a monitor node to /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
Copy /etc/ceph/ceph.conf from a monitor node to /etc/ceph/ceph.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-client-mon&lt;br /&gt;
awall enable ceph-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
ln -s /var/lib/ceph/bootstrap-osd/ceph.keyring /etc/ceph/ceph.client.bootstrap-osd.keyring #it seems it wants the keyring in this location&lt;br /&gt;
ceph-volume lvm create --data /dev/sdX --no-systemd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26689</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26689"/>
		<updated>2024-05-07T10:54:48Z</updated>

		<summary type="html">&lt;p&gt;Larena: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, we will see how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrap the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor and manager roles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false&lt;br /&gt;
ms_bind_ipv6 = true&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Add other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;ceph -s&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;mon is allowing insecure global_id reclaim&amp;lt;/code&amp;gt; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing MANAGERs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME&lt;br /&gt;
# note this keyring is unique per manager, does not need to be copied across the cluster!&lt;br /&gt;
ceph auth get-or-create mgr.$HOSTNAME mon &#039;allow profile mgr&#039; osd &#039;allow *&#039; mds &#039;allow *&#039; &amp;gt; /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME/keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mgr.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster Manager component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mgr&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mgr&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mgr&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
apk add ceph$VERSION-mgr ceph$VERSION-mgr-dashboard&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mgr.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mgr.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected issues:&lt;br /&gt;
&lt;br /&gt;
Module &#039;restful&#039; has failed dependency: PyO3 modules may only be initialized once per interpreter process&lt;br /&gt;
&lt;br /&gt;
https://github.com/bazaah/aur-ceph/issues/20&lt;br /&gt;
&lt;br /&gt;
https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA/#FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA&lt;br /&gt;
&lt;br /&gt;
Workaround: &amp;lt;code&amp;gt;ceph mgr module disable restful&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing OSDs ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setup-devd udev #alpine eudev drop-in replacement for udev&lt;br /&gt;
apk add ceph$VERSION-osd ceph$VERSION-osd-daemon ceph$VERSION-osd-tools eudev ceph$VERSION-openrc&lt;br /&gt;
mkdir -p /var/lib/ceph/bootstrap-osd /etc/ceph&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring from a monitor node to /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
Copy /etc/ceph/ceph.conf from a monitor node to /etc/ceph/ceph.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-client-mon&lt;br /&gt;
awall enable ceph-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
ln -s /var/lib/ceph/bootstrap-osd/ceph.keyring /etc/ceph/ceph.client.bootstrap-osd.keyring #it seems it wants the keyring in this location&lt;br /&gt;
ceph-volume lvm create --data /dev/sdX --no-systemd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26688</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26688"/>
		<updated>2024-05-07T10:20:42Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Bootstrap the first MONITOR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, I will show how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrap the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor and manager roles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false&lt;br /&gt;
ms_bind_ipv6 = true&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Add other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;ceph -s&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;mon is allowing insecure global_id reclaim&amp;lt;/code&amp;gt; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing MANAGERs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME&lt;br /&gt;
# note this keyring is unique per manager, does not need to be copied across the cluster!&lt;br /&gt;
ceph auth get-or-create mgr.$HOSTNAME mon &#039;allow profile mgr&#039; osd &#039;allow *&#039; mds &#039;allow *&#039; &amp;gt; /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME/keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mgr.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster Manager component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mgr&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mgr&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mgr&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
apk add ceph$VERSION-mgr ceph$VERSION-mgr-dashboard&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mgr.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mgr.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected issues:&lt;br /&gt;
&lt;br /&gt;
Module &#039;restful&#039; has failed dependency: PyO3 modules may only be initialized once per interpreter process&lt;br /&gt;
&lt;br /&gt;
https://github.com/bazaah/aur-ceph/issues/20&lt;br /&gt;
&lt;br /&gt;
https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA/#FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA&lt;br /&gt;
&lt;br /&gt;
Workaround: &amp;lt;code&amp;gt;ceph mgr module disable restful&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing OSDs ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setup-devd udev #alpine eudev drop-in replacement for udev&lt;br /&gt;
apk add ceph$VERSION-osd ceph$VERSION-osd-daemon ceph$VERSION-osd-tools eudev ceph$VERSION-openrc&lt;br /&gt;
mkdir -p /var/lib/ceph/bootstrap-osd /etc/ceph&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring from a monitor node to /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
Copy /etc/ceph/ceph.conf from a monitor node to /etc/ceph/ceph.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-client-mon&lt;br /&gt;
awall enable ceph-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
ln -s /var/lib/ceph/bootstrap-osd/ceph.keyring /etc/ceph/ceph.client.bootstrap-osd.keyring #it seems it wants the keyring in this location&lt;br /&gt;
ceph-volume lvm create --data /dev/sdX --no-systemd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26687</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26687"/>
		<updated>2024-05-07T10:18:27Z</updated>

		<summary type="html">&lt;p&gt;Larena: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, I will show how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrap the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor role:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false&lt;br /&gt;
ms_bind_ipv6 = true&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Add other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;ceph -s&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;mon is allowing insecure global_id reclaim&amp;lt;/code&amp;gt; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing MANAGERs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME&lt;br /&gt;
# note this keyring is unique per manager, does not need to be copied across the cluster!&lt;br /&gt;
ceph auth get-or-create mgr.$HOSTNAME mon &#039;allow profile mgr&#039; osd &#039;allow *&#039; mds &#039;allow *&#039; &amp;gt; /var/lib/ceph/mgr/$CLUSTER_NAME-$HOSTNAME/keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mgr.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster Manager component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mgr&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mgr&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mgr&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
apk add ceph$VERSION-mgr ceph$VERSION-mgr-dashboard&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mgr.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mgr.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected issues:&lt;br /&gt;
&lt;br /&gt;
Module &#039;restful&#039; has failed dependency: PyO3 modules may only be initialized once per interpreter process&lt;br /&gt;
&lt;br /&gt;
https://github.com/bazaah/aur-ceph/issues/20&lt;br /&gt;
&lt;br /&gt;
https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA/#FB7XE6WYDK3EBJYPABSPX5B2LEILWWJA&lt;br /&gt;
&lt;br /&gt;
Workaround: &amp;lt;code&amp;gt;ceph mgr module disable restful&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing OSDs ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setup-devd udev #alpine eudev drop-in replacement for udev&lt;br /&gt;
apk add ceph$VERSION-osd ceph$VERSION-osd-daemon ceph$VERSION-osd-tools eudev ceph$VERSION-openrc&lt;br /&gt;
mkdir -p /var/lib/ceph/bootstrap-osd /etc/ceph&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring from a monitor node to /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
Copy /etc/ceph/ceph.conf from a monitor node to /etc/ceph/ceph.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD component&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-client-mon&lt;br /&gt;
awall enable ceph-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
&lt;br /&gt;
ln -s /var/lib/ceph/bootstrap-osd/ceph.keyring /etc/ceph/ceph.client.bootstrap-osd.keyring #it seems it wants the keyring in this location&lt;br /&gt;
ceph-volume lvm create --data /dev/sdX --no-systemd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26686</id>
		<title>CEPH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=CEPH&amp;diff=26686"/>
		<updated>2024-05-07T09:56:00Z</updated>

		<summary type="html">&lt;p&gt;Larena: Created page with &amp;quot;{{Draft|work in progress}}  CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&amp;#039;s why this how-to, I will show how to deploy CEPH monitors, managers and OSDs, via A...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
CEPH is a software defined storage platform. There are various methods and tools to deploy CEPH, none of which (to my knowledge, please correct this statement if wrong) work on Alpine. However CEPH has been available in the community repository since Alpine 3.10. Thanks to the maintainer that has done an amazing job, even maintaining multiple versions! So that&#039;s why this how-to, I will show how to deploy CEPH monitors, managers and OSDs, via APK, manually. Eventually I&#039;m planning to write an Ansible playbook Alpine-specific.&lt;br /&gt;
&lt;br /&gt;
== Installing MONITORs ==&lt;br /&gt;
=== Bootstrap the first MONITOR ===&lt;br /&gt;
In this example we use 3 hosts as monitor role:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MON_HOST1=&amp;quot;mon01&amp;quot;&lt;br /&gt;
MON_HOST1_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST2=&amp;quot;mon02&amp;quot;&lt;br /&gt;
MON_HOST2_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
MON_HOST3=&amp;quot;mon03&amp;quot;&lt;br /&gt;
MON_HOST3_IP=&amp;quot;%IP_ADDRESS%&amp;quot;&lt;br /&gt;
FSID=$(cat /proc/sys/kernel/random/uuid) #store this FSID&lt;br /&gt;
echo $FSID&lt;br /&gt;
CLUSTER_NAME=&amp;quot;ceph&amp;quot; # default value if unspecified&lt;br /&gt;
HOSTNAME=$(cat /etc/hostname)&lt;br /&gt;
PUBLIC_NETWORK=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
MYNET=&amp;quot;%NETWORK_CIDR%&amp;quot;&lt;br /&gt;
VERSION=17&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|#apk add ceph$VERSION-mon ceph$VERSION-mon-daemon ceph$VERSION-mon-tools ceph$VERSION-openrc sudo}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/ceph/$CLUSTER_NAME.conf &lt;br /&gt;
[global]&lt;br /&gt;
# Cluster unique identifier&lt;br /&gt;
fsid = $FSID&lt;br /&gt;
mon_initial_members = $MON_HOST1&lt;br /&gt;
mon_host = $MON_HOST1_IP, $MON_HOST2_IP, $MON_HOST3_IP&lt;br /&gt;
mon_allow_pool_delete = true&lt;br /&gt;
ms_bind_ipv4 = false&lt;br /&gt;
ms_bind_ipv6 = true&lt;br /&gt;
public_network = $PUBLIC_NETWORK&lt;br /&gt;
# Enable authentication&lt;br /&gt;
auth_cluster_required = cephx&lt;br /&gt;
auth_service_required = cephx&lt;br /&gt;
auth_client_required = cephx&lt;br /&gt;
# https://docs.ceph.com/en/latest/rados/configuration/pool-pg-config-ref/#pool-pg-and-crush-config-reference&lt;br /&gt;
osd_pool_default_size = 3 # Write an object three times&lt;br /&gt;
osd_pool_default_min_size = 2 # Accept an I/O operation to a degraded PG that has two copies of an object&lt;br /&gt;
osd_pool_default_pg_num = 128 # total number of OSDs * 100 / osd_pool_default_size. Use nearest power of two.&lt;br /&gt;
osd_crush_chooseleaf_type = 1&lt;br /&gt;
rgw_data = /var/lib/ceph/radosgw/\$cluster-\$id # literal variables&lt;br /&gt;
&lt;br /&gt;
[mon]&lt;br /&gt;
mon_data = /var/lib/ceph/mon/\$cluster-$FSID # &amp;quot;cluster&amp;quot; is a literal variable&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ceph-authtool --create-keyring /tmp/$CLUSTER_NAME.mon.keyring --gen-key -n mon. --cap mon &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring --gen-key -n client.admin --cap mon &#039;allow *&#039; --cap osd &#039;allow *&#039; --cap mds &#039;allow *&#039; --cap mgr &#039;allow *&#039;&lt;br /&gt;
ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring --gen-key -n client.bootstrap-osd --cap mon &#039;profile bootstrap-osd&#039; --cap mgr &#039;allow r&#039;&lt;br /&gt;
&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/$CLUSTER_NAME.client.admin.keyring&lt;br /&gt;
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/$CLUSTER_NAME.keyring&lt;br /&gt;
&lt;br /&gt;
chown ceph:ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create AWall policies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-mon.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster monitor component&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-mon&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: [ 3300, 6789 ] }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;src&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-mon&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/awall/optional/ceph-client-osd.json&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Ceph cluster OSD client&amp;quot;,&lt;br /&gt;
  &lt;br /&gt;
  &amp;quot;service&amp;quot;: {&lt;br /&gt;
    &amp;quot;ceph-osd&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;tcp&amp;quot;, &amp;quot;port&amp;quot;: &amp;quot;6800-7300&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;\$MYNET&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ceph-osd&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
awall enable ceph-mon&lt;br /&gt;
awall enable ceph-client-osd&lt;br /&gt;
awall activate -f&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect that the first node was bootstrapped correctly running {{Cmd|ceph -s}}&lt;br /&gt;
&lt;br /&gt;
=== Add other MONITOR nodes ===&lt;br /&gt;
Copy /etc/ceph/ceph.conf, /tmp/ceph.mon.keyring /etc/ceph/ceph.client.admin.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring from existing monitor to the new monitor node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install -d --owner ceph --group ceph /etc/ceph /var/lib/ceph/bootstrap-osd&lt;br /&gt;
install -d -o ceph /var/lib/ceph/mon/$CLUSTER_NAME-$FSID&lt;br /&gt;
chown ceph /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
monmaptool --create --add $MON_HOST1 $MON_HOST1_IP --add $MON_HOST2 $MON_HOST2_IP --add $MON_HOST3 $MON_HOST3_IP --fsid $FSID /tmp/monmap&lt;br /&gt;
&lt;br /&gt;
sudo -u ceph ceph-mon --cluster $CLUSTER_NAME --mkfs -i $HOSTNAME --inject-monmap /tmp/monmap --keyring /tmp/$CLUSTER_NAME.mon.keyring&lt;br /&gt;
&lt;br /&gt;
ln -s ceph /etc/init.d/ceph-mon.$HOSTNAME&lt;br /&gt;
rc-update add ceph-mon.$HOSTNAME&lt;br /&gt;
openrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;ceph -s2 returns &amp;quot;mon is allowing insecure global_id reclaim&amp;quot; fix with {{Cmd|ceph config set mon auth_allow_insecure_global_id_reclaim false}}&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Disk_Replication_with_DRBD&amp;diff=20166</id>
		<title>Disk Replication with DRBD</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Disk_Replication_with_DRBD&amp;diff=20166"/>
		<updated>2021-10-04T12:30:24Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Disk Replication with DRBD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
== Disk Replication with DRBD ==&lt;br /&gt;
&lt;br /&gt;
  #apk add drbd&lt;br /&gt;
&lt;br /&gt;
Load DRBD kernel driver:&lt;br /&gt;
&lt;br /&gt;
  #modprobe drbd&lt;br /&gt;
&lt;br /&gt;
Sample DRBD configuration in /etc/drbd.d/r0.res (resource 0):&lt;br /&gt;
&lt;br /&gt;
  resource r0 {&lt;br /&gt;
    device /dev/drbd1;&lt;br /&gt;
    disk /dev/md0;&lt;br /&gt;
    meta-disk internal;&lt;br /&gt;
    on host1 {&lt;br /&gt;
      address	192.168.0.1:7789;&lt;br /&gt;
    }&lt;br /&gt;
    on host2 {&lt;br /&gt;
      address	192.168.0.2:7789;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is recommended to have a dedicated heartbeat interface for DRBD where replication occurs.&lt;br /&gt;
&lt;br /&gt;
Create the DRBD device and bring it up on &#039;&#039;&#039;both nodes&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
  #drbdadm create-md r0&lt;br /&gt;
  #drbdadm up r0&lt;br /&gt;
&lt;br /&gt;
On primary node start replication:&lt;br /&gt;
&lt;br /&gt;
  #drbdadm -- --overwrite-data-of-peer primary r0&lt;br /&gt;
&lt;br /&gt;
If you want to temporarily speed up replication, run (e.g. 1G):&lt;br /&gt;
&lt;br /&gt;
  #drbdsetup /dev/drbd1 syncer -r 1G&lt;br /&gt;
&lt;br /&gt;
Control replication status:&lt;br /&gt;
&lt;br /&gt;
  #cat /proc/drbd&lt;br /&gt;
&lt;br /&gt;
[[Category:Storage]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18277</id>
		<title>Setting up GVM11</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18277"/>
		<updated>2020-12-14T09:37:15Z</updated>

		<summary type="html">&lt;p&gt;Larena: gvm user cannot be created if daemon is not started&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Greenbone Vulnerability Management (GVM) 11 =&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
OpenVAS with version 11 has been renamed in Greenbone Vulnerability Management and it is available in community repository.&lt;br /&gt;
&lt;br /&gt;
This How-To will guide you to install a complete server solution for vulnerability scanning and vulnerability management solution.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
[[Enable_Community_Repository|Enable the community repository]] and install the required packages:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add openvas openvas-config gvmd gvm-libs greenbone-security-assistant ospd-openvas}}&lt;br /&gt;
&lt;br /&gt;
= Configuration = &lt;br /&gt;
&lt;br /&gt;
== PostgreSQL  ==&lt;br /&gt;
&lt;br /&gt;
OpenVAS relies on PostgreSQL, that now is mandatory.&lt;br /&gt;
&lt;br /&gt;
Start PostgreSQL and add it to default runlevel:&lt;br /&gt;
 rc-service postgresql setup&lt;br /&gt;
 rc-service postgresql start&lt;br /&gt;
 rc-update add postgresql&lt;br /&gt;
&lt;br /&gt;
Create and configure the gvm database:&lt;br /&gt;
&lt;br /&gt;
 su - postgres&lt;br /&gt;
 createuser -DRS gvm&lt;br /&gt;
 createdb -O gvm gvmd&lt;br /&gt;
 psql gvmd&lt;br /&gt;
 create role dba with superuser noinherit;&lt;br /&gt;
 grant dba to gvm;&lt;br /&gt;
 create extension if not exists &amp;quot;uuid-ossp&amp;quot;;&lt;br /&gt;
 create extension &amp;quot;pgcrypto&amp;quot;;&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== GVMd  ==&lt;br /&gt;
&lt;br /&gt;
GVMd run as gvm user. Generate the certificate.&lt;br /&gt;
The certificate infrastructure enables GVMd to communicate in a secure manner and is used for authentication and authorization before establishing TLS connections between the daemons.&lt;br /&gt;
You can setup the certificate automatically with:&lt;br /&gt;
 su - gvm&lt;br /&gt;
 gvm-manage-certs -a&lt;br /&gt;
&lt;br /&gt;
Create credentials used to interact with gvmd:&lt;br /&gt;
&lt;br /&gt;
 rc-service gvmd start&lt;br /&gt;
 gvmd --create-user=admin --password=admin&lt;br /&gt;
&lt;br /&gt;
Certain resources that were previously part of the gvmd source code are now shipped via the feed. An example is the config &amp;quot;Full and Fast&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
gvmd will only create these resources if a &amp;quot;Feed Import Owner&amp;quot; is configured:&lt;br /&gt;
&lt;br /&gt;
 gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value &amp;lt;uuid_of_user&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UUIDs of all created users can be found using&lt;br /&gt;
&lt;br /&gt;
 gvmd --get-users --verbose&lt;br /&gt;
&lt;br /&gt;
== Update GVM definitions ==&lt;br /&gt;
&lt;br /&gt;
Download the GVM definitions and start GVMd, as gvm user.&lt;br /&gt;
Be patient...it will take a while: &lt;br /&gt;
&lt;br /&gt;
  su - gvm&lt;br /&gt;
  greenbone-feed-sync --type GVMD_DATA&lt;br /&gt;
  greenbone-feed-sync --type SCAP&lt;br /&gt;
  greenbone-feed-sync --type CERT&lt;br /&gt;
&lt;br /&gt;
This three feeds needs to be scheduled via cron.&lt;br /&gt;
&lt;br /&gt;
Add gvmd to start on boot:&lt;br /&gt;
&lt;br /&gt;
 rc-update add gvmd&lt;br /&gt;
&lt;br /&gt;
Download NVT definitions:&lt;br /&gt;
&lt;br /&gt;
 su - gvm&lt;br /&gt;
 greenbone-nvt-sync&lt;br /&gt;
&lt;br /&gt;
== Greenbone Security Assistant (GSAD) ==&lt;br /&gt;
&lt;br /&gt;
Configure Greenbone Security Assistant (GSAD) to listen to other interfaces rather than localhost only, so it is reachable from other hosts.&lt;br /&gt;
&lt;br /&gt;
Create &#039;&#039;&#039;/etc/conf.d/gsad:&#039;&#039;&#039; with:&lt;br /&gt;
 echo &#039;GSAD_LISTEN_ADDRESS=&amp;quot;0.0.0.0&amp;quot;&#039; &amp;gt; /etc/conf.d/gsad&lt;br /&gt;
&lt;br /&gt;
Start GSAD and add it to default runlevel:&lt;br /&gt;
 rc-service gsad start&lt;br /&gt;
 rc-update add gsad&lt;br /&gt;
&lt;br /&gt;
Open the browser at the IP address where GSAD is running, on http port 9392, and login with the credentials previously created.&lt;br /&gt;
&lt;br /&gt;
Happy vulnerability assestment!&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18228</id>
		<title>Setting up GVM11</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18228"/>
		<updated>2020-12-08T08:26:59Z</updated>

		<summary type="html">&lt;p&gt;Larena: GVM definitions can be downloaded as gvm user&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Greenbone Vulnerability Management (GVM) 11 =&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
OpenVAS with version 11 has been renamed in Greenbone Vulnerability Management and it is available in community repository.&lt;br /&gt;
&lt;br /&gt;
This How-To will guide you to install a complete server solution for vulnerability scanning and vulnerability management solution.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
[[Enable_Community_Repository|Enable the community repository]] and install the required packages:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add openvas openvas-config gvmd gvm-libs greenbone-security-assistant ospd-openvas}}&lt;br /&gt;
&lt;br /&gt;
= Configuration = &lt;br /&gt;
&lt;br /&gt;
== PostgreSQL  ==&lt;br /&gt;
&lt;br /&gt;
OpenVAS relies on PostgreSQL, that now is mandatory.&lt;br /&gt;
&lt;br /&gt;
Start PostgreSQL and add it to default runlevel:&lt;br /&gt;
 rc-service postgresql setup&lt;br /&gt;
 rc-service postgresql start&lt;br /&gt;
 rc-update add postgresql&lt;br /&gt;
&lt;br /&gt;
Create and configure the gvm database:&lt;br /&gt;
&lt;br /&gt;
 su - postgres&lt;br /&gt;
 createuser -DRS gvm&lt;br /&gt;
 createdb -O gvm gvmd&lt;br /&gt;
 psql gvmd&lt;br /&gt;
 create role dba with superuser noinherit;&lt;br /&gt;
 grant dba to gvm;&lt;br /&gt;
 create extension if not exists &amp;quot;uuid-ossp&amp;quot;;&lt;br /&gt;
 create extension &amp;quot;pgcrypto&amp;quot;;&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== GVMd  ==&lt;br /&gt;
&lt;br /&gt;
GVMd run as gvm user. Generate the certificate.&lt;br /&gt;
The certificate infrastructure enables GVMd to communicate in a secure manner and is used for authentication and authorization before establishing TLS connections between the daemons.&lt;br /&gt;
You can setup the certificate automatically with:&lt;br /&gt;
 su - gvm&lt;br /&gt;
 gvm-manage-certs -a&lt;br /&gt;
&lt;br /&gt;
Create credentials used to interact with gvmd:&lt;br /&gt;
&lt;br /&gt;
 gvmd --create-user=admin --password=admin&lt;br /&gt;
&lt;br /&gt;
Certain resources that were previously part of the gvmd source code are now shipped via the feed. An example is the config &amp;quot;Full and Fast&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
gvmd will only create these resources if a &amp;quot;Feed Import Owner&amp;quot; is configured:&lt;br /&gt;
&lt;br /&gt;
 gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value &amp;lt;uuid_of_user&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UUIDs of all created users can be found using&lt;br /&gt;
&lt;br /&gt;
 gvmd --get-users --verbose&lt;br /&gt;
&lt;br /&gt;
== Update GVM definitions ==&lt;br /&gt;
&lt;br /&gt;
Download the GVM definitions and start GVMd, as gvm user.&lt;br /&gt;
Be patient...it will take a while: &lt;br /&gt;
&lt;br /&gt;
  su - gvm&lt;br /&gt;
  greenbone-feed-sync --type GVMD_DATA&lt;br /&gt;
  greenbone-feed-sync --type SCAP&lt;br /&gt;
  greenbone-feed-sync --type CERT&lt;br /&gt;
&lt;br /&gt;
This three feeds needs to be scheduled via cron.&lt;br /&gt;
&lt;br /&gt;
 rc-service gvmd start&lt;br /&gt;
&lt;br /&gt;
Add gvmd to start on boot:&lt;br /&gt;
&lt;br /&gt;
 rc-update add gvmd&lt;br /&gt;
&lt;br /&gt;
Download NVT definitions:&lt;br /&gt;
&lt;br /&gt;
 su - gvm&lt;br /&gt;
 greenbone-nvt-sync&lt;br /&gt;
&lt;br /&gt;
== Greenbone Security Assistant (GSAD) ==&lt;br /&gt;
&lt;br /&gt;
Configure Greenbone Security Assistant (GSAD) to listen to other interfaces rather than localhost only, so it is reachable from other hosts.&lt;br /&gt;
&lt;br /&gt;
Create &#039;&#039;&#039;/etc/conf.d/gsad:&#039;&#039;&#039; with:&lt;br /&gt;
 echo &#039;GSAD_LISTEN_ADDRESS=&amp;quot;0.0.0.0&amp;quot;&#039; &amp;gt; /etc/conf.d/gsad&lt;br /&gt;
&lt;br /&gt;
Start GSAD and add it to default runlevel:&lt;br /&gt;
 rc-service gsad start&lt;br /&gt;
 rc-update add gsad&lt;br /&gt;
&lt;br /&gt;
Open the browser at the IP address where GSAD is running, on http port 9392, and login with the credentials previously created.&lt;br /&gt;
&lt;br /&gt;
Happy vulnerability assestment!&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18227</id>
		<title>Setting up GVM11</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18227"/>
		<updated>2020-12-07T14:35:41Z</updated>

		<summary type="html">&lt;p&gt;Larena: Add missing setup steps&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Greenbone Vulnerability Management (GVM) 11 =&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
OpenVAS with version 11 has been renamed in Greenbone Vulnerability Management and it is available in community repository.&lt;br /&gt;
&lt;br /&gt;
This How-To will guide you to install a complete server solution for vulnerability scanning and vulnerability management solution.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
[[Enable_Community_Repository|Enable the community repository]] and install the required packages:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add openvas openvas-config gvmd gvm-libs greenbone-security-assistant ospd-openvas}}&lt;br /&gt;
&lt;br /&gt;
= Configuration = &lt;br /&gt;
&lt;br /&gt;
== PostgreSQL  ==&lt;br /&gt;
&lt;br /&gt;
OpenVAS relies on PostgreSQL, that now is mandatory.&lt;br /&gt;
&lt;br /&gt;
Start PostgreSQL and add it to default runlevel:&lt;br /&gt;
 rc-service postgresql setup&lt;br /&gt;
 rc-service postgresql start&lt;br /&gt;
 rc-update add postgresql&lt;br /&gt;
&lt;br /&gt;
Create and configure the gvm database:&lt;br /&gt;
&lt;br /&gt;
 su - postgres&lt;br /&gt;
 createuser -DRS gvm&lt;br /&gt;
 createdb -O gvm gvmd&lt;br /&gt;
 psql gvmd&lt;br /&gt;
 create role dba with superuser noinherit;&lt;br /&gt;
 grant dba to gvm;&lt;br /&gt;
 create extension if not exists &amp;quot;uuid-ossp&amp;quot;;&lt;br /&gt;
 create extension &amp;quot;pgcrypto&amp;quot;;&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== GVMd  ==&lt;br /&gt;
&lt;br /&gt;
GVMd run as gvm user. Generate the certificate.&lt;br /&gt;
The certificate infrastructure enables GVMd to communicate in a secure manner and is used for authentication and authorization before establishing TLS connections between the daemons.&lt;br /&gt;
You can setup the certificate automatically with:&lt;br /&gt;
 su - gvm&lt;br /&gt;
 gvm-manage-certs -a&lt;br /&gt;
&lt;br /&gt;
Create credentials used to interact with gvmd:&lt;br /&gt;
&lt;br /&gt;
 gvmd --create-user=admin --password=admin&lt;br /&gt;
&lt;br /&gt;
Certain resources that were previously part of the gvmd source code are now shipped via the feed. An example is the config &amp;quot;Full and Fast&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
gvmd will only create these resources if a &amp;quot;Feed Import Owner&amp;quot; is configured:&lt;br /&gt;
&lt;br /&gt;
 gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value &amp;lt;uuid_of_user&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UUIDs of all created users can be found using&lt;br /&gt;
&lt;br /&gt;
 gvmd --get-users --verbose&lt;br /&gt;
&lt;br /&gt;
== Update GVM definitions ==&lt;br /&gt;
&lt;br /&gt;
Download the GVM definitions and start GVMd, as root user.&lt;br /&gt;
Be patient...it will take a while: &lt;br /&gt;
&lt;br /&gt;
  greenbone-feed-sync --type GVMD_DATA&lt;br /&gt;
  greenbone-feed-sync --type SCAP&lt;br /&gt;
  greenbone-feed-sync --type CERT&lt;br /&gt;
&lt;br /&gt;
This three feeds needs to be scheduled via cron.&lt;br /&gt;
&lt;br /&gt;
 rc-service gvmd start&lt;br /&gt;
&lt;br /&gt;
Add gvmd to start on boot:&lt;br /&gt;
&lt;br /&gt;
 rc-update add gvmd&lt;br /&gt;
&lt;br /&gt;
NVT definitions can be downloaded as gvm user:&lt;br /&gt;
&lt;br /&gt;
 su - gvm&lt;br /&gt;
 greenbone-nvt-sync&lt;br /&gt;
&lt;br /&gt;
== Greenbone Security Assistant (GSAD) ==&lt;br /&gt;
&lt;br /&gt;
Configure Greenbone Security Assistant (GSAD) to listen to other interfaces rather than localhost only, so it is reachable from other hosts.&lt;br /&gt;
&lt;br /&gt;
Create &#039;&#039;&#039;/etc/conf.d/gsad:&#039;&#039;&#039; with:&lt;br /&gt;
 echo &#039;GSAD_LISTEN_ADDRESS=&amp;quot;0.0.0.0&amp;quot;&#039; &amp;gt; /etc/conf.d/gsad&lt;br /&gt;
&lt;br /&gt;
Start GSAD and add it to default runlevel:&lt;br /&gt;
 rc-service gsad start&lt;br /&gt;
 rc-update add gsad&lt;br /&gt;
&lt;br /&gt;
Open the browser at the IP address where GSAD is running, on http port 9392, and login with the credentials previously created.&lt;br /&gt;
&lt;br /&gt;
Happy vulnerability assestment!&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18226</id>
		<title>Setting up GVM11</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_GVM11&amp;diff=18226"/>
		<updated>2020-12-07T13:45:04Z</updated>

		<summary type="html">&lt;p&gt;Larena: Update GSAD binding settings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Greenbone Vulnerability Management (GVM) 11 =&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
OpenVAS with version 11 has been renamed in Greenbone Vulnerability Management and it is available in community repository.&lt;br /&gt;
&lt;br /&gt;
This How-To will guide you to install a complete server solution for vulnerability scanning and vulnerability management solution.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
[[Enable_Community_Repository|Enable the community repository]] and install the required packages:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add openvas openvas-config gvmd gvm-libs greenbone-security-assistant ospd-openvas}}&lt;br /&gt;
&lt;br /&gt;
= Configuration = &lt;br /&gt;
&lt;br /&gt;
== PostgreSQL  ==&lt;br /&gt;
&lt;br /&gt;
OpenVAS relies on PostgreSQL, that now is mandatory.&lt;br /&gt;
&lt;br /&gt;
Start PostgreSQL and add it to default runlevel:&lt;br /&gt;
 rc-service postgresql setup&lt;br /&gt;
 rc-service postgresql start&lt;br /&gt;
 rc-update add postgresql&lt;br /&gt;
&lt;br /&gt;
Create and configure the gvm database:&lt;br /&gt;
&lt;br /&gt;
 su - postgres&lt;br /&gt;
 createuser -DRS gvm&lt;br /&gt;
 createdb -O gvm gvmd&lt;br /&gt;
 psql gvmd&lt;br /&gt;
 create role dba with superuser noinherit;&lt;br /&gt;
 grant dba to gvm;&lt;br /&gt;
 create extension if not exists &amp;quot;uuid-ossp&amp;quot;;&lt;br /&gt;
 create extension &amp;quot;pgcrypto&amp;quot;;&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== GVMd  ==&lt;br /&gt;
&lt;br /&gt;
GVMd run as gvm user. Generate the certificate.&lt;br /&gt;
The certificate infrastructure enables GVMd to communicate in a secure manner and is used for authentication and authorization before establishing TLS connections between the daemons.&lt;br /&gt;
You can setup the certificate automatically with:&lt;br /&gt;
 su - gvm&lt;br /&gt;
 gvm-manage-certs -a&lt;br /&gt;
&lt;br /&gt;
Create credentials used to interact with gvmd:&lt;br /&gt;
&lt;br /&gt;
 gvmd --create-user=admin --password=admin&lt;br /&gt;
&lt;br /&gt;
== Update GVM definitions ==&lt;br /&gt;
&lt;br /&gt;
Download the GVM definitions and start GVMd, as root user.&lt;br /&gt;
Be patient...it will take a while: &lt;br /&gt;
&lt;br /&gt;
 greenbone-scapdata-sync&lt;br /&gt;
 greenbone-certdata-sync&lt;br /&gt;
 rc-service gvmd start&lt;br /&gt;
&lt;br /&gt;
Add gvmd to start on boot:&lt;br /&gt;
&lt;br /&gt;
 rc-update add gvmd&lt;br /&gt;
&lt;br /&gt;
NVT definitions can be downloaded as gvm user:&lt;br /&gt;
&lt;br /&gt;
 su - gvm&lt;br /&gt;
 greenbone-nvt-sync&lt;br /&gt;
&lt;br /&gt;
== Greenbone Security Assistant (GSAD) ==&lt;br /&gt;
&lt;br /&gt;
Configure Greenbone Security Assistant (GSAD) to listen to other interfaces rather than localhost only, so it is reachable from other hosts.&lt;br /&gt;
&lt;br /&gt;
Create &#039;&#039;&#039;/etc/conf.d/gsad:&#039;&#039;&#039; with:&lt;br /&gt;
 echo &#039;GSAD_LISTEN_ADDRESS=&amp;quot;0.0.0.0&amp;quot;&#039; &amp;gt; /etc/conf.d/gsad&lt;br /&gt;
&lt;br /&gt;
Start GSAD and add it to default runlevel:&lt;br /&gt;
 rc-service gsad start&lt;br /&gt;
 rc-update add gsad&lt;br /&gt;
&lt;br /&gt;
Open the browser at the IP address where GSAD is running, on http port 9392, and login with the credentials previously created.&lt;br /&gt;
&lt;br /&gt;
Happy vulnerability assestment!&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Creating_patches&amp;diff=15707</id>
		<title>Creating patches</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Creating_patches&amp;diff=15707"/>
		<updated>2019-02-06T07:32:08Z</updated>

		<summary type="html">&lt;p&gt;Larena: Specify were new aports should go and the repository dependencies.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Patches should be created with git and submitted to [mailto:alpine-aports@lists.alpinelinux.org alpine-aports] mailing list with &#039;&#039;git send-email&#039;&#039; (which needs the &#039;&#039;git-email&#039;&#039; Alpine package).&lt;br /&gt;
&lt;br /&gt;
New aports should normally go into testing repository. After a reasonable testing period if the package is complete (e.g. it has an init script, it has a working and sane default configuration, etc.) and it has a maintainer it can be moved into community repository. Main repository is for packages are either core of the linux system or are dependencies of other core packages. A package in main cannot have a dependency in community or testing.&lt;br /&gt;
&lt;br /&gt;
== Only the last commit with &#039;git send-email&#039; ==&lt;br /&gt;
&lt;br /&gt;
To submit the last commit as a patch to [mailto:alpine-aports@lists.alpinelinux.org alpine-aports] mailing list:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git send-email --to alpine-aports@lists.alpinelinux.org -1}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|You save the To-address (does not require &#039;--to alpine-aports@lists.alpinelinux.org&#039;) in the git config with: {{Cmd|git config sendemail.to alpine-aports@lists.alpinelinux.org}}}}&lt;br /&gt;
&lt;br /&gt;
The first line in commit message will be &#039;&#039;subject&#039;&#039; and the long description (separated with empty line) will be the body in the email. The example below shows &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
testing/packagename: new aport &amp;lt;- header&lt;br /&gt;
&lt;br /&gt;
https://example.com/packagename &amp;lt;- body&lt;br /&gt;
wonderful package&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|The git send-email command is provided by the &#039;&#039;&#039;git-email&#039;&#039;&#039; package (&#039;&#039;&#039;git-perl&#039;&#039;&#039; in v2.7 and older). }}&lt;br /&gt;
&lt;br /&gt;
See [[Development using git#Email_configuration]] on how configure SMTP Auth.&lt;br /&gt;
&lt;br /&gt;
== Multiple commits with &#039;git send-email&#039; ==&lt;br /&gt;
&lt;br /&gt;
If you have many commits you can create a directory with patches and send them with &amp;lt;tt&amp;gt;git send-email&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;rm -Rf patches&lt;br /&gt;
mkdir patches&lt;br /&gt;
git format-patch -o patches origin&lt;br /&gt;
git send-email patches --compose --no-chain-reply-to --to alpine-aports@lists.alpinelinux.org&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You can also format patches for the last x number of commits with:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;git format-patch -x -o patches&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This will produce the patches for each local commit in the directory &amp;quot;patches&amp;quot; and send them.&lt;br /&gt;
Use &#039;&#039;&#039;--no-chain-reply-to&#039;&#039;&#039; to avoid that each patch is sent as a &#039;&#039;reply&#039;&#039; to the previous patch.&lt;br /&gt;
&lt;br /&gt;
Eg.&lt;br /&gt;
* [PATCH 0/m]&lt;br /&gt;
** [PATCH 1/m]&lt;br /&gt;
*** [PATCH 2/m]&lt;br /&gt;
**** ...&lt;br /&gt;
&lt;br /&gt;
With the option &#039;&#039;&#039;--no-chain-reply-to&#039;&#039;&#039; the patches will be sent as a reply to the first email, the &#039;&#039;cover letter&#039;&#039; (the [PATCH 0/m]) and will make the email thread nicer.&lt;br /&gt;
Like this:&lt;br /&gt;
* [PATCH 0/m]&lt;br /&gt;
** [PATCH 1/m]&lt;br /&gt;
** [PATCH 2/m]&lt;br /&gt;
** ..&lt;br /&gt;
&lt;br /&gt;
== Resend an updated patch ==&lt;br /&gt;
Sometimes patches are rejected due to minor issues in the patch. Do not send an incremental patch on top of your initial, bad, patch. Instead, recreate the patch and send a new, fixed version of your patch. (use &#039;&#039;git commit --amend&#039;&#039; to edit a local commit).&lt;br /&gt;
&lt;br /&gt;
When you sending a second version of the patch use &#039;&#039;&#039;--subject-prefix &amp;quot;PATCH v2&amp;quot;&#039;&#039;&#039; to indicate that this is a new version of a previously sent patch. You may also use &#039;&#039;&#039;--in-reply-to &amp;lt;message-id&amp;gt;&#039;&#039;&#039; where &amp;lt;message-id&amp;gt; the the id of email requesting the resend.&lt;br /&gt;
&lt;br /&gt;
You should also write a note on the what was changed. Use &#039;&#039;&#039;--annotate&#039;&#039;&#039; for this and write the comment under the three dashes &amp;quot;---&amp;quot; so the note is not included in the commit message. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Subject: [PATCH v2] testing/mypackage: new aport&lt;br /&gt;
&lt;br /&gt;
https://example.com&lt;br /&gt;
Example package&lt;br /&gt;
---&lt;br /&gt;
Changes v1 -&amp;gt; v2:&lt;br /&gt;
 - removed depends&lt;br /&gt;
 - added zlib-dev to makedepends&lt;br /&gt;
&lt;br /&gt;
 testing/mypackage/APKBUILD | 41 +++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
 1 file changed, 41 insertions(+)&lt;br /&gt;
 create mode 100644 testing/mypackage/APKBUILD&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the notes that are below the &amp;quot;---&amp;quot; will not be included in the commit message.&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Patch Workflow]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:Releases&amp;diff=15509</id>
		<title>Alpine Linux:Releases</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:Releases&amp;diff=15509"/>
		<updated>2018-11-19T15:46:28Z</updated>

		<summary type="html">&lt;p&gt;Larena: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several releases of Alpine Linux available at the same time. There is no fixed release cycle but rather every 6 month we make a snapshot of &#039;&#039;&#039;[[Edge|edge]]&#039;&#039;&#039; and make a release. We support each stable release for a certain time, normally for 2 years. We can do security fixes beyond that on request and when patches are available.&lt;br /&gt;
 &lt;br /&gt;
The latest release of Alpine Linux is: &#039;&#039;&#039;3.8.1&#039;&#039;&#039; [https://alpinelinux.org/posts/Alpine-3.8.1-released.html Release notes], [http://git.alpinelinux.org/cgit/aports/log/?h=v3.8.1 git log]&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;5&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Branch&lt;br /&gt;
! Branch Date&lt;br /&gt;
! Latest Release&lt;br /&gt;
! Previous minor releases&lt;br /&gt;
! Directory name&lt;br /&gt;
! Updates&lt;br /&gt;
! End of Support&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;[[edge]]&#039;&#039;&#039;&lt;br /&gt;
| current&lt;br /&gt;
| rolling&lt;br /&gt;
| -&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/edge/ edge]&lt;br /&gt;
| development&lt;br /&gt;
| n/a&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.8&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.8-stable 2018-06-26]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.8.1-released.html 3.8.1]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.8.0-released.html 3.8.0]&lt;br /&gt;
| [http://dl-cdn.alpinelinux.org/alpine/v3.8/ v3.8] &lt;br /&gt;
| bug fixes&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;2020-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.7&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.7-stable 2017-11-30]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.7.0-released.html 3.7.0]&lt;br /&gt;
| -&lt;br /&gt;
| [http://dl-cdn.alpinelinux.org/alpine/v3.7/ v3.7] &lt;br /&gt;
| bug fixes&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;2019-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.6&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.6-stable 2017-05-24]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.6.2-released.html 3.6.2]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.6.0-released.html 3.6.0], [http://alpinelinux.org/posts/Alpine-3.6.1-released.html 3.6.1]&lt;br /&gt;
| [http://dl-cdn.alpinelinux.org/alpine/v3.6/ v3.6] &lt;br /&gt;
| security only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;2019-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.5&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.5-stable 2016-12-22]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.5.2-released.html 3.5.2]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.5.0-released.html 3.5.0], [http://alpinelinux.org/posts/Alpine-3.5.1-released.html 3.5.1]&lt;br /&gt;
| [http://dl-cdn.alpinelinux.org/alpine/v3.5/ v3.5] &lt;br /&gt;
| security only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: orange;&amp;quot;&amp;gt;2018-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.4&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.4-stable 2016-05-31]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.4.6-released.html 3.4.6]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.4.0-released.html 3.4.0], [http://alpinelinux.org/posts/Alpine-3.4.1-released.html 3.4.1], [http://alpinelinux.org/posts/Alpine-3.4.2-released.html 3.4.2], [http://alpinelinux.org/posts/Alpine-3.4.3-released.html 3.4.3], [http://alpinelinux.org/posts/Alpine-3.4.4-released.html 3.4.4], [http://alpinelinux.org/posts/Alpine-3.4.5-released.html 3.4.5]&lt;br /&gt;
| [http://dl-cdn.alpinelinux.org/alpine/v3.4/ v3.4]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2018-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.3&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.3-stable 2016-01-06]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.3.3-released.html 3.3.3]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.3.0-released.html 3.3.0], [http://alpinelinux.org/posts/Alpine-3.3.1-released.html 3.3.1], [http://alpinelinux.org/posts/Alpine-3.3.2-released.html 3.3.2]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v3.3/ v3.3]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2017-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.2&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.2-stable 2015-05-26]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.2.3-released.html 3.2.3]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.2.0-released.html 3.2.0], [http://alpinelinux.org/posts/Alpine-3.2.1-released.html 3.2.1], [http://alpinelinux.org/posts/Alpine-3.2.2-released.html 3.2.2]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v3.2/ v3.2]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2017-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.1&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.1-stable 2014-12-10]&lt;br /&gt;
| [http://alpinelinux.org/posts/Alpine-3.1.4-released.html 3.1.4]&lt;br /&gt;
| [http://alpinelinux.org/release-3.1.0 3.1.0], [http://alpinelinux.org/release-3.1.1 3.1.1], [http://alpinelinux.org/posts/Alpine-3.1.2-released.html 3.1.2], [http://alpinelinux.org/posts/Alpine-3.1.3-released.html 3.1.3]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v3.1/ v3.1]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2016-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v3.0&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=3.0-stable 2014-06-04]&lt;br /&gt;
| [http://alpinelinux.org/release-3.0.6 3.0.6]&lt;br /&gt;
| [http://alpinelinux.org/release-3.0.0 3.0.0], [http://alpinelinux.org/release-3.0.1 3.0.1], [http://alpinelinux.org/release-3.0.2 3.0.2], [http://alpinelinux.org/release-3.0.3 3.0.3], [http://alpinelinux.org/release-3.0.4 3.0.4], [http://alpinelinux.org/release-3.0.5 3.0.5]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v3.0/ v3.0]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2016-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.7&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.7-stable 2013-11-08]&lt;br /&gt;
| [http://alpinelinux.org/release-2.7.9 2.7.9]&lt;br /&gt;
| [http://alpinelinux.org/release-2.7.0 2.7.0], [http://alpinelinux.org/release-2.7.1 2.7.1], [http://alpinelinux.org/release-2.7.2 2.7.2], [http://alpinelinux.org/release-2.7.3 2.7.3], [http://alpinelinux.org/release-2.7.4 2.7.4], [http://alpinelinux.org/release-2.7.5 2.7.5], [http://alpinelinux.org/release-2.7.6 2.7.6], [http://alpinelinux.org/release-2.7.7 2.7.7], [http://alpinelinux.org/release-2.7.8 2.7.8]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.7/ v2.7]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2015-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.6&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.6-stable 2013-05-17]&lt;br /&gt;
| [http://alpinelinux.org/release-2.6.6 2.6.6]&lt;br /&gt;
| [http://alpinelinux.org/release-2.6.0 2.6.0], [http://alpinelinux.org/release-2.6.1 2.6.1], [http://alpinelinux.org/release-2.6.2 2.6.2], [http://alpinelinux.org/release-2.6.3 2.6.3], [http://alpinelinux.org/release-2.6.4 2.6.4], [http://alpinelinux.org/release-2.6.5 2.6.5]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.6/ v2.6]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2015-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.5&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.5-stable 2012-11-07]&lt;br /&gt;
| [http://alpinelinux.org/release-2.5.4 2.5.4]&lt;br /&gt;
| [http://alpinelinux.org/release-2.5.0 2.5.0], [http://alpinelinux.org/release-2.5.1 2.5.1], [http://alpinelinux.org/release-2.5.2 2.5.2], [http://alpinelinux.org/release-2.5.3 2.5.3]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.5/ v2.5]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2014-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.4&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.4-stable 2012-05-02]&lt;br /&gt;
| [http://alpinelinux.org/release-2.4.11 2.4.11]&lt;br /&gt;
| [http://alpinelinux.org/node/13811 2.4.0], [http://alpinelinux.org/node/13812 2.4.1], [http://alpinelinux.org/node/13845 2.4.2], [http://alpinelinux.org/node/13906 2.4.3], [http://alpinelinux.org/release-2.4.4 2.4.4], [http://alpinelinux.org/release-2.4.5 2.4.5], [http://alpinelinux.org/release-2.4.6 2.4.6], [http://alpinelinux.org/release-2.4.7 2.4.7], 2.4.8, [http://alpinelinux.org/node/14664 2.4.9], [http://alpinelinux.org/release-2.4.10 2.4.10]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.4/ v2.4]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2014-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.3&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.3-stable 2011-11-01]&lt;br /&gt;
| [http://alpinelinux.org/node/13503 2.3.6]&lt;br /&gt;
| [http://alpinelinux.org/node/6841 2.3.0], [http://alpinelinux.org/node/6866 2.3.1], [http://alpinelinux.org/node/6911 2.3.2], [http://alpinelinux.org/node/6999 2.3.3], [http://alpinelinux.org/node/13466 2.3.4 &amp;amp; 2.3.5]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.3/ v2.3]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2013-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.2&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.2-stable 2011-05-03]&lt;br /&gt;
| [http://alpinelinux.org/node/6455 2.2.3]&lt;br /&gt;
| [http://alpinelinux.org/node/5237 2.2.0], [http://lists.alpinelinux.org/alpine-devel/1618.html 2.2.1], [http://alpinelinux.org/node/5955 2.2.2]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.2/ v2.2]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2013-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.1&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.1-stable 2010-11-01]&lt;br /&gt;
| [http://alpinelinux.org/node/5236 2.1.6]&lt;br /&gt;
| [[Release_Notes_for_Alpine_2.1.0|2.1.0]], [[Release_Notes_for_Alpine_2.1.1|2.1.1]], [[Release_Notes_for_Alpine_2.1.2|2.1.2]], [[Release_Notes_for_Alpine_2.1.3|2.1.3]], [http://alpinelinux.org/node/5230 2.1.4], [http://alpinelinux.org/node/5235 2.1.5]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.1/ v2.1]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2012-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.0&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.0-stable 2010-08-16]&lt;br /&gt;
| [http://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_2.0.3 2.0.3]&lt;br /&gt;
| [[Release_Notes_for_Alpine_2.0.0|2.0.0]], [[Release_Notes_for_Alpine_2.0.1|2.0.1]], [[Release_Notes_for_Alpine_2.0.2|2.0.2]]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.0/ v2.0]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2012-04-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
An archive for [[older releases]] is also available.&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_Reference&amp;diff=14448</id>
		<title>APKBUILD Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_Reference&amp;diff=14448"/>
		<updated>2018-02-07T07:31:39Z</updated>

		<summary type="html">&lt;p&gt;Larena: don&amp;#039;t include $install in $source&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;APKBUILDs are the scripts that are created in order to build Alpine packages using the [[abuild]] tool.&lt;br /&gt;
&lt;br /&gt;
See [[aports]] for details on Alpine&#039;s official ports repository.&lt;br /&gt;
&lt;br /&gt;
This page is intended to serve as a reference for creating APKBUILDs; if this is your first time creating a package for Alpine Linux, please see [[Creating an Alpine package]].&lt;br /&gt;
&lt;br /&gt;
= Legend =&lt;br /&gt;
The following notes will assist you in understanding this document.&lt;br /&gt;
&lt;br /&gt;
In description text:&lt;br /&gt;
* If a variable is not prefixed with a &#039;&#039;$&#039;&#039;, it will be represented by italics (i.e., &#039;&#039;srcdir&#039;&#039; ).&lt;br /&gt;
* Functions will also be represented by italics, but will also end with a pair of parentheses (i.e., &#039;&#039;build()&#039;&#039; ).&lt;br /&gt;
* Shell commands will be represented &amp;lt;code&amp;gt;like this&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variables =&lt;br /&gt;
{{Note|Variables that contain a path (e.g. &#039;&#039;$srcdir&#039;&#039; and &#039;&#039;$pkgdir&#039;&#039;) should always be quoted using double quotes (i.e., &#039;&#039;&amp;quot;$srcdir&amp;quot;&#039;&#039;).  This is done to prevent things from breaking, should the user have the APKBUILD in a directory path that contains spaces.}}&lt;br /&gt;
{{Note|All arbitrary variable and function names should be prefixed with an underscore character ( _ ) to avoid name clashes with the internals of abuild (for example, &#039;&#039;_luaversions&#039;&#039;).}}&lt;br /&gt;
&lt;br /&gt;
== abuild-defined variables ==&lt;br /&gt;
The following variables are defined by abuild:&lt;br /&gt;
&lt;br /&gt;
==== startdir ====&lt;br /&gt;
: The directory where the APKBUILD script is.&lt;br /&gt;
==== srcdir ====&lt;br /&gt;
: The directory where sources, from the &#039;&#039;source&#039;&#039; variable, are downloaded to and unpacked to.&lt;br /&gt;
==== pkgdir ====&lt;br /&gt;
: This directory should receive the files for the main package.  For example, a normal [http://en.wikipedia.org/wiki/GNU_build_system autotools] package would have &amp;lt;code&amp;gt;make DESTDIR=&amp;quot;$pkgdir&amp;quot; install&amp;lt;/code&amp;gt; in the &#039;&#039;package()&#039;&#039; function.&lt;br /&gt;
==== subpkgdir ====&lt;br /&gt;
: This directory should receive the files for a subpackage. This variable should only be used from subpackage functions.&lt;br /&gt;
==== builddir ====&lt;br /&gt;
: This variable should point to the directory inside the &#039;&#039;srcdir&#039;&#039; where the main package source is unpacked.  This is typically &#039;&#039;$srcdir/$pkgname-$pkgver&#039;&#039;.  It’s used by the default &#039;&#039;prepare()&#039;&#039; function as a working directory when applying patches.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User-defined variables ==&lt;br /&gt;
The following variables should be defined by the user:&lt;br /&gt;
==== arch ====&lt;br /&gt;
: Package architecture(s) to build for.  Can be one of: &#039;&#039;&#039;[[x86]], [[x86_64]], [[armhf]], [[aarch64]], [[ppc64le]], [[s390x]], all&#039;&#039;&#039;, or &#039;&#039;&#039;noarch&#039;&#039;&#039;, where &#039;&#039;&#039;all&#039;&#039;&#039; means all architectures, and &#039;&#039;&#039;noarch&#039;&#039;&#039; means it&#039;s architecture-independent (e.g., a pure-python package).&lt;br /&gt;
: {{Tip|To determine if your APKBUILD can use &#039;&#039;&#039;noarch&#039;&#039;&#039;: First specify &#039;&#039;&#039;all&#039;&#039;&#039; and then build the package by executing &amp;lt;code&amp;gt;abuild -r&amp;lt;/code&amp;gt;.  Watch the output towards the end for warnings saying that &#039;&#039;&#039;noarch&#039;&#039;&#039; can be used.  If the main package and all subpackages, if you have any subpackages, give a warning saying that &#039;&#039;&#039;noarch&#039;&#039;&#039; can be used, then you can use &#039;&#039;&#039;noarch&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
==== depends ====&lt;br /&gt;
: Run-time dependency package(s) that are not shared-object dependencies.  Shared objects dependencies are auto-detected and should not be specified here.&lt;br /&gt;
==== depends_dev ====&lt;br /&gt;
: Run-time dependency package(s) for the &#039;&#039;&#039;$pkgname-dev&#039;&#039;&#039; subpackage.&lt;br /&gt;
&lt;br /&gt;
: {{Note|From ncopa on IRC: To find out if you need to add a package to depends_dev have a look at *requires* in usr/lib/pkgconfig/*.pc. With libtool it gets more complicated, but we should delete the .la files. Also check if there are any  /usr/bin/*-configure #!/bin/bash #!/usr/bin/perl or Python. Sometimes scripts or similar are generated at build time (i.e autoconf automake) then you normally don&#039;t need add those to depends_dev. You can also just add all -dev makedepends to depends_dev but it will slow the build process a little bit (more build dependencies).}}&lt;br /&gt;
==== giturl ====&lt;br /&gt;
:Git repository from which &amp;lt;code&amp;gt;abuild checkout&amp;lt;/code&amp;gt; checks out. You can checkout a specific branch in git by adding &amp;lt;code&amp;gt;-b $branch&amp;lt;/code&amp;gt;.&lt;br /&gt;
==== install ====&lt;br /&gt;
: There are 6 different types of install scripts.  Install scripts are named &#039;&#039;&#039;$pkgname.action&#039;&#039;&#039;, where &#039;&#039;&#039;action&#039;&#039;&#039; can be:  &#039;&#039;&#039;pre-install, post-install, pre-upgrade, post-upgrade, pre-deinstall&#039;&#039;&#039;, or &#039;&#039;&#039;post-deinstall&#039;&#039;&#039;.  For example, if &#039;&#039;pkgname&#039;&#039; is set to &#039;&#039;&#039;mypackage&#039;&#039;&#039; and &#039;&#039;install&#039;&#039; is set to &#039;&#039;&#039;$pkgname.post-install&#039;&#039;&#039;, then a script named &#039;&#039;&#039;mypackage.post-install&#039;&#039;&#039; must exist along-side the APKBUILD.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;{{Note|Always use &amp;lt;code&amp;gt;/bin/sh&amp;lt;/code&amp;gt; for the command-line interpreter on the [http://en.wikipedia.org/wiki/Shebang_%28Unix%29 shebang line] of your install scripts.}}&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following are the different types of install scripts in detail:&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-install =====&lt;br /&gt;
: This script is executed &#039;&#039;before installing&#039;&#039; the package.  Typical use is when the package needs a group and a user to be created. For example:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
addgroup -S clamav 2&amp;gt;/dev/null&lt;br /&gt;
adduser -S -D -H -s /bin/false -G clamav -g clamav clamav 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If the script exits with a failure (e.g., if the user already exists), the package will not be installed and &amp;lt;code&amp;gt;apk&amp;lt;/code&amp;gt; will exit with failure, hence the &amp;lt;code&amp;gt;exit 0&amp;lt;/code&amp;gt; at the end.}}&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-install =====&lt;br /&gt;
: This script is executed &#039;&#039;after installing&#039;&#039; the package.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-upgrade =====&lt;br /&gt;
: This script is executed &#039;&#039;before upgrading/downgrading/reinstalling&#039;&#039; the package. Note that exiting with failure will not cause apk to exit with failure, but will mark the package as broken.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-upgrade =====&lt;br /&gt;
: This script is executed &#039;&#039;after upgrading/downgrading/reinstalling&#039;&#039; the package.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-deinstall =====&lt;br /&gt;
: This script is executed &#039;&#039;before uninstalling&#039;&#039; the package.&lt;br /&gt;
: {{Note|If the script exits with failure, &amp;lt;code&amp;gt;apk&amp;lt;/code&amp;gt; will not uninstall the package.}}&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-deinstall =====&lt;br /&gt;
: This script is executed &#039;&#039;after uninstalling&#039;&#039; the package.&lt;br /&gt;
&lt;br /&gt;
==== install_if ====&lt;br /&gt;
:install_if can be used when a package needs to be installed when some packages are already installed or are in the dependency tree. It works in reverse to the &#039;&#039;recommends&#039;&#039; feature, that other package managers provide.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Example:&#039;&#039;&#039; When package &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; has &amp;lt;code&amp;gt;install_if=&amp;quot;B C&amp;quot;&amp;lt;/code&amp;gt;, and the user runs &amp;lt;code&amp;gt;apk add B C&amp;lt;/code&amp;gt;, then package &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; will get automatically installed.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Example 2:&#039;&#039;&#039; A real use-case in Alpine is open-vm-tools. Currently it contains the userspace tools and separate packages for the kernel modules (grsec and vserver). When we install the userspace tools, apk should automatically install the correct kernel modules and will need to figure out for which kernel. This is where install_if jumps in. For any of the kernel modules package we would use:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;install_if=&amp;quot;linux-${_flavor}=${_kernelver} open-vm-tools&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This will automatically install the package when the specified packages are installed or are in dependency tree.&lt;br /&gt;
&lt;br /&gt;
==== license ====&lt;br /&gt;
: License(s) for the package, for example &amp;lt;code&amp;gt;GPL-3.0-or-later&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BSD-2-Clause&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MIT&amp;lt;/code&amp;gt; [[Creating_an_Alpine_package#license|(details)]].&lt;br /&gt;
&lt;br /&gt;
==== makedepends ====&lt;br /&gt;
: Build-time dependency package(s).&lt;br /&gt;
==== md5sums/sha256sums/sha512sums ====&lt;br /&gt;
: Checksums for the files/URLs listed in &#039;&#039;source&#039;&#039;.  The checksums are normally generated and updated by executing &amp;lt;code&amp;gt;abuild checksum&amp;lt;/code&amp;gt; and should be the last item in the APKBUILD.&lt;br /&gt;
&lt;br /&gt;
New packages should use only sha512sums.&lt;br /&gt;
&lt;br /&gt;
==== options ====&lt;br /&gt;
: Build-time options for the package.&lt;br /&gt;
&lt;br /&gt;
: {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!archcheck&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not try to verify that the architecture of the binary files is the same architecture as abuild should build for. One example where it makes sense to set this are packages with firmware files, that get executed on another CPU (such as WiFi firmware).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!check&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not try to run the &amp;lt;code&amp;gt;check()&amp;lt;/code&amp;gt; function. Please always add a short comment after the &amp;lt;code&amp;gt;!check&amp;lt;/code&amp;gt; about why it&#039;s disabled. [https://github.com/alpinelinux/aports/pull/2322#discussion_r142545300] Creating a very simple check function, that calls &amp;lt;code&amp;gt;program --version&amp;lt;/code&amp;gt; is better than disabling tests completely. [https://github.com/alpinelinux/aports/pull/2322#discussion_r142543002]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!strip&amp;lt;/code&amp;gt;&lt;br /&gt;
| Avoid stripping symbols from binaries.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;suid&amp;lt;/code&amp;gt;&lt;br /&gt;
| Allow [https://en.wikipedia.org/wiki/Setuid setuid] binaries.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!tracedeps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not automatically find dependencies (e.g. by using &amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; to find dynamic libraries, which the resulting binary links against).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== pkgdesc ====&lt;br /&gt;
: A brief, one-line description of what the package does.&lt;br /&gt;
&lt;br /&gt;
: Here&#039;s an example from the OpenSSH client package:&lt;br /&gt;
: &amp;lt;pre&amp;gt;pkgdesc=&amp;quot;Port of OpenBSD&#039;s free SSH release - client&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== pkggroups ====&lt;br /&gt;
: System group(s) to be created during build-time.  System group(s) should also be created in the &#039;&#039;&#039;[[APKBUILD Reference#.24pkgname.pre-install|$pkgname.pre-install]]&#039;&#039;&#039; script, so that the system group(s) are also created prior to package installation for run-time use.&lt;br /&gt;
==== pkgname ====&lt;br /&gt;
: The name of the package.  All letters should be lowercase.&lt;br /&gt;
: {{Note|When creating an APKBUILD of a module or library for another package, we use some common package prefixes, such as: &#039;&#039;lua-&#039;&#039;, &#039;&#039;perl-&#039;&#039;, &#039;&#039;php-&#039;&#039;, and &#039;&#039;py-&#039;&#039;.  Search aports for other common prefixes.}}&lt;br /&gt;
&lt;br /&gt;
==== pkgrel ====&lt;br /&gt;
: Alpine package release number.  Starts at 0 (zero).  Always increment &#039;&#039;pkgrel&#039;&#039; when making updates to an aport; reset &#039;&#039;pkgrel&#039;&#039; to 0 (zero) when incrementing &#039;&#039;pkgver&#039;&#039;.&lt;br /&gt;
==== pkgusers ====&lt;br /&gt;
: System user(s) to be created during build-time.  System user(s) should also be created in the &#039;&#039;&#039;[[APKBUILD Reference#.24pkgname.pre-install|$pkgname.pre-install]]&#039;&#039;&#039; script, so that the system user(s) are also created prior to package installation for run-time use.&lt;br /&gt;
==== pkgver ====&lt;br /&gt;
: The version of the software being packaged. Format for valid versions: &amp;lt;code&amp;gt;{digit}{.digit}...{letter}{_suf{#}}...{-r#}&amp;lt;/code&amp;gt; [https://git.alpinelinux.org/cgit/apk-tools/tree/src/version.c#n17]&lt;br /&gt;
: A Suffix &amp;lt;code&amp;gt;suf&amp;lt;/code&amp;gt; in the above format can be one of the following to indicate that the release is &#039;&#039;less recent&#039;&#039; than the version without the suffix: &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;beta&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pre&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rc&amp;lt;/code&amp;gt; [https://git.alpinelinux.org/cgit/apk-tools/tree/src/version.c#n75]&lt;br /&gt;
: These are for indicating &#039;&#039;more recent&#039;&#039; releases: &amp;lt;code&amp;gt;cvs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;svn&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt; [https://git.alpinelinux.org/cgit/apk-tools/tree/src/version.c#n76]&lt;br /&gt;
: All other suffices are invalid. To package a specific git commit, the date of the commit gets appended to the latest release, e.g. &amp;lt;code&amp;gt;1.0.0_git20180204&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== provides ====&lt;br /&gt;
: List of package names (and optionally version info) this package provides.&lt;br /&gt;
&lt;br /&gt;
: If package with a version is provided (provides=&#039;foo=1.2&#039;) apk will consider it as an alternate name and it will automatically consider the package for installation by the alternate name, and conflict with other packages having the same name, or provides.&lt;br /&gt;
&lt;br /&gt;
: If version is not provided (provides=&#039;foo&#039;), apk will consider it as virtual package name. Several package with same non-versioned provides can be installed simultaneously. However, none of them will be installed by default when requested by the virtual name - instead, error message is given and user is asked to choose which package providing the virtual name should be installed.&lt;br /&gt;
==== provider_priority ====&lt;br /&gt;
: A numeric value which is used by apk-tools to break ties when choosing a virtual package to satisfy a dependency. Higher values have higher priority. The primary use case is to specify the primary package that satisfies a virtual (provider).&lt;br /&gt;
==== replaces ====&lt;br /&gt;
: Package(s) that this package replaces.  This package will &amp;quot;take over&amp;quot; files owned by packages listed in the &#039;&#039;replaces&#039;&#039; variable.  This is useful when files move from one package to another, or when a package gets renamed.&lt;br /&gt;
==== replaces_priority ====&lt;br /&gt;
: The priority of the replaces. If multiple packages replace each other, then will the package with highest &#039;&#039;replaces_priority&#039;&#039; win.&lt;br /&gt;
==== source ====&lt;br /&gt;
: The source variable is not only used to list the remote source files to fetch, it is also used to list the local files that abuild will need in order to build the apk. Examples of such local files include: init.d files, conf.d files, install files (see [[APKBUILD Reference#install|install variable]]), patches, and all other necessary files.&lt;br /&gt;
&lt;br /&gt;
: Here are few things to note:&lt;br /&gt;
&lt;br /&gt;
:* When you are finished adding local and/or remote files to &#039;&#039;source&#039;&#039;, you can execute the following command to add their checksums to the APKBUILD file:&lt;br /&gt;
:: {{Cmd|abuild checksum}}&lt;br /&gt;
:: {{Note|When later updating the content of &#039;&#039;source&#039;&#039;, or updating a file that is listed in &#039;&#039;source&#039;&#039;, you must also update their checksums again with the same command.}}&lt;br /&gt;
&lt;br /&gt;
:* When the remote file is hosted at SourceForge, it&#039;s best to specify the special mirrors link used by SourceForge:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: (or similar depending on the package).&lt;br /&gt;
&lt;br /&gt;
:* You can set target filename (eg &#039;save as...&#039;) by prefixing the URI with &#039;&#039;filename::&#039;&#039;. This is useful when the remote filename is not specified in the URI (ie, does not end in &#039;/software-1.0.tar.gz&#039;), such as:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;http://oss.example.org/?get=software&amp;amp;ver=1.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: or when the filename is braindead, like githubs&#039; download tags:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;https://github.com/software/software/archive/v$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: The above two examples needs a target filename prefix:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;$pkgname-$pkgver.tar.gz::http://oss.example.org/?get=software&amp;amp;ver=$pkgver&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: and:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;$pkgname-$pkgver.tar.gz::https://github.com/software/software/archive/v$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* abuild currently supports the following protocols for remote file retrieval:&lt;br /&gt;
:** http&lt;br /&gt;
:** https&lt;br /&gt;
:** ftp&lt;br /&gt;
&lt;br /&gt;
:* abuild currently supports the following archive types/archive file extensions:&lt;br /&gt;
:** .tar.gz / .tgz&lt;br /&gt;
:** .tar.bz2&lt;br /&gt;
:** .tar.lzma&lt;br /&gt;
:** .tar.xz&lt;br /&gt;
:** .zip&lt;br /&gt;
&lt;br /&gt;
:: {{Note|Legacy APKBUILD scripts define &#039;&#039;source&#039;&#039; variable as &amp;quot;saveas-[brain-dead-url]/[target-filename]&amp;quot; format instead of the modern [target-filename]::[brain-dead-url].&amp;lt;br /&amp;gt;&#039;&#039;BAD&#039;&#039;:   source&amp;amp;#61;&amp;quot;saveas-http://releases.ddvtech.com/download.php?pack&amp;amp;#61;libmist_dist&amp;amp;ver&amp;amp;#61;RC/$pkgname-$pkgver.tar.gz&amp;quot;&amp;lt;br /&amp;gt;&#039;&#039;GOOD&#039;&#039;:   source&amp;amp;#61;$pkgname-$pkgver.tar.gz::http://releases.ddvtech.com/download.php?pack&amp;amp;#61;libmist_dist&amp;amp;ver&amp;amp;#61;RC&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
==== subpackages ====&lt;br /&gt;
: Subpackages built from this APKBUILD.  abuild will parse this variable and try to find a subpackage split function.  The split function must &#039;&#039;move&#039;&#039; files that do not belong in the main package, from &#039;&#039;$pkgdir&#039;&#039; to &#039;&#039;$subpkgdir&#039;&#039;.  Files and directories can also be &#039;&#039;copied&#039;&#039; from &#039;&#039;$startdir&#039;&#039; and &#039;&#039;$srcdir&#039;&#039; to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: The split function can be specified in 1 of 3 different methods:&lt;br /&gt;
:# subpkgname:&#039;&#039;&#039;splitfunc&#039;&#039;&#039;&lt;br /&gt;
:# $pkgname-&#039;&#039;&#039;splitfunc&#039;&#039;&#039;&lt;br /&gt;
:# &#039;&#039;&#039;splitfunc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: {{Note|Split function names &#039;&#039;&#039;cannot&#039;&#039;&#039; use hyphens; use the first method above if the subpackage name contains a hyphen (-) character, like this: &#039;&#039;subpkg-name:subpkg_name&#039;&#039;, where &amp;lt;code&amp;gt;subpkg-name&amp;lt;/code&amp;gt; is the name of the &#039;&#039;&#039;subpackage&#039;&#039;&#039; and &amp;lt;code&amp;gt;subpkg_name&amp;lt;/code&amp;gt; is the name of the &#039;&#039;&#039;subpackage&#039;s split function&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
: {{Tip|For more information, see the [[APKBUILD_examples:Subpackages|Subpackages example]].}}&lt;br /&gt;
&lt;br /&gt;
==== triggers ====&lt;br /&gt;
: Apk-tools can &amp;quot;monitor&amp;quot; directories and execute a trigger if any package installed/uninstalled any file in the monitored dir. The triggers are always execute after the apk action (install, uninstall, upgrade).&lt;br /&gt;
&lt;br /&gt;
: The triggers are specified in the format: &#039;&#039;scriptname&#039;&#039;=&#039;&#039;pathlist&#039;&#039; where &#039;&#039;scriptname&#039;&#039; is the (sub)package name + .trigger suffix and pathlist is : separated list of the dirs to monitor.&lt;br /&gt;
&lt;br /&gt;
: The &#039;&#039;&#039;triggers&#039;&#039;&#039; variable must include the triggers for subpackages too if they have any.&lt;br /&gt;
&lt;br /&gt;
: It is possible to use wildcards (*) in the dir list.&lt;br /&gt;
&lt;br /&gt;
==== url ====&lt;br /&gt;
: The homepage for the package.  This is to help users find upstream documentation and other information regarding the package.&lt;br /&gt;
&lt;br /&gt;
= Functions =&lt;br /&gt;
{{Note|All functions should consider the current working directory as undefined, and should therefore use the [[APKBUILD Reference#abuild-defined_variables|abuild-defined directory variables]] to their advantage.}}&lt;br /&gt;
&lt;br /&gt;
== abuild-defined functions ==&lt;br /&gt;
The following functions are provided by abuild and can be overridden:&lt;br /&gt;
&lt;br /&gt;
==== fetch() ====&lt;br /&gt;
: Downloads remote sources listed in &#039;&#039;source&#039;&#039; to &#039;&#039;SRCDEST&#039;&#039; (&#039;&#039;SRCDEST&#039;&#039; is configured in &#039;&#039;/etc/abuild.conf&#039;&#039;) and creates symlinks in &#039;&#039;$srcdir&#039;&#039;.&lt;br /&gt;
==== unpack() ====&lt;br /&gt;
: Unpacks .tgz, .tar.gz, .tar.bz2, .tar.lzma, .tar.xz, and .zip archives in &#039;&#039;$srcdir&#039;&#039; to &#039;&#039;$srcdir&#039;&#039;.&lt;br /&gt;
==== dev() ====&lt;br /&gt;
: Subpackage function for the &#039;&#039;&#039;$pkgname-dev&#039;&#039;&#039; package.  Without specifying a custom &#039;&#039;dev()&#039;&#039; function, abuild will call it&#039;s internal &#039;&#039;dev()&#039;&#039; function, which in turn calls &#039;&#039;default_dev()&#039;&#039;, which will move &#039;&#039;&amp;quot;$pkgdir&amp;quot;/usr/include&#039;&#039;, &#039;&#039;*.a&#039;&#039;, &#039;&#039;*.la&#039;&#039; and similar files to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
==== doc() ====&lt;br /&gt;
: Subpackage function for the &#039;&#039;&#039;$pkgname-doc&#039;&#039;&#039; package.  Without specifying a custom &#039;&#039;doc()&#039;&#039; function, abuild will call it&#039;s internal &#039;&#039;doc()&#039;&#039; function, which in turn calls &#039;&#039;default_doc()&#039;&#039;, which will move &#039;&#039;&amp;quot;$pkgdir&amp;quot;/usr/share/doc&#039;&#039;, &#039;&#039;&amp;quot;$pkgdir&amp;quot;/usr/share/man&#039;&#039; and similar to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== User-defined functions ==&lt;br /&gt;
The following functions should be defined by the user: &lt;br /&gt;
&lt;br /&gt;
==== prepare() ====&lt;br /&gt;
: {{note|Please adjust old APKBUILDs, which still have a &#039;&#039;prepare()&#039;&#039; function that does the same as the &#039;&#039;default_prepare()&#039;&#039; when you edit them anyway.}}&lt;br /&gt;
: &#039;&#039;&#039;&#039;&#039;Optional&#039;&#039;.&#039;&#039;&#039;  Used for build preparation: patches, etc, should be applied here. When you don&#039;t specify a custom &#039;&#039;prepare()&#039;&#039;, the built-in &#039;&#039;default_prepare()&#039;&#039; from abuild will be used. It applies patches already (always prepare them in the &amp;lt;code&amp;gt;-p1&amp;lt;/code&amp;gt; format), so &#039;&#039;&#039;usually it makes sense to not create a custom &#039;&#039;prepare()&#039;&#039; function at all!&#039;&#039;&#039; If you do create one, call &#039;&#039;default_prepare()&#039;&#039; inside it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
prepare() {&lt;br /&gt;
    default_prepare&lt;br /&gt;
    # your custom code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== build() ====&lt;br /&gt;
: &#039;&#039;&#039;Required.&#039;&#039;&#039;  This is the compilation stage.  This function will be called as the current user (unless the &#039;&#039;package()&#039;&#039; function is missing - for compatibility reasons).  If no compilation is needed, this function can contain a single line: &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt;&lt;br /&gt;
==== check() ====&lt;br /&gt;
: &#039;&#039;&#039;Recommended.&#039;&#039;&#039; This function is called right after the build stage.  It should check that the packaged thing is actually working, typically by running (integration) tests, if provided by upstream.  If there’s no (easy) way how to test the package, you can declare that it does not want to use &#039;&#039;check()&#039;&#039; by adding &amp;quot;!check&amp;quot; into the &#039;&#039;options&#039;&#039; variable (&amp;lt;code&amp;gt;options=&amp;quot;!check&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
==== package() ====&lt;br /&gt;
: &#039;&#039;&#039;Required.&#039;&#039;&#039;  This is the packaging stage.  Here, the built application and support files should be installed into &#039;&#039;&#039;$pkgdir&#039;&#039;&#039;.  If this is a metapackage, this function can contain a single line: &amp;lt;code&amp;gt;mkdir -p &amp;quot;$pkgdir&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|Building in fakeroot will reduce performance for parallel builds dramatically.  It is for this reason that we split the build and package process into two separate functions.}}&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
The [[APKBUILD examples]] page will assist you in understanding how to create an APKBUILD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Writing_Init_Scripts&amp;diff=13693</id>
		<title>Writing Init Scripts</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Writing_Init_Scripts&amp;diff=13693"/>
		<updated>2017-07-20T14:20:29Z</updated>

		<summary type="html">&lt;p&gt;Larena: Add cfgfile var&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux uses the [https://github.com/OpenRC/openrc OpenRC] init system to start services. Don&#039;t confuse OpenRC init with out system init (the first process that is executed aka pid 1). Many of the current init.d script found in Alpine Linux are takes from Gentoo. If you want to save time you could search [https://packages.gentoo.org/categories Gentoo&#039;s repository] for an existing initscript for your service. You can also check [https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts#Writing_initscripts Gentoo&#039;s wiki] for some additional OpenRC information.&lt;br /&gt;
&lt;br /&gt;
If you cannot find an init.d script from Gentoo, or you just want to start to write your own init.d scripts, we provide you with some basic information on how to write simple OpenRC init scripts.&lt;br /&gt;
&lt;br /&gt;
Primary information about the OpenRC format can be found in the [http://manpages.org/openrc-run/8 OpenRC man page openrc-run].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apk add openrc-doc man&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man openrc-run&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
&lt;br /&gt;
Every init.d script you write needs to start with a [https://en.wikipedia.org/wiki/Shebang_(Unix) shebang] like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#!/sbin/openrc-run&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only mandatory variable needed to be defined for OpenRC is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the below basic example could be omitted, but that would most probably leave you with an non working initd script.&lt;br /&gt;
&lt;br /&gt;
== Basic example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
  &lt;br /&gt;
name=$RC_SVCNAME&lt;br /&gt;
cfgfile=&amp;quot;/etc/$RC_SVCNAME/$RC_SVCNAME.conf&amp;quot;&lt;br /&gt;
command=&amp;quot;/usr/bin/my_daemon&amp;quot;&lt;br /&gt;
command_args=&amp;quot;--my-daemon-args&amp;quot;&lt;br /&gt;
command_user=&amp;quot;my_system_user&amp;quot;&lt;br /&gt;
pidfile=&amp;quot;/run/$RC_SVCNAME/$RC_SVCNAME.pid&amp;quot;&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--args-for-start-stop-daemon&amp;quot;&lt;br /&gt;
command_background=&amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
        need net&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
start_pre() {&lt;br /&gt;
        checkpath --directory --owner $command_user:$command_user --mode 0775 \&lt;br /&gt;
                /run/$RC_SVCNAME /var/log/$RC_SVCNAME&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== start, stop, restart functions ==&lt;br /&gt;
&lt;br /&gt;
OpenRC defined a few basic functions ie: start, stop, restart. These functions are defined by default but can be overwritten by defining your own set of functions.&lt;br /&gt;
This is generally only necessary if you want to do something special which is not provided by the default start/stop/restart implementations.&lt;br /&gt;
&lt;br /&gt;
=== start ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
start() {&lt;br /&gt;
    ebegin &amp;quot;Starting mydaemon&amp;quot;&lt;br /&gt;
    start-stop-daemon --start \&lt;br /&gt;
        --exec /usr/sbin/mydaemon \&lt;br /&gt;
        --pidfile /var/run/mydaemon.pid \&lt;br /&gt;
        -- \&lt;br /&gt;
        --args-for-mydaemon&lt;br /&gt;
    eend $?&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stop ===&lt;br /&gt;
&lt;br /&gt;
=== restart ===&lt;br /&gt;
&lt;br /&gt;
== Daemon, Forking, Logging ==&lt;br /&gt;
&lt;br /&gt;
TODO...&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Two_Factor_Authentication_With_OpenSSH&amp;diff=13642</id>
		<title>Two Factor Authentication With OpenSSH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Two_Factor_Authentication_With_OpenSSH&amp;diff=13642"/>
		<updated>2017-06-12T14:12:07Z</updated>

		<summary type="html">&lt;p&gt;Larena: tested setup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|Currently the packages required to follow this how-to are available only in edge (future AL3.7). You can [[Alpine_Linux_package_management#Repository_pinning|pin edge repository]] if you&#039;re on a stable version.}}&lt;br /&gt;
&lt;br /&gt;
== Using Google Authenticator ==&lt;br /&gt;
{{cmd|apk add google-authenticator openssh-server-pam}}&lt;br /&gt;
&lt;br /&gt;
{{cmd|cat /etc/ssh/sshd_config}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AuthenticationMethods publickey,keyboard-interactive&lt;br /&gt;
ChallengeResponseAuthentication yes&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
UsePAM yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|This configuration does NOT allow password authentication globally}}&lt;br /&gt;
&lt;br /&gt;
{{cmd|cat /etc/pam.d/sshd #create the file if needed}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
account		include				base-account&lt;br /&gt;
&lt;br /&gt;
auth		required			pam_env.so&lt;br /&gt;
auth		required			pam_nologin.so	successok&lt;br /&gt;
auth		include				google-authenticator&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time-based One Time Password authentication (TOTP RFC 6238) ==&lt;br /&gt;
As user root:&lt;br /&gt;
{{cmd|google-authenticator}}&lt;br /&gt;
{{Note|Please take note of &amp;lt;secret&amp;gt;}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Do you want authentication tokens to be time-based (y/n) y&lt;br /&gt;
https://www.google.com/&amp;lt;pruned&amp;gt;&lt;br /&gt;
Your new secret key is: &amp;lt;secret&amp;gt;&lt;br /&gt;
Your verification code is &amp;lt;pruned&amp;gt;&lt;br /&gt;
Your emergency scratch codes are:&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do you want me to update your &amp;quot;/root/.google_authenticator&amp;quot; file? (y/n) y&lt;br /&gt;
&lt;br /&gt;
Do you want to disallow multiple uses of the same authentication&lt;br /&gt;
token? This restricts you to one login about every 30s, but it increases&lt;br /&gt;
your chances to notice or even prevent man-in-the-middle attacks (y/n) n&lt;br /&gt;
&lt;br /&gt;
By default, tokens are good for 30 seconds. In order to compensate for&lt;br /&gt;
possible time-skew between the client and the server, we allow an extra&lt;br /&gt;
token before and after the current time. If you experience problems with&lt;br /&gt;
poor time synchronization, you can increase the window from its default&lt;br /&gt;
size of +-1min (window size of 3) to about +-4min (window size of&lt;br /&gt;
17 acceptable tokens).&lt;br /&gt;
Do you want to do so? (y/n) n&lt;br /&gt;
&lt;br /&gt;
If the computer that you are logging into isn&#039;t hardened against brute-force&lt;br /&gt;
login attempts, you can enable rate-limiting for the authentication module.&lt;br /&gt;
By default, this limits attackers to no more than 3 login attempts every 30s.&lt;br /&gt;
Do you want to enable rate-limiting (y/n) n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|You might want to answer differently at questions 2, 3 and 4 based on your paranoia&#039;s level and firewall settings :)}}&lt;br /&gt;
&lt;br /&gt;
Re-run &amp;lt;code&amp;gt;google-authenticator&amp;lt;/code&amp;gt; for each user that needs to login via SSH. Don&#039;t forget to include &amp;lt;code&amp;gt;.google_authenticator&amp;lt;/code&amp;gt; files in your [[Alpine_local_backup|LBU]] if you&#039;re running from RAM.&lt;br /&gt;
&lt;br /&gt;
== Prover ==&lt;br /&gt;
Download &#039;&#039;&#039;Google Authenticator&#039;&#039;&#039; app from your &#039;&#039;App Store&#039;&#039;. Startup &#039;&#039;&#039;Google Authenticator&#039;&#039;&#039; app and enter manually your &amp;lt;secret&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
== Login ==&lt;br /&gt;
{{cmd|ssh -v root@yourbox}}&lt;br /&gt;
You should see the last lines saying:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Authenticated with partial success.&lt;br /&gt;
debug1: Authentications that can continue: keyboard-interactive&lt;br /&gt;
debug1: Next authentication method: keyboard-interactive&lt;br /&gt;
Verification code: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Authenticated with partial success&amp;lt;/code&amp;gt; means that pubkey authentication was successfull and now the verifier is asking for the verification code generated from the &#039;&#039;&#039;Google Authenticator&#039;&#039;&#039; app.&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Two_Factor_Authentication_With_OpenSSH&amp;diff=13641</id>
		<title>Two Factor Authentication With OpenSSH</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Two_Factor_Authentication_With_OpenSSH&amp;diff=13641"/>
		<updated>2017-06-12T10:28:44Z</updated>

		<summary type="html">&lt;p&gt;Larena: first draft&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Currently the packages required to follow this how-to are available only on edge (future AL3.7)}}&lt;br /&gt;
&lt;br /&gt;
== Using Google Authenticator ==&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add google-authenticator openssh-server-pam}}&lt;br /&gt;
&lt;br /&gt;
{{cmd|cat /etc/pam.d/base-auth}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basic PAM configuration for Alpine.&lt;br /&gt;
&lt;br /&gt;
auth		required	pam_env.so&lt;br /&gt;
#auth		required	pam_unix.so	nullok_secure&lt;br /&gt;
auth		required	pam_nologin.so	successok&lt;br /&gt;
auth		required	/lib/security/pam_google_authenticator.so&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{cmd|cat /etc/ssh/sshd_config}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UsePAM yes&lt;br /&gt;
AuthenticationMethods publickey,keyboard-interactive&lt;br /&gt;
ChallengeResponseAuthentication yes&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|This configuration does NOT allow password authentication. To allow password authentication append &amp;quot;password&amp;quot; to &amp;quot;AuthenticatioMethods&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
As user root:&lt;br /&gt;
{{cmd|google-authenticator}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Do you want authentication tokens to be time-based (y/n) y&lt;br /&gt;
https://www.google.com/&amp;lt;pruned&amp;gt;&lt;br /&gt;
Your new secret key is: &amp;lt;secret&amp;gt;&lt;br /&gt;
Your verification code is &amp;lt;pruned&amp;gt;&lt;br /&gt;
Your emergency scratch codes are:&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
  &amp;lt;pruned&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do you want me to update your &amp;quot;/root/.google_authenticator&amp;quot; file? (y/n) y&lt;br /&gt;
&lt;br /&gt;
Do you want to disallow multiple uses of the same authentication&lt;br /&gt;
token? This restricts you to one login about every 30s, but it increases&lt;br /&gt;
your chances to notice or even prevent man-in-the-middle attacks (y/n) n&lt;br /&gt;
&lt;br /&gt;
By default, tokens are good for 30 seconds. In order to compensate for&lt;br /&gt;
possible time-skew between the client and the server, we allow an extra&lt;br /&gt;
token before and after the current time. If you experience problems with&lt;br /&gt;
poor time synchronization, you can increase the window from its default&lt;br /&gt;
size of +-1min (window size of 3) to about +-4min (window size of&lt;br /&gt;
17 acceptable tokens).&lt;br /&gt;
Do you want to do so? (y/n) y&lt;br /&gt;
&lt;br /&gt;
If the computer that you are logging into isn&#039;t hardened against brute-force&lt;br /&gt;
login attempts, you can enable rate-limiting for the authentication module.&lt;br /&gt;
By default, this limits attackers to no more than 3 login attempts every 30s.&lt;br /&gt;
Do you want to enable rate-limiting (y/n) n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download &#039;&#039;&#039;Google Authenticator&#039;&#039;&#039; app and enter manually your &amp;lt;secret&amp;gt; key&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=13640</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=13640"/>
		<updated>2017-06-12T09:59:58Z</updated>

		<summary type="html">&lt;p&gt;Larena: Deprecate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Obsolete|OwnCloud is deprecated in favor of [[Nextcloud|Nextcloud]]}} &lt;br /&gt;
&lt;br /&gt;
[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=ISCSI_Raid_and_Clustered_File_Systems&amp;diff=13639</id>
		<title>ISCSI Raid and Clustered File Systems</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=ISCSI_Raid_and_Clustered_File_Systems&amp;diff=13639"/>
		<updated>2017-06-12T09:58:46Z</updated>

		<summary type="html">&lt;p&gt;Larena: Deprecate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Obsolete|SCST is deprecated since Alpine 2.6 in favor of [[Linux_iSCSI_Target_(TCM)|TCM]] and OCFS2 isn&#039;t available in Alpine 3.6}} &lt;br /&gt;
&lt;br /&gt;
This document describes how to created a raided file system that is exported to multiple host via ISCSI.&lt;br /&gt;
&lt;br /&gt;
== Raid Configuration ==&lt;br /&gt;
&lt;br /&gt;
Very Similar to [[Setting up a software RAID array]].&lt;br /&gt;
&lt;br /&gt;
 apk install mdadm&lt;br /&gt;
&lt;br /&gt;
 mdadm --create --level=5 --raid-devices=3 /dev/md0 /dev/hda /dev/hdb /dev/hdc&lt;br /&gt;
&lt;br /&gt;
To see the status of the creation of these devices&lt;br /&gt;
&lt;br /&gt;
 cat /proc/mdstat&lt;br /&gt;
&lt;br /&gt;
You Don&#039;t have to wait to continue to use the disk.&lt;br /&gt;
&lt;br /&gt;
== iSCSI Target Config ==&lt;br /&gt;
&lt;br /&gt;
[http://scst.sourceforge.net/target_iscsi.html SCST] is recommended over [http://iscsitarget.sourceforge.net/ IET], due to bugfixes, performance and RFC compliance. &lt;br /&gt;
For a detailed config how-to please look at [[High_performance_SCST_iSCSI_Target_on_Linux_software_Raid]]&lt;br /&gt;
&lt;br /&gt;
== Initiator Config ==&lt;br /&gt;
&lt;br /&gt;
 iscsiadm --mode node --targetname NAME_OF_TARGET --portal IP_OF_TARGET --login&lt;br /&gt;
&lt;br /&gt;
This should then give you a device /dev/sda. Check by dmesg.&lt;br /&gt;
&lt;br /&gt;
 fdisk /dev/sda&lt;br /&gt;
&lt;br /&gt;
Create a partition to use. sda1 file system type 83&lt;br /&gt;
&lt;br /&gt;
Add ocfs2 tools (available in Alpine 2.3 or greater)&lt;br /&gt;
&lt;br /&gt;
 apk add ocfs2-tools&lt;br /&gt;
&lt;br /&gt;
It can take care of starting and stopping services, copying the cluster.conf between nodes,creating the filesystem, and mounting it. &lt;br /&gt;
&lt;br /&gt;
Need to create a /etc/ocfs2/cluster.conf. &lt;br /&gt;
&lt;br /&gt;
This configuration file should be the same on all the nodes in the cluster. Should look similar to the following...&lt;br /&gt;
&lt;br /&gt;
node:&lt;br /&gt;
        ip_port = 7777&lt;br /&gt;
        ip_address = 192.168.1.202&lt;br /&gt;
        number = 0&lt;br /&gt;
        name = bubba&lt;br /&gt;
        cluster = ocfs2&lt;br /&gt;
&lt;br /&gt;
node:&lt;br /&gt;
        ip_port = 7777&lt;br /&gt;
        ip_address = 192.168.1.102&lt;br /&gt;
        number = 1&lt;br /&gt;
        name = bobo&lt;br /&gt;
        cluster = ocfs2&lt;br /&gt;
&lt;br /&gt;
cluster:&lt;br /&gt;
        node_count = 2&lt;br /&gt;
        name = ocfs2&lt;br /&gt;
&lt;br /&gt;
Load modules:&lt;br /&gt;
&lt;br /&gt;
 echo ocfs2 &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
 echo dlm &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
&lt;br /&gt;
 modprobe ocfs2&lt;br /&gt;
 modprobe dlm&lt;br /&gt;
&lt;br /&gt;
Mount ocfs2 metafilesystems&lt;br /&gt;
&lt;br /&gt;
 echo none /sys/kernel/config configfs defaults 0 0 &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
 echo none /sys/kernel/dlm ocfs2_dlmfs defaults 0 0 &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
&lt;br /&gt;
Start ocfs2 cluster&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/o2cb start&lt;br /&gt;
&lt;br /&gt;
Run the following command only on one node. &lt;br /&gt;
&lt;br /&gt;
 mkfs.ocfs2 -L LABELNAME /dev/sda1&lt;br /&gt;
&lt;br /&gt;
Run the following command on both nodes.&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/o2cb enable&lt;br /&gt;
&lt;br /&gt;
 mount /dev/sda1 /media/iscsi1&lt;br /&gt;
&lt;br /&gt;
Now you can create read/write/change on both machines to the one drive at the same time.&lt;br /&gt;
&lt;br /&gt;
[[Category:Storage]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=13106</id>
		<title>Nextcloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=13106"/>
		<updated>2017-01-05T10:03:09Z</updated>

		<summary type="html">&lt;p&gt;Larena: Add nextcloud-client availability note&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://nextcloud.com/ Nextcloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. [http://karlitschek.de/2016/06/nextcloud/ Nextcloud is a fork of ownCloud with enterprise features included].&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|nextcloud}} is available from Alpine 3.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
&lt;br /&gt;
=== Sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add nextcloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== PostgreSQL ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
=== MySQL ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE nextcloud;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your nextcloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|nextcloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/nextcloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as pdfviewer, texteditor, notifications and videoplayer are in separate package:&lt;br /&gt;
{{cmd|apk add nextcloud-pdfviewer nextcloud-texteditor nextcloud-notifications nextcloud-videoplayer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use Nextcloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening PostgreSQL ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://nextcloud.org/sync-clients/ &#039;&#039;(nextcloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://nextcloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://pkgs.alpinelinux.org/packages?name=nextcloud-client&amp;amp;branch=&amp;amp;repo=&amp;amp;arch=&amp;amp;maintainer= nextcloud-client] is currently available in the testing repo.&lt;br /&gt;
&lt;br /&gt;
= Video Communication =&lt;br /&gt;
One of the major features of Nextcloud 11, available on Alpine 3.6 (currently edge) is a [https://nextcloud.com/webrtc/ WebRTC app], which relies on Spreed WebRTC server, which is available in the Alpine testing repository. Everything is still beta, so be aware of it :-). If you want a private video conferencing server install Nextcloud using Nginx and do the following (you can use Apache as well and follow the &#039;&#039;Apache config&#039;&#039; instructions [https://nextcloud.com/webrtc/ nextcloud.com]):&lt;br /&gt;
&lt;br /&gt;
Put the following config in the &#039;&#039;server&#039;&#039; section of Nginx:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Spreed WebRTC&lt;br /&gt;
location ^~ /webrtc {&lt;br /&gt;
  proxy_pass http://127.0.0.1:8080;&lt;br /&gt;
  proxy_http_version 1.1;&lt;br /&gt;
  proxy_set_header Upgrade $http_upgrade;&lt;br /&gt;
  proxy_set_header Connection $connection_upgrade;&lt;br /&gt;
  proxy_set_header X-Forwarded-Proto $scheme;&lt;br /&gt;
  proxy_set_header Host $http_host;&lt;br /&gt;
  proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
&lt;br /&gt;
  proxy_buffering             on;&lt;br /&gt;
  proxy_ignore_client_abort   off;&lt;br /&gt;
  proxy_redirect              off;&lt;br /&gt;
  proxy_connect_timeout       90;&lt;br /&gt;
  proxy_send_timeout          90;&lt;br /&gt;
  proxy_read_timeout          90;&lt;br /&gt;
  proxy_buffer_size           4k;&lt;br /&gt;
  proxy_buffers               4 32k;&lt;br /&gt;
  proxy_busy_buffers_size     64k;&lt;br /&gt;
  proxy_temp_file_write_size  64k;&lt;br /&gt;
  proxy_next_upstream         error timeout invalid_header http_502 http_503 http_504;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following section in the &#039;&#039;http&#039;&#039; section of Nginx:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
map $http_upgrade $connection_upgrade {&lt;br /&gt;
  default upgrade;&lt;br /&gt;
  &#039;&#039;      close;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reload Nginx:&lt;br /&gt;
{{cmd|rc-service nginx reload}}&lt;br /&gt;
&lt;br /&gt;
Install Spreed WedRTC server (make sure you have the testing [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Packages_and_Repositories repository] enabled):&lt;br /&gt;
{{cmd|apk add spreed-web-server}}&lt;br /&gt;
&lt;br /&gt;
Using the configuration file in &#039;&#039;/etc/spreed-webrtc/spreed-webrtc-server.conf&#039;&#039; follow the instructions at [https://nextcloud.com/webrtc/ nextcloud.com] to configure Spreed WebRTC server. Then start the server:&lt;br /&gt;
{{cmd|rc-service spreed-web-server start}}&lt;br /&gt;
{{cmd|rc-update add spreed-web-server}}&lt;br /&gt;
&lt;br /&gt;
Install the &#039;&#039;Spreed video calls&#039;&#039; app in Nextcloud and enjoy your private video calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=13102</id>
		<title>Nextcloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=13102"/>
		<updated>2017-01-04T09:40:38Z</updated>

		<summary type="html">&lt;p&gt;Larena: Apache can be used too&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://nextcloud.com/ Nextcloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. [http://karlitschek.de/2016/06/nextcloud/ Nextcloud is a fork of ownCloud with enterprise features included].&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|nextcloud}} is available from Alpine 3.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
&lt;br /&gt;
=== Sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add nextcloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== PostgreSQL ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
=== MySQL ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE nextcloud;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your nextcloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|nextcloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/nextcloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as pdfviewer, texteditor, notifications and videoplayer are in separate package:&lt;br /&gt;
{{cmd|apk add nextcloud-pdfviewer nextcloud-texteditor nextcloud-notifications nextcloud-videoplayer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use Nextcloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening PostgreSQL ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://nextcloud.org/sync-clients/ &#039;&#039;(nextcloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://nextcloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Video Communication =&lt;br /&gt;
One of the major features of Nextcloud 11, available on Alpine 3.6 (currently edge) is a [https://nextcloud.com/webrtc/ WebRTC app], which relies on Spreed WebRTC server, which is available in the Alpine testing repository. Everything is still beta, so be aware of it :-). If you want a private video conferencing server install Nextcloud using Nginx and do the following (you can use Apache as well and follow the &#039;&#039;Apache config&#039;&#039; instructions [https://nextcloud.com/webrtc/ nextcloud.com]):&lt;br /&gt;
&lt;br /&gt;
Put the following config in the &#039;&#039;server&#039;&#039; section of Nginx:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Spreed WebRTC&lt;br /&gt;
location ^~ /webrtc {&lt;br /&gt;
  proxy_pass http://127.0.0.1:8080;&lt;br /&gt;
  proxy_http_version 1.1;&lt;br /&gt;
  proxy_set_header Upgrade $http_upgrade;&lt;br /&gt;
  proxy_set_header Connection $connection_upgrade;&lt;br /&gt;
  proxy_set_header X-Forwarded-Proto $scheme;&lt;br /&gt;
  proxy_set_header Host $http_host;&lt;br /&gt;
  proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
&lt;br /&gt;
  proxy_buffering             on;&lt;br /&gt;
  proxy_ignore_client_abort   off;&lt;br /&gt;
  proxy_redirect              off;&lt;br /&gt;
  proxy_connect_timeout       90;&lt;br /&gt;
  proxy_send_timeout          90;&lt;br /&gt;
  proxy_read_timeout          90;&lt;br /&gt;
  proxy_buffer_size           4k;&lt;br /&gt;
  proxy_buffers               4 32k;&lt;br /&gt;
  proxy_busy_buffers_size     64k;&lt;br /&gt;
  proxy_temp_file_write_size  64k;&lt;br /&gt;
  proxy_next_upstream         error timeout invalid_header http_502 http_503 http_504;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following section in the &#039;&#039;http&#039;&#039; section of Nginx:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
map $http_upgrade $connection_upgrade {&lt;br /&gt;
  default upgrade;&lt;br /&gt;
  &#039;&#039;      close;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reload Nginx:&lt;br /&gt;
{{cmd|rc-service nginx reload}}&lt;br /&gt;
&lt;br /&gt;
Install Spreed WedRTC server (make sure you have the testing [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Packages_and_Repositories repository] enabled):&lt;br /&gt;
{{cmd|apk add spreed-web-server}}&lt;br /&gt;
&lt;br /&gt;
Using the configuration file in &#039;&#039;/etc/spreed-webrtc/spreed-webrtc-server.conf&#039;&#039; follow the instructions at [https://nextcloud.com/webrtc/ nextcloud.com] to configure Spreed WebRTC server. Then start the server:&lt;br /&gt;
{{cmd|rc-service spreed-web-server start}}&lt;br /&gt;
{{cmd|rc-update add spreed-web-server}}&lt;br /&gt;
&lt;br /&gt;
Install the &#039;&#039;Spreed video calls&#039;&#039; app in Nextcloud and enjoy your private video calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=13101</id>
		<title>Nextcloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=13101"/>
		<updated>2017-01-04T09:30:47Z</updated>

		<summary type="html">&lt;p&gt;Larena: Video calls section added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://nextcloud.com/ Nextcloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. [http://karlitschek.de/2016/06/nextcloud/ Nextcloud is a fork of ownCloud with enterprise features included].&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|nextcloud}} is available from Alpine 3.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
&lt;br /&gt;
=== Sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add nextcloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== PostgreSQL ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
=== MySQL ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE nextcloud;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your nextcloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|nextcloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/nextcloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as pdfviewer, texteditor, notifications and videoplayer are in separate package:&lt;br /&gt;
{{cmd|apk add nextcloud-pdfviewer nextcloud-texteditor nextcloud-notifications nextcloud-videoplayer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use Nextcloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening PostgreSQL ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://nextcloud.org/sync-clients/ &#039;&#039;(nextcloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://nextcloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Video Communication =&lt;br /&gt;
One of the major features of Nextcloud 11, available on Alpine 3.6 (currently edge) is a [https://nextcloud.com/webrtc/ WebRTC app], which relies on Spreed WebRTC server, which is available in the Alpine testing repository. Everything is still beta, so be aware of it :-). If you want a private video conferencing server install Nextcloud using Nginx and do the following:&lt;br /&gt;
&lt;br /&gt;
Put the following config in the &#039;&#039;server&#039;&#039; section of Nginx:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Spreed WebRTC&lt;br /&gt;
location ^~ /webrtc {&lt;br /&gt;
  proxy_pass http://127.0.0.1:8080;&lt;br /&gt;
  proxy_http_version 1.1;&lt;br /&gt;
  proxy_set_header Upgrade $http_upgrade;&lt;br /&gt;
  proxy_set_header Connection $connection_upgrade;&lt;br /&gt;
  proxy_set_header X-Forwarded-Proto $scheme;&lt;br /&gt;
  proxy_set_header Host $http_host;&lt;br /&gt;
  proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
&lt;br /&gt;
  proxy_buffering             on;&lt;br /&gt;
  proxy_ignore_client_abort   off;&lt;br /&gt;
  proxy_redirect              off;&lt;br /&gt;
  proxy_connect_timeout       90;&lt;br /&gt;
  proxy_send_timeout          90;&lt;br /&gt;
  proxy_read_timeout          90;&lt;br /&gt;
  proxy_buffer_size           4k;&lt;br /&gt;
  proxy_buffers               4 32k;&lt;br /&gt;
  proxy_busy_buffers_size     64k;&lt;br /&gt;
  proxy_temp_file_write_size  64k;&lt;br /&gt;
  proxy_next_upstream         error timeout invalid_header http_502 http_503 http_504;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following section in the &#039;&#039;http&#039;&#039; section of Nginx:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
map $http_upgrade $connection_upgrade {&lt;br /&gt;
  default upgrade;&lt;br /&gt;
  &#039;&#039;      close;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reload Nginx:&lt;br /&gt;
{{cmd|rc-service nginx reload}}&lt;br /&gt;
&lt;br /&gt;
Install Spreed WedRTC server (make sure you have the testing [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Packages_and_Repositories repository] enabled):&lt;br /&gt;
{{cmd|apk add spreed-web-server}}&lt;br /&gt;
&lt;br /&gt;
Using the configuration file in &#039;&#039;/etc/spreed-webrtc/spreed-webrtc-server.conf&#039;&#039; follow the instructions at [https://nextcloud.com/webrtc/ nextcloud.com] to configure Spreed WebRTC server. Then start the server:&lt;br /&gt;
{{cmd|rc-service spreed-web-server start}}&lt;br /&gt;
{{cmd|rc-update add spreed-web-server}}&lt;br /&gt;
&lt;br /&gt;
Install the &#039;&#039;Spreed video calls&#039;&#039; app in Nextcloud and enjoy your private video calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=12887</id>
		<title>Nextcloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=12887"/>
		<updated>2016-07-25T19:24:33Z</updated>

		<summary type="html">&lt;p&gt;Larena: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is just a fork of OwnCloud AL wiki page. Do not follow these instructions until this notice is removed}}&lt;br /&gt;
&lt;br /&gt;
[http://nextcloud.com/ Next] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. [http://karlitschek.de/2016/06/nextcloud/ Nextcloud is a fork of ownCloud with enterprise features included].&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|nextcloud}} is available from Alpine 3.5 (currently edge) and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add nextcloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE nextcloud;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your nextcloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|nextcloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/nextcloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add nextcloud-texteditor nextcloud-documents nextcloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use nextcloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://nextcloud.org/sync-clients/ &#039;&#039;(nextcloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://nextcloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=12886</id>
		<title>Nextcloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nextcloud&amp;diff=12886"/>
		<updated>2016-07-25T19:23:52Z</updated>

		<summary type="html">&lt;p&gt;Larena: created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is just a fork of OwnCloud AL wiki page. Do not follow these instructions until this notice is removed}}&lt;br /&gt;
&lt;br /&gt;
[http://nextcloud.com/ Next] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. [http://karlitschek.de/2016/06/nextcloud/ Nextcloud is a fork of nextcloud with enterprise features included].&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|nextcloud}} is available from Alpine 3.5 (currently edge) and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add nextcloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add nextcloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE nextcloud;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON nextcloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up nextcloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your nextcloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|nextcloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/nextcloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add nextcloud-texteditor nextcloud-documents nextcloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use nextcloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://nextcloud.org/sync-clients/ &#039;&#039;(nextcloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://nextcloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_Amazon_EC2&amp;diff=12827</id>
		<title>Install Alpine on Amazon EC2</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_Amazon_EC2&amp;diff=12827"/>
		<updated>2016-06-03T11:21:49Z</updated>

		<summary type="html">&lt;p&gt;Larena: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
The goal here is to have a &amp;quot;1GB&amp;quot; (the smallest possible) EBS &#039;virtual usb stick&#039; that can boot and run Alpine Linux.  &lt;br /&gt;
&lt;br /&gt;
= Create an EBS backed Alpine Linux AMI =&lt;br /&gt;
&lt;br /&gt;
{{Note|You need to do this process at least once in each availability region.  EBS can&#039;t be shared between Ireland and California, for instance.}}&lt;br /&gt;
&lt;br /&gt;
* Create an Amazon instance in the desired availability region.  A micro instance is fine - we will need it only long enough to create our EBS usb stick.&lt;br /&gt;
* Create a new 1GB EBS volume &lt;br /&gt;
* Attach the new volume to the running instance&lt;br /&gt;
* The new volume will have a name like /dev/xvdf or such&lt;br /&gt;
* Format the volume as ext4 {{Cmd|mke2fs -t ext4 /dev/xvdf}}  &#039;&#039;Do not partition it - just format the whole volume&#039;&#039;&lt;br /&gt;
* wget a &#039;&#039;&#039;x86_64&#039;&#039;&#039; iso and extract it to the new volume. 32bit will not work. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget http://dl-4.alpinelinux.org/alpine/v2.4/releases/x86_64/alpine-2.4.5-x86_64.iso&lt;br /&gt;
mkdir target&lt;br /&gt;
mkdir source&lt;br /&gt;
mount /dev/xvdf target&lt;br /&gt;
mount -o loop alpine-2.4.5-x86_64.iso source&lt;br /&gt;
cp -av source/boot target&lt;br /&gt;
cp -av source/apks target&lt;br /&gt;
umount source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Create a grub.conf on the new partition.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p target/boot/grub&lt;br /&gt;
cat - &amp;gt;target/boot/grub/grub.conf &amp;lt;&amp;lt;EOF &lt;br /&gt;
default=0&lt;br /&gt;
timeout=3&lt;br /&gt;
hiddenmenu&lt;br /&gt;
&lt;br /&gt;
title Alpine Linux&lt;br /&gt;
root (hd0)&lt;br /&gt;
kernel /boot/virtgrsec alpine_dev=xvda1:ext4 modules=loop,squashfs,sd-mod,ext4 console=hvc0 pax_nouderef BOOT_IMAGE=/boot/vmlinuz-grsec&lt;br /&gt;
initrd /boot/initramfs-grsec&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Syslinux automatically adds BOOT_IMAGE to the kernel command line; grub does not, so make sure you specify it in the grub.conf&lt;br /&gt;
:* You do not need any other grub files - just boot.conf&lt;br /&gt;
* symlink the grub.conf to menu.lst&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -sf ./grub.conf target/boot/grub/menu.lst&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Create an amazon.apkovl.tar.gz file to put on the target &lt;br /&gt;
** This is probably easiest on a local alpine linux instance.  Make sure the following are configured:&lt;br /&gt;
*** eth0 uses dhcp&lt;br /&gt;
*** networking is set to autostart&lt;br /&gt;
*** sshd is installed and set to autostart&lt;br /&gt;
*** Your ssh public key is in /root/.ssh/authorized_keys&lt;br /&gt;
*** The root password is set to something&lt;br /&gt;
*** lbu include root/.ssh&lt;br /&gt;
*** (optional) - Delete the /etc/ssh/*key* files, so they are created on the new box&lt;br /&gt;
** {{Cmd|lbu package amazon.apkovl.tar.gz}} {{Warning|If you are packaging on a 32bit box, manually delete etc/apk/arch from the apkovl.tar.gz file}}&lt;br /&gt;
** Copy amazon.apkovl.tar.gz to target/ &lt;br /&gt;
* Unmount target&lt;br /&gt;
* &#039;&#039;&#039;Do the following from the Amazon web interface&#039;&#039;&#039;&lt;br /&gt;
** Detach the new volume&lt;br /&gt;
** Make note of the volume ID&lt;br /&gt;
** Launch NEW instance.  Use defaults, amazon linux, micro; we are going to canibalize it in a bit, so defaults are fine here.&lt;br /&gt;
** Once the instance starts, &#039;&#039;stop&#039;&#039; but &#039;&#039;do not terminate&#039;&#039; the instance.&lt;br /&gt;
** Under EBS, detach the existing volume, and attach the alpine linux volume as /dev/sda1 (note the 1 at the end)&lt;br /&gt;
** Restart the instance&lt;br /&gt;
* Log in and make sure it works&lt;br /&gt;
* Do any final cleanups necessary, and if necessary lbu ci&lt;br /&gt;
** Only make configs that are appropriate for an AMI, we are going to snapshot this instance and create an AMI out of it&lt;br /&gt;
* Again from the Amazon web interface&lt;br /&gt;
** Delete the 8GB volume that is no longer needed&lt;br /&gt;
** &#039;&#039;Stop&#039;&#039; but do not terminate the instance&lt;br /&gt;
** Right click the stopped instance and choose &#039;Create Image (EBS AMI)&#039;&lt;br /&gt;
*** Image name should be unique for the image - example AlpineLinux-2.4.5&lt;br /&gt;
*** Description can be anything - example &#039;Base AlpineLinux Installation - no services&#039;&lt;br /&gt;
* Done. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_Amazon_EC2&amp;diff=12826</id>
		<title>Install Alpine on Amazon EC2</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_Amazon_EC2&amp;diff=12826"/>
		<updated>2016-06-03T08:22:13Z</updated>

		<summary type="html">&lt;p&gt;Larena: update kernel/initrd filename for AL3.3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
The goal here is to have a &amp;quot;1GB&amp;quot; (the smallest possible) EBS &#039;virtual usb stick&#039; that can boot and run Alpine Linux.  &lt;br /&gt;
&lt;br /&gt;
= Create an EBS backed Alpine Linux AMI =&lt;br /&gt;
&lt;br /&gt;
{{Note|You need to do this process at least once in each availability region.  EBS can&#039;t be shared between Ireland and California, for instance.}}&lt;br /&gt;
&lt;br /&gt;
* Create an Amazon instance in the desired availability region.  A micro instance is fine - we will need it only long enough to create our EBS usb stick.&lt;br /&gt;
* Create a new 1GB EBS volume &lt;br /&gt;
* Attach the new volume to the running instance&lt;br /&gt;
* The new volume will have a name like /dev/xvdf or such&lt;br /&gt;
* Format the volume as ext4 {{Cmd|mke2fs -t ext4 /dev/xvdf}}  &#039;&#039;Do not partition it - just format the whole volume&#039;&#039;&lt;br /&gt;
* wget a &#039;&#039;&#039;x86_64&#039;&#039;&#039; iso and extract it to the new volume. 32bit will not work. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget http://dl-4.alpinelinux.org/alpine/v2.4/releases/x86_64/alpine-2.4.5-x86_64.iso&lt;br /&gt;
mkdir target&lt;br /&gt;
mkdir source&lt;br /&gt;
mount /dev/xvdf target&lt;br /&gt;
mount -o loop alpine-2.4.5-x86_64.iso source&lt;br /&gt;
cp -av source/boot target&lt;br /&gt;
cp -av source/apks target&lt;br /&gt;
umount source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Create a grub.conf on the new partition.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p target/boot/grub&lt;br /&gt;
cat - &amp;gt;target/boot/grub/grub.conf &amp;lt;&amp;lt;EOF &lt;br /&gt;
default=0&lt;br /&gt;
timeout=3&lt;br /&gt;
hiddenmenu&lt;br /&gt;
&lt;br /&gt;
title Alpine Linux&lt;br /&gt;
root (hd0)&lt;br /&gt;
kernel /boot/grsec alpine_dev=xvda1:ext4 modules=loop,squashfs,sd-mod,ext4 console=hvc0 pax_nouderef BOOT_IMAGE=/boot/vmlinuz-grsec&lt;br /&gt;
initrd /boot/initramfs-grsec&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Syslinux automatically adds BOOT_IMAGE to the kernel command line; grub does not, so make sure you specify it in the grub.conf&lt;br /&gt;
:* You do not need any other grub files - just boot.conf&lt;br /&gt;
* symlink the grub.conf to menu.lst&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -sf ./grub.conf target/boot/grub/menu.lst&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Create an amazon.apkovl.tar.gz file to put on the target &lt;br /&gt;
** This is probably easiest on a local alpine linux instance.  Make sure the following are configured:&lt;br /&gt;
*** eth0 uses dhcp&lt;br /&gt;
*** networking is set to autostart&lt;br /&gt;
*** sshd is installed and set to autostart&lt;br /&gt;
*** Your ssh public key is in /root/.ssh/authorized_keys&lt;br /&gt;
*** The root password is set to something&lt;br /&gt;
*** lbu include root/.ssh&lt;br /&gt;
*** (optional) - Delete the /etc/ssh/*key* files, so they are created on the new box&lt;br /&gt;
** {{Cmd|lbu package amazon.apkovl.tar.gz}} {{Warning|If you are packaging on a 32bit box, manually delete etc/apk/arch from the apkovl.tar.gz file}}&lt;br /&gt;
** Copy amazon.apkovl.tar.gz to target/ &lt;br /&gt;
* Unmount target&lt;br /&gt;
* &#039;&#039;&#039;Do the following from the Amazon web interface&#039;&#039;&#039;&lt;br /&gt;
** Detach the new volume&lt;br /&gt;
** Make note of the volume ID&lt;br /&gt;
** Launch NEW instance.  Use defaults, amazon linux, micro; we are going to canibalize it in a bit, so defaults are fine here.&lt;br /&gt;
** Once the instance starts, &#039;&#039;stop&#039;&#039; but &#039;&#039;do not terminate&#039;&#039; the instance.&lt;br /&gt;
** Under EBS, detach the existing volume, and attach the alpine linux volume as /dev/sda1 (note the 1 at the end)&lt;br /&gt;
** Restart the instance&lt;br /&gt;
* Log in and make sure it works&lt;br /&gt;
* Do any final cleanups necessary, and if necessary lbu ci&lt;br /&gt;
** Only make configs that are appropriate for an AMI, we are going to snapshot this instance and create an AMI out of it&lt;br /&gt;
* Again from the Amazon web interface&lt;br /&gt;
** Delete the 8GB volume that is no longer needed&lt;br /&gt;
** &#039;&#039;Stop&#039;&#039; but do not terminate the instance&lt;br /&gt;
** Right click the stopped instance and choose &#039;Create Image (EBS AMI)&#039;&lt;br /&gt;
*** Image name should be unique for the image - example AlpineLinux-2.4.5&lt;br /&gt;
*** Description can be anything - example &#039;Base AlpineLinux Installation - no services&#039;&lt;br /&gt;
* Done. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_Homer&amp;diff=12801</id>
		<title>Setting up Homer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_Homer&amp;diff=12801"/>
		<updated>2016-05-16T14:16:22Z</updated>

		<summary type="html">&lt;p&gt;Larena: first edit, rough notes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
Rough notes for setting up [http://sipcapture.org Homer] on Alpine Linux from testing repository&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add homer-ui homer-api-doc nginx php5-fpm&lt;br /&gt;
apk add mariadb mariadb-client&lt;br /&gt;
rc-service mariadb setup&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
rc-update add mariadb&lt;br /&gt;
/usr/bin/mysql_secure_installation&lt;br /&gt;
mysql -u root -p &amp;lt; /usr/share/homer-api/sql/homer_databases.sql&lt;br /&gt;
mysql -u root -p &amp;lt; /usr/share/homer-api/sql/homer_user.sql&lt;br /&gt;
mysql -u root homer_data -p &amp;lt; /usr/share/homer-api/sql/schema_data.sql&lt;br /&gt;
mysql -u root homer_configuration -p &amp;lt; /usr/share/homer-api/sql/schema_configuration.sql&lt;br /&gt;
mysql -u root homer_statistic -p &amp;lt; /usr/share/homer-api/sql/schema_statistic.sql&lt;br /&gt;
cp /usr/share/doc/homer-api/examples/web/homer5.nginx /etc/nginx/sites-available/homer5&lt;br /&gt;
cp /usr/share/doc/homer-api/examples/web/homer5.php-fpm /etc/php5/fpm.d/homer5.conf&lt;br /&gt;
rc-service php-fpm start&lt;br /&gt;
rc-update add php-fpm&lt;br /&gt;
rm /etc/nginx/sites-enabled/test&lt;br /&gt;
ln ../sites-available/homer5 /etc/nginx/sites-enabled/homer5&lt;br /&gt;
rc-service nginx start&lt;br /&gt;
rc-update add nginx&lt;br /&gt;
ln -s /usr/share/webapps/homer-ui /var/www/localhost/htdocs/homer&lt;br /&gt;
edit &amp;quot;root&amp;quot;, &amp;quot;server&amp;quot; in /etc/nginx/sites-available/homer5.nginx &amp;quot;/var/www/localhost/htdocs/homer&amp;quot;&lt;br /&gt;
edit &amp;quot;HOMER_TIMEZONE&amp;quot; in /etc/homer/preferences.php&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=11267</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=11267"/>
		<updated>2015-10-23T08:02:25Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Help and debugging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall ({{pkg|AWall}}) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain {{pkg|AWall}} from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{pkg|AWall}} is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax.&lt;br /&gt;
&lt;br /&gt;
Some of the below features and examples assumes that you are running {{pkg|AWall}} version 0.2.12 or later.&amp;lt;BR&amp;gt;&lt;br /&gt;
Make sure you are running latest version by running the following commands:&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk add -u awall&lt;br /&gt;
apk version awall}}&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your {{pkg|AWall}} firewall configuration file(s) goes to {{Path|/etc/awall/optional}}&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{note| {{pkg|AWall}} versions prior 0.2.12 will only look for &#039;&#039;Policy&#039;&#039; files in {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;From version 0.2.12 and higher, {{pkg|AWall}} will look for &#039;&#039;Policy&#039;&#039; files in both {{Path|/etc/awall/optional}} and {{Path|/usr/share/awall/optional}}}}&lt;br /&gt;
You may have multiple &#039;&#039;Policy&#039;&#039; files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|{{pkg|AWall}}&#039;s &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
An {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing {{pkg|AWall}}, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after {{pkg|AWall}} installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to {{pkg|AWall}}.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure {{pkg|AWall}} to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/etc/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/etc/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| {{pkg|AWall}} has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/etc/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/etc/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
{{pkg|AWall}} will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository ({{pkg|AWall}} v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|{{pkg|AWall}} already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
If you need to forward to a different port (e.g. 8080) you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;dnat&amp;quot;: [&lt;br /&gt;
  {&amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &amp;quot;to-addr&amp;quot;: &amp;quot;$APACHE&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &amp;quot;to-port&amp;quot;: 8080 }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
awall dump            # Dump definitions like zones and variables&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=11266</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=11266"/>
		<updated>2015-10-23T08:01:21Z</updated>

		<summary type="html">&lt;p&gt;Larena: add awall dump&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall ({{pkg|AWall}}) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain {{pkg|AWall}} from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{pkg|AWall}} is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax.&lt;br /&gt;
&lt;br /&gt;
Some of the below features and examples assumes that you are running {{pkg|AWall}} version 0.2.12 or later.&amp;lt;BR&amp;gt;&lt;br /&gt;
Make sure you are running latest version by running the following commands:&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk add -u awall&lt;br /&gt;
apk version awall}}&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your {{pkg|AWall}} firewall configuration file(s) goes to {{Path|/etc/awall/optional}}&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{note| {{pkg|AWall}} versions prior 0.2.12 will only look for &#039;&#039;Policy&#039;&#039; files in {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;From version 0.2.12 and higher, {{pkg|AWall}} will look for &#039;&#039;Policy&#039;&#039; files in both {{Path|/etc/awall/optional}} and {{Path|/usr/share/awall/optional}}}}&lt;br /&gt;
You may have multiple &#039;&#039;Policy&#039;&#039; files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|{{pkg|AWall}}&#039;s &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
An {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing {{pkg|AWall}}, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after {{pkg|AWall}} installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to {{pkg|AWall}}.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure {{pkg|AWall}} to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/etc/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/etc/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| {{pkg|AWall}} has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/etc/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/etc/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
{{pkg|AWall}} will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository ({{pkg|AWall}} v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|{{pkg|AWall}} already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
If you need to forward to a different port (e.g. 8080) you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;dnat&amp;quot;: [&lt;br /&gt;
  {&amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &amp;quot;to-addr&amp;quot;: &amp;quot;$APACHE&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &amp;quot;to-port&amp;quot;: 8080 }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
awall dump                  # Dump definitions like zones and variables&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=11155</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=11155"/>
		<updated>2015-08-14T07:32:23Z</updated>

		<summary type="html">&lt;p&gt;Larena: add fastcgi_read_timeout&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Large files upload takes sometime to be processed by php-fpm. So you need to bump the Nginx read default timeout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_read_timeout 300s;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=LXC&amp;diff=11119</id>
		<title>LXC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=LXC&amp;diff=11119"/>
		<updated>2015-07-31T14:22:24Z</updated>

		<summary type="html">&lt;p&gt;Larena: Remove CMD format&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://lxc.sourceforge.net/ Linux Containers (LXC)] provides containers similar BSD Jails, Linux VServer and Solaris Zones. It gives the impression of virtualization, but shares the kernel and resources with the &amp;quot;host&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install the required packages:&lt;br /&gt;
{{Cmd|apk add lxc lxc-templates bridge}}&lt;br /&gt;
&lt;br /&gt;
== Prepare network on host ==&lt;br /&gt;
Set up a [[bridge]] on the host. Example &#039;&#039;/etc/network/interfaces&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto br0&lt;br /&gt;
iface br0 inet dhcp&lt;br /&gt;
    bridge-ports eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a network configuration template for the guests, &#039;&#039;/etc/lxc/lxc.conf&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lxc.network.type = veth&lt;br /&gt;
lxc.network.link = br0&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a guest ==&lt;br /&gt;
&lt;br /&gt;
=== Alpine Template ===&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lxc-create -n guest1 -f /etc/lxc/lxc.conf -t alpine}}&lt;br /&gt;
&lt;br /&gt;
This will create a &#039;&#039;/var/lib/lxc/guest1&#039;&#039; directory with a &#039;&#039;config&#039;&#039; file and a &#039;&#039;rootfs&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Note that by default alpine template &#039;&#039;&#039;does not have networking service on&#039;&#039;&#039;, you will need to add it using lxc-console&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If running on x86_64 architecture, it is possible to create a 32bit guest:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lxc-create -n guest1 -f /etc/lxc/lxc.conf -t alpine -- --arch x86}}&lt;br /&gt;
&lt;br /&gt;
=== Debian template ===&lt;br /&gt;
&lt;br /&gt;
In order to create a debian template container you will need to install some packages:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add debootstrap rsync}}&lt;br /&gt;
&lt;br /&gt;
Also you will need to turn off some grsecurity chroot options otherwise the debootstrap will fail:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_caps&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chroot&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mount&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mknod&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chmod&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please remember to turn them back on, or just simply reboot the system.&lt;br /&gt;
&lt;br /&gt;
Now you can run:&lt;br /&gt;
{{Cmd|SUITE{{=}}wheezy lxc-create -n guest1 -f /etc/lxc/lxc.conf -t debian}}&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu template ===&lt;br /&gt;
&lt;br /&gt;
In order to create an ubuntu template container you will need to turn off some grsecurity chroot options:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_caps&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chroot&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mount&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mknod&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chmod&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please remember to turn them back on, or just simply reboot the system.&lt;br /&gt;
&lt;br /&gt;
Now you can run (replace %MIRROR% with the actual hostname):&lt;br /&gt;
&lt;br /&gt;
MIRROR=&amp;quot;http://%MIRROR%/ubuntu/&amp;quot; lxc-create -n ubtn -f /etc/lxc/default.conf -t ubuntu -- -r trusty&lt;br /&gt;
&lt;br /&gt;
== Starting/Stopping the guest ==&lt;br /&gt;
Create a symlink to the &#039;&#039;/etc/init.d/lxc&#039;&#039; script for your guest.&lt;br /&gt;
{{Cmd|ln -s lxc /etc/init.d/lxc.guest1}}&lt;br /&gt;
&lt;br /&gt;
You can start your guest with:&lt;br /&gt;
{{Cmd|/etc/init.d/lxc.guest1 start}}&lt;br /&gt;
&lt;br /&gt;
Stop it with:&lt;br /&gt;
{{Cmd|/etc/init.d/lxc.guest1 stop}}&lt;br /&gt;
&lt;br /&gt;
Make it autostart on boot up with:&lt;br /&gt;
{{Cmd| rc-update add lxc.guest1}}&lt;br /&gt;
&lt;br /&gt;
You can also add to the container config: &amp;lt;code&amp;gt;lxc.start.auto = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp; {{Cmd|rc-update add lxc}}&lt;br /&gt;
&lt;br /&gt;
to autostart containers by the lxc service only.&lt;br /&gt;
&lt;br /&gt;
== Connecting to the guest ==&lt;br /&gt;
By default sshd is not installed, so you will have to connect to a virtual console. This is done with:&lt;br /&gt;
{{Cmd|lxc-console -n guest1}}&lt;br /&gt;
&lt;br /&gt;
To disconnect from it, press {{key|Ctrl}}+{{key|a}} {{key|q}}&lt;br /&gt;
&lt;br /&gt;
== Deleting a guest ==&lt;br /&gt;
Make sure the guest is stopped and run:&lt;br /&gt;
{{Cmd|lxc-destroy -n guest1}}&lt;br /&gt;
This will erase everything, without asking any questions. It is equivalent to: {{Cmd|rm -r /var/lib/lxc/guest1}}&lt;br /&gt;
&lt;br /&gt;
== Advanced ==&lt;br /&gt;
&lt;br /&gt;
=== Creating a LXC container without modifying your network interfaces ===&lt;br /&gt;
&lt;br /&gt;
The problem with bridging is that the interface you bridge gets replaced with your new bridge interface.&lt;br /&gt;
That is to say that say you have an interface eth0 that you want to bridge, your eth0 interface gets replaced with the br0 interface that you create. It also means that the interface you use needs to be placed into promiscuous mode to catch all the traffic that could de destined to the other side of the bridge, which again may not be what you want.&lt;br /&gt;
&lt;br /&gt;
The solution is to create a dummy network interface, bridge that, and set up NAT so that traffic out of your bridge interface gets pushed through the interface of your choice.&lt;br /&gt;
&lt;br /&gt;
So, first, lets create that dummy interface (thanks to ncopa for talking me out of macvlan and pointing out the dummy interface kernel module)&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe dummy}}&lt;br /&gt;
&lt;br /&gt;
This will create a dummy interface called dummy0 on your host.&lt;br /&gt;
&lt;br /&gt;
Now we will create a bridge called br0&lt;br /&gt;
&lt;br /&gt;
{{Cmd |brctl addbr br0&lt;br /&gt;
brctl setfd br0 0 }}&lt;br /&gt;
&lt;br /&gt;
and then make that dummy interface one end of the bridge&lt;br /&gt;
&lt;br /&gt;
{{Cmd | brctl addif br0 dummy0 }}&lt;br /&gt;
&lt;br /&gt;
Next, let&#039;s give that bridged interface a reason to exists&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | ifconfig br0 192.168.1.1 netmask 255.255.255.0 up}}&lt;br /&gt;
&lt;br /&gt;
Create a file for your container, let&#039;s say /etc/lxc/bridgenat.conf, with the following settings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lxc.network.type = veth&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
lxc.network.link = br0&lt;br /&gt;
lxc.network.name = eth1&lt;br /&gt;
lxc.network.ipv4 = 192.168.1.2/24&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and build your container with that file&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | lxc-create -n alpine -f /etc/lxc/bridgenat.conf -t alpine }}&lt;br /&gt;
&lt;br /&gt;
You should now be able to ping your container from your hosts, and your host from your container.&lt;br /&gt;
&lt;br /&gt;
Your container needs to know where to push traffic that isn&#039;t within it&#039;s subnet. To do so, we tell the container to route through the bridge interface br0&lt;br /&gt;
From inside the container run&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | route add default gw 192.168.1.1 }}&lt;br /&gt;
&lt;br /&gt;
The next step is you push the traffic coming from your private subnet over br0 out through your internet facing interface, or any interface you chose&lt;br /&gt;
&lt;br /&gt;
We are messing with your IP tables here, so make sure these settings don&#039;t conflict with anything you may have already set up, obviously.&lt;br /&gt;
&lt;br /&gt;
Say eth0 was your internet facing network interface, and br0 is the name of the bridge you made earlier, we&#039;d do this:&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE&lt;br /&gt;
iptables --append FORWARD --in-interface br0 -j ACCEPT&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Now you should be able to route through your bridge interface to the internet facing interface of your host from your container, just like at home!&lt;br /&gt;
&lt;br /&gt;
You could also have a dhcp server running on your host, and set it up to give IP addresses from your private subnet to any container that requests it, and then have one template for multiple alpine LXC containers, perfect for alpine development :)&lt;br /&gt;
&lt;br /&gt;
=== Using static IP ===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using static IP, you need to configure this properly on guest&#039;s /etc/network/interfaces. To stay on the above example, modify &#039;&#039;/var/lib/lxc/guest1/rootfs/etc/network/interfaces&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
from&lt;br /&gt;
&lt;br /&gt;
 #auto lo&lt;br /&gt;
     iface lo inet loopback&lt;br /&gt;
 auto eth0&lt;br /&gt;
     iface eth0 inet &#039;&#039;&#039;dhcp&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
 #auto lo&lt;br /&gt;
     iface lo inet loopback&lt;br /&gt;
 auto eth0&lt;br /&gt;
     iface eth0 inet &#039;&#039;&#039;static&#039;&#039;&#039;&lt;br /&gt;
     address &amp;lt;lxc-container-ip&amp;gt;   # IP which the lxc container should use&lt;br /&gt;
     gateway &amp;lt;gateway-ip&amp;gt;         # IP of gateway to use, mostly same as on lxc-host&lt;br /&gt;
     netmask &amp;lt;netmask&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mem and swap ===&lt;br /&gt;
&lt;br /&gt;
{{Cmd|vim /boot/extlinux.conf}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&lt;br /&gt;
  APPEND initrd{{=}}initramfs-3.10.13-1-grsec root{{=}}UUID{{=}}7cd8789f-5659-40f8-9548-ae8f89c918ab modules{{=}}sd-mod,usb-storage,ext4 quiet cgroup_enable{{=}}memory swapaccount{{=}}1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== checkconfig ===&lt;br /&gt;
{{Cmd|lxc-checkconfig}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&lt;br /&gt;
Kernel configuration not found at /proc/config.gz; searching...&lt;br /&gt;
Kernel configuration found at /boot/config-3.10.13-1-grsec&lt;br /&gt;
--- Namespaces ---&lt;br /&gt;
Namespaces: enabled&lt;br /&gt;
Utsname namespace: enabled&lt;br /&gt;
Ipc namespace: enabled&lt;br /&gt;
Pid namespace: enabled&lt;br /&gt;
User namespace: missing&lt;br /&gt;
Network namespace: enabled&lt;br /&gt;
Multiple /dev/pts instances: enabled&lt;br /&gt;
&lt;br /&gt;
--- Control groups ---&lt;br /&gt;
Cgroup: enabled&lt;br /&gt;
Cgroup clone_children flag: enabled&lt;br /&gt;
Cgroup device: enabled&lt;br /&gt;
Cgroup sched: enabled&lt;br /&gt;
Cgroup cpu account: enabled&lt;br /&gt;
Cgroup memory controller: missing&lt;br /&gt;
Cgroup cpuset: enabled&lt;br /&gt;
&lt;br /&gt;
--- Misc ---&lt;br /&gt;
Veth pair device: enabled&lt;br /&gt;
Macvlan: enabled&lt;br /&gt;
Vlan: enabled&lt;br /&gt;
File capabilities: enabled&lt;br /&gt;
&lt;br /&gt;
Note : Before booting a new kernel, you can check its configuration&lt;br /&gt;
usage : CONFIG{{=}}/path/to/config /usr/bin/lxc-checkconfig&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== VirtualBox ===&lt;br /&gt;
&lt;br /&gt;
In order for network to work on containers you need to set &amp;quot;Promiscuous Mode&amp;quot; to &amp;quot;Allow All&amp;quot; in VirtualBox settings for the network adapter.&lt;br /&gt;
&lt;br /&gt;
[[File:VirtualBoxNetworkAdapter.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;br /&gt;
&lt;br /&gt;
=== postgreSQL ===&lt;br /&gt;
&lt;br /&gt;
Inside the container run: {{Cmd|chmod go+w /dev/null}} to fix {{Cmd|rc-service postgresql start}}&lt;br /&gt;
&lt;br /&gt;
=== openVPN ===&lt;br /&gt;
&lt;br /&gt;
see [[Setting_up_a_OpenVPN_server#openVPN_and_LXC]]&lt;br /&gt;
&lt;br /&gt;
== LXC 1.0 Additional information ==&lt;br /&gt;
&lt;br /&gt;
Some info regarding new features in LXC 1.0&lt;br /&gt;
 &lt;br /&gt;
https://www.stgraber.org/2013/12/20/lxc-1-0-blog-post-series/&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=LXC&amp;diff=11118</id>
		<title>LXC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=LXC&amp;diff=11118"/>
		<updated>2015-07-31T14:19:22Z</updated>

		<summary type="html">&lt;p&gt;Larena: add Ubuntu template creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://lxc.sourceforge.net/ Linux Containers (LXC)] provides containers similar BSD Jails, Linux VServer and Solaris Zones. It gives the impression of virtualization, but shares the kernel and resources with the &amp;quot;host&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install the required packages:&lt;br /&gt;
{{Cmd|apk add lxc lxc-templates bridge}}&lt;br /&gt;
&lt;br /&gt;
== Prepare network on host ==&lt;br /&gt;
Set up a [[bridge]] on the host. Example &#039;&#039;/etc/network/interfaces&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto br0&lt;br /&gt;
iface br0 inet dhcp&lt;br /&gt;
    bridge-ports eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a network configuration template for the guests, &#039;&#039;/etc/lxc/lxc.conf&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lxc.network.type = veth&lt;br /&gt;
lxc.network.link = br0&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a guest ==&lt;br /&gt;
&lt;br /&gt;
=== Alpine Template ===&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lxc-create -n guest1 -f /etc/lxc/lxc.conf -t alpine}}&lt;br /&gt;
&lt;br /&gt;
This will create a &#039;&#039;/var/lib/lxc/guest1&#039;&#039; directory with a &#039;&#039;config&#039;&#039; file and a &#039;&#039;rootfs&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Note that by default alpine template &#039;&#039;&#039;does not have networking service on&#039;&#039;&#039;, you will need to add it using lxc-console&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If running on x86_64 architecture, it is possible to create a 32bit guest:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lxc-create -n guest1 -f /etc/lxc/lxc.conf -t alpine -- --arch x86}}&lt;br /&gt;
&lt;br /&gt;
=== Debian template ===&lt;br /&gt;
&lt;br /&gt;
In order to create a debian template container you will need to install some packages:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add debootstrap rsync}}&lt;br /&gt;
&lt;br /&gt;
Also you will need to turn off some grsecurity chroot options otherwise the debootstrap will fail:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_caps&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chroot&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mount&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mknod&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chmod&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please remember to turn them back on, or just simply reboot the system.&lt;br /&gt;
&lt;br /&gt;
Now you can run:&lt;br /&gt;
{{Cmd|SUITE{{=}}wheezy lxc-create -n guest1 -f /etc/lxc/lxc.conf -t debian}}&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu template ===&lt;br /&gt;
&lt;br /&gt;
In order to create an ubuntu template container you will need to turn off some grsecurity chroot options:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_caps&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chroot&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mount&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_mknod&lt;br /&gt;
echo 0 &amp;gt; /proc/sys/kernel/grsecurity/chroot_deny_chmod&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please remember to turn them back on, or just simply reboot the system.&lt;br /&gt;
&lt;br /&gt;
Now you can run (replace %MIRROR% with the actual hostname):&lt;br /&gt;
{{Cmd|MIRROR=&amp;quot;http://%MIRROR%/ubuntu/&amp;quot; lxc-create -n ubtn -f /etc/lxc/default.conf -t ubuntu -- -r trusty&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Starting/Stopping the guest ==&lt;br /&gt;
Create a symlink to the &#039;&#039;/etc/init.d/lxc&#039;&#039; script for your guest.&lt;br /&gt;
{{Cmd|ln -s lxc /etc/init.d/lxc.guest1}}&lt;br /&gt;
&lt;br /&gt;
You can start your guest with:&lt;br /&gt;
{{Cmd|/etc/init.d/lxc.guest1 start}}&lt;br /&gt;
&lt;br /&gt;
Stop it with:&lt;br /&gt;
{{Cmd|/etc/init.d/lxc.guest1 stop}}&lt;br /&gt;
&lt;br /&gt;
Make it autostart on boot up with:&lt;br /&gt;
{{Cmd| rc-update add lxc.guest1}}&lt;br /&gt;
&lt;br /&gt;
You can also add to the container config: &amp;lt;code&amp;gt;lxc.start.auto = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp; {{Cmd|rc-update add lxc}}&lt;br /&gt;
&lt;br /&gt;
to autostart containers by the lxc service only.&lt;br /&gt;
&lt;br /&gt;
== Connecting to the guest ==&lt;br /&gt;
By default sshd is not installed, so you will have to connect to a virtual console. This is done with:&lt;br /&gt;
{{Cmd|lxc-console -n guest1}}&lt;br /&gt;
&lt;br /&gt;
To disconnect from it, press {{key|Ctrl}}+{{key|a}} {{key|q}}&lt;br /&gt;
&lt;br /&gt;
== Deleting a guest ==&lt;br /&gt;
Make sure the guest is stopped and run:&lt;br /&gt;
{{Cmd|lxc-destroy -n guest1}}&lt;br /&gt;
This will erase everything, without asking any questions. It is equivalent to: {{Cmd|rm -r /var/lib/lxc/guest1}}&lt;br /&gt;
&lt;br /&gt;
== Advanced ==&lt;br /&gt;
&lt;br /&gt;
=== Creating a LXC container without modifying your network interfaces ===&lt;br /&gt;
&lt;br /&gt;
The problem with bridging is that the interface you bridge gets replaced with your new bridge interface.&lt;br /&gt;
That is to say that say you have an interface eth0 that you want to bridge, your eth0 interface gets replaced with the br0 interface that you create. It also means that the interface you use needs to be placed into promiscuous mode to catch all the traffic that could de destined to the other side of the bridge, which again may not be what you want.&lt;br /&gt;
&lt;br /&gt;
The solution is to create a dummy network interface, bridge that, and set up NAT so that traffic out of your bridge interface gets pushed through the interface of your choice.&lt;br /&gt;
&lt;br /&gt;
So, first, lets create that dummy interface (thanks to ncopa for talking me out of macvlan and pointing out the dummy interface kernel module)&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe dummy}}&lt;br /&gt;
&lt;br /&gt;
This will create a dummy interface called dummy0 on your host.&lt;br /&gt;
&lt;br /&gt;
Now we will create a bridge called br0&lt;br /&gt;
&lt;br /&gt;
{{Cmd |brctl addbr br0&lt;br /&gt;
brctl setfd br0 0 }}&lt;br /&gt;
&lt;br /&gt;
and then make that dummy interface one end of the bridge&lt;br /&gt;
&lt;br /&gt;
{{Cmd | brctl addif br0 dummy0 }}&lt;br /&gt;
&lt;br /&gt;
Next, let&#039;s give that bridged interface a reason to exists&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | ifconfig br0 192.168.1.1 netmask 255.255.255.0 up}}&lt;br /&gt;
&lt;br /&gt;
Create a file for your container, let&#039;s say /etc/lxc/bridgenat.conf, with the following settings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lxc.network.type = veth&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
lxc.network.link = br0&lt;br /&gt;
lxc.network.name = eth1&lt;br /&gt;
lxc.network.ipv4 = 192.168.1.2/24&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and build your container with that file&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | lxc-create -n alpine -f /etc/lxc/bridgenat.conf -t alpine }}&lt;br /&gt;
&lt;br /&gt;
You should now be able to ping your container from your hosts, and your host from your container.&lt;br /&gt;
&lt;br /&gt;
Your container needs to know where to push traffic that isn&#039;t within it&#039;s subnet. To do so, we tell the container to route through the bridge interface br0&lt;br /&gt;
From inside the container run&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | route add default gw 192.168.1.1 }}&lt;br /&gt;
&lt;br /&gt;
The next step is you push the traffic coming from your private subnet over br0 out through your internet facing interface, or any interface you chose&lt;br /&gt;
&lt;br /&gt;
We are messing with your IP tables here, so make sure these settings don&#039;t conflict with anything you may have already set up, obviously.&lt;br /&gt;
&lt;br /&gt;
Say eth0 was your internet facing network interface, and br0 is the name of the bridge you made earlier, we&#039;d do this:&lt;br /&gt;
&lt;br /&gt;
{{ Cmd | echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE&lt;br /&gt;
iptables --append FORWARD --in-interface br0 -j ACCEPT&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Now you should be able to route through your bridge interface to the internet facing interface of your host from your container, just like at home!&lt;br /&gt;
&lt;br /&gt;
You could also have a dhcp server running on your host, and set it up to give IP addresses from your private subnet to any container that requests it, and then have one template for multiple alpine LXC containers, perfect for alpine development :)&lt;br /&gt;
&lt;br /&gt;
=== Using static IP ===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using static IP, you need to configure this properly on guest&#039;s /etc/network/interfaces. To stay on the above example, modify &#039;&#039;/var/lib/lxc/guest1/rootfs/etc/network/interfaces&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
from&lt;br /&gt;
&lt;br /&gt;
 #auto lo&lt;br /&gt;
     iface lo inet loopback&lt;br /&gt;
 auto eth0&lt;br /&gt;
     iface eth0 inet &#039;&#039;&#039;dhcp&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
 #auto lo&lt;br /&gt;
     iface lo inet loopback&lt;br /&gt;
 auto eth0&lt;br /&gt;
     iface eth0 inet &#039;&#039;&#039;static&#039;&#039;&#039;&lt;br /&gt;
     address &amp;lt;lxc-container-ip&amp;gt;   # IP which the lxc container should use&lt;br /&gt;
     gateway &amp;lt;gateway-ip&amp;gt;         # IP of gateway to use, mostly same as on lxc-host&lt;br /&gt;
     netmask &amp;lt;netmask&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mem and swap ===&lt;br /&gt;
&lt;br /&gt;
{{Cmd|vim /boot/extlinux.conf}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&lt;br /&gt;
  APPEND initrd{{=}}initramfs-3.10.13-1-grsec root{{=}}UUID{{=}}7cd8789f-5659-40f8-9548-ae8f89c918ab modules{{=}}sd-mod,usb-storage,ext4 quiet cgroup_enable{{=}}memory swapaccount{{=}}1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== checkconfig ===&lt;br /&gt;
{{Cmd|lxc-checkconfig}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&lt;br /&gt;
Kernel configuration not found at /proc/config.gz; searching...&lt;br /&gt;
Kernel configuration found at /boot/config-3.10.13-1-grsec&lt;br /&gt;
--- Namespaces ---&lt;br /&gt;
Namespaces: enabled&lt;br /&gt;
Utsname namespace: enabled&lt;br /&gt;
Ipc namespace: enabled&lt;br /&gt;
Pid namespace: enabled&lt;br /&gt;
User namespace: missing&lt;br /&gt;
Network namespace: enabled&lt;br /&gt;
Multiple /dev/pts instances: enabled&lt;br /&gt;
&lt;br /&gt;
--- Control groups ---&lt;br /&gt;
Cgroup: enabled&lt;br /&gt;
Cgroup clone_children flag: enabled&lt;br /&gt;
Cgroup device: enabled&lt;br /&gt;
Cgroup sched: enabled&lt;br /&gt;
Cgroup cpu account: enabled&lt;br /&gt;
Cgroup memory controller: missing&lt;br /&gt;
Cgroup cpuset: enabled&lt;br /&gt;
&lt;br /&gt;
--- Misc ---&lt;br /&gt;
Veth pair device: enabled&lt;br /&gt;
Macvlan: enabled&lt;br /&gt;
Vlan: enabled&lt;br /&gt;
File capabilities: enabled&lt;br /&gt;
&lt;br /&gt;
Note : Before booting a new kernel, you can check its configuration&lt;br /&gt;
usage : CONFIG{{=}}/path/to/config /usr/bin/lxc-checkconfig&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== VirtualBox ===&lt;br /&gt;
&lt;br /&gt;
In order for network to work on containers you need to set &amp;quot;Promiscuous Mode&amp;quot; to &amp;quot;Allow All&amp;quot; in VirtualBox settings for the network adapter.&lt;br /&gt;
&lt;br /&gt;
[[File:VirtualBoxNetworkAdapter.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;br /&gt;
&lt;br /&gt;
=== postgreSQL ===&lt;br /&gt;
&lt;br /&gt;
Inside the container run: {{Cmd|chmod go+w /dev/null}} to fix {{Cmd|rc-service postgresql start}}&lt;br /&gt;
&lt;br /&gt;
=== openVPN ===&lt;br /&gt;
&lt;br /&gt;
see [[Setting_up_a_OpenVPN_server#openVPN_and_LXC]]&lt;br /&gt;
&lt;br /&gt;
== LXC 1.0 Additional information ==&lt;br /&gt;
&lt;br /&gt;
Some info regarding new features in LXC 1.0&lt;br /&gt;
 &lt;br /&gt;
https://www.stgraber.org/2013/12/20/lxc-1-0-blog-post-series/&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Request_Tracker&amp;diff=10912</id>
		<title>Request Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Request_Tracker&amp;diff=10912"/>
		<updated>2015-05-29T11:25:52Z</updated>

		<summary type="html">&lt;p&gt;Larena: Fix syntax of latest versions of postgresql-client utilities&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide will get [http://bestpractical.com/rt/ Request Tracker] 4 setup working, with support for emails sent to an mlmmj mailing list to be inserted first into the ticket system, then sent on to mlmmj.  It is intended for a HelpDesk-type deployment.  This howto assumes that you have a working postfix setup already. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: This document has been tested on Alpine Linux 2.2.2, but contains some packages which are currently in the [[Edge|edge/testing]] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: Use a computer with at least 512MB of RAM.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Initial package installation and setup ==&lt;br /&gt;
&lt;br /&gt;
* add edge/main repository to /etc/apk/repositories&lt;br /&gt;
{{Cmd|printf &amp;quot;http://nl.alpinelinux.org/alpine/edge/main&amp;quot; &amp;gt;&amp;gt; /etc/apk/repositories&lt;br /&gt;
 apk update}}&lt;br /&gt;
* {{Cmd|apk add lighttpd fcgi postgresql rt4 postfix postfix-pcre mlmmj}}&lt;br /&gt;
* Edit &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039; and enable fastcgi&lt;br /&gt;
* {{Cmd|/etc/init.d/postgresql setup}}&lt;br /&gt;
* {{Cmd|/etc/init.d/postgresql start}}&lt;br /&gt;
* {{Cmd|su - postgres -c &amp;quot;createuser -P rt_user&amp;quot;}}&lt;br /&gt;
 Enter password for new role: &#039;&#039;&#039;&#039;&#039;rtpass&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
 Enter it again: &#039;&#039;&#039;&#039;&#039;rtpass&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
 Shall the new role be a superuser? (y/n) &#039;&#039;&#039;n&#039;&#039;&#039;&lt;br /&gt;
 Shall the new role be allowed to create databases? (y/n) &#039;&#039;&#039;y&#039;&#039;&#039;&lt;br /&gt;
 Shall the new role be allowed to create more new roles? (y/n) &#039;&#039;&#039;y&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Setup RT4 environment ==&lt;br /&gt;
* {{Cmd|cp /etc/rt4/RT_Config.pm /etc/rt4/RT_SiteConfig.pm}}&lt;br /&gt;
* {{Cmd|chmod 644 /etc/rt4/RT_SiteConfig.pm}}&lt;br /&gt;
* Setup RT_SiteConfig.pm with proper queue name, link to your organization&#039;s homepage, support postgresql, set outbound email defaults.&lt;br /&gt;
** /etc/rt4/RT_SiteConfig.pm:&lt;br /&gt;
 Set($rtname, &#039;support&#039;);&lt;br /&gt;
 Set($Organization, &#039;example.com&#039;);&lt;br /&gt;
 Set($WebDomain, &#039;fqdn.in.example.com&#039;);&lt;br /&gt;
 Set($OwnerEmail, &#039;RTAdmin@example.com&#039;);&lt;br /&gt;
 Set($LogoLinkURL, &#039;http://www.example.com/&#039;);&lt;br /&gt;
 Set($LogoAltText, &#039;Example.com Support&#039;);&lt;br /&gt;
 # Set($LogoURL, &#039;&#039;);&lt;br /&gt;
 &lt;br /&gt;
 Set($DatabaseType, &#039;Pg&#039;);&lt;br /&gt;
 Set($DatabaseUser, &#039;rt_user&#039;);&lt;br /&gt;
 Set($DatabasePassword, &#039;rtpass&#039;);&lt;br /&gt;
 Set($DatabaseName, &#039;support_rt&#039;);&lt;br /&gt;
 &lt;br /&gt;
 Set($LogToSyslog, &#039;warning&#039;);&lt;br /&gt;
 &lt;br /&gt;
 Set($MailCommand, &#039;sendmailpipe&#039;);&lt;br /&gt;
 Set($SendmailArguments , &#039;-fpostmaster@example.com -oi -t&#039;);&lt;br /&gt;
 Set($ParseNewMessageForTicketCCs, 1);&lt;br /&gt;
 Set($UseTransactionBatch, 1);&lt;br /&gt;
 Set($CorrespondAddress, &#039;support@example.com&#039;);&lt;br /&gt;
 Set($CommentAddress, &#039;support@example.com&#039;);&lt;br /&gt;
 Set($RecordOutgoingEmail, 0);&lt;br /&gt;
 Set($ForwardFromUser, 1);&lt;br /&gt;
 Set($SetOutgoingMailFrom, 1);&lt;br /&gt;
 Set($FriendlyFromLineFormat, &#039;&amp;quot;%s&amp;quot; &amp;lt;%s&amp;gt;&#039;);&lt;br /&gt;
* {{Cmd|/usr/sbin/rt-setup-database --action init --dba postgres}}&lt;br /&gt;
* {{Cmd|rt-server}}&lt;br /&gt;
* Test and make sure that you can access rt using the built-in webserver first.&lt;br /&gt;
** Tools -&amp;gt; Config -&amp;gt; Users -&amp;gt; Create&lt;br /&gt;
** Username: Support-lists, Email: support-lists@example.com, etc -&amp;gt; Create&lt;br /&gt;
** Tools -&amp;gt; Config -&amp;gt; Groups -&amp;gt; Create&lt;br /&gt;
** Name: Support Users, etc -&amp;gt; Create&lt;br /&gt;
** Tools -&amp;gt; Configuration -&amp;gt; Queues -&amp;gt; Create... Give it a name like &#039;support&#039;, and set support-list@example.com to be both reply and comment addresses.  Remember the name &#039;support&#039; which you&#039;ll use in the next sections (including the email address)&lt;br /&gt;
&lt;br /&gt;
== Modify Postfix Configuration for RT4 and mlmmj ==&lt;br /&gt;
&lt;br /&gt;
* adduser mlmmj&lt;br /&gt;
* mkdir /var/spool/mlmmj&lt;br /&gt;
* mlmmj-make-ml.sh -L support-list&lt;br /&gt;
* Support sending bcc to list&lt;br /&gt;
** touch /var/spool/mlmmj/support-list/control/tocc&lt;br /&gt;
* Allow support@example.com to send to list without being subscribed to it&lt;br /&gt;
** mlmmj-sub -L /var/spool/mlmmj/support-list -a support@example.com -n&lt;br /&gt;
* Add to &#039;&#039;/etc/postfix/master.cf&#039;&#039;:&lt;br /&gt;
 rt4    unix  -       n       n       -       -       pipe flags=DORhu user=lighttpd argv=/usr/bin/rt-mailgate --queue $nexthop --action correspond --url http://fqdn.in.example.com/&lt;br /&gt;
 mlmmj  unix  -       n       n       -       -       pipe flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop&lt;br /&gt;
* Add to &#039;&#039;/etc/postfix/main.cf&#039;&#039;:&lt;br /&gt;
 myhostname = mx1.example.com&lt;br /&gt;
 mydomain = mx1.example.com&lt;br /&gt;
 relay_domains = example.com&lt;br /&gt;
 recipient_delimiter = +&lt;br /&gt;
 transport_maps = hash:/etc/postfix/transport&lt;br /&gt;
* Create &#039;&#039;/etc/postfix/transport&#039;&#039; (and run &amp;quot;postmap transport&amp;quot; after editing):&lt;br /&gt;
 support@example.com        rt4:support&lt;br /&gt;
 support-list@example.com   mlmmj:support-list&lt;br /&gt;
 postmaster@example.com     local:&lt;br /&gt;
 example.com                error:No such mailbox.&lt;br /&gt;
* Edit &#039;&#039;/etc/postfix/aliases&#039;&#039; for the postmaster alias (and run &amp;quot;newaliases&amp;quot;)&lt;br /&gt;
* Allow users to create tickets by email by checking all General Rights for group Everyone in Tools -&amp;gt; Configuration -&amp;gt; Global -&amp;gt; Group Rights&lt;br /&gt;
&lt;br /&gt;
== Lighttpd configuration ==&lt;br /&gt;
&lt;br /&gt;
* Stop rt-server&lt;br /&gt;
* /etc/lightttpd/lighttpd.conf:&lt;br /&gt;
 include &amp;quot;rt4.conf&amp;quot;&lt;br /&gt;
* /etc/lighttpd/rt4.conf:&lt;br /&gt;
 server.modules += (&amp;quot;mod_fastcgi&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 $HTTP[&amp;quot;host&amp;quot;] == &amp;quot;fqdn.in.example.com&amp;quot; {&lt;br /&gt;
         server.document-root = &amp;quot;/usr/share/rt4/html&amp;quot;&lt;br /&gt;
         index.file-names = ( &amp;quot;index.html&amp;quot; ) &lt;br /&gt;
 &lt;br /&gt;
         fastcgi.server = ( &amp;quot;/&amp;quot; =&amp;gt;&lt;br /&gt;
              ((&lt;br /&gt;
                 &amp;quot;bin-path&amp;quot;      =&amp;gt; &amp;quot;/usr/sbin/rt-server.fcgi&amp;quot;,&lt;br /&gt;
                 &amp;quot;socket&amp;quot;        =&amp;gt; &amp;quot;/var/run/lighttpd/rt4.socket&amp;quot;,&lt;br /&gt;
                 &amp;quot;check-local&amp;quot;   =&amp;gt; &amp;quot;disable&amp;quot;,&lt;br /&gt;
                 &amp;quot;fix-root-scriptname&amp;quot; =&amp;gt; &amp;quot;enable&amp;quot;&lt;br /&gt;
               )),&lt;br /&gt;
           )&lt;br /&gt;
 }&lt;br /&gt;
* {{Cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
== Final RT4 configuration ==&lt;br /&gt;
&lt;br /&gt;
* Login to http://fqdn.in.example.com (your RT server)&lt;br /&gt;
** Add AdminCC for Support Users to support queue&lt;br /&gt;
** New template called &#039;Support Users Correspondence&#039; (anyone you add to Support Users group will have their outbound email rewritten to &#039;Support Team&#039; instead of their realname&lt;br /&gt;
 { &lt;br /&gt;
   my $output = undef;&lt;br /&gt;
   my $groups = $Transaction-&amp;gt;CreatorObj-&amp;gt;OwnGroups();&lt;br /&gt;
   while( my $group = $groups-&amp;gt;Next ) {&lt;br /&gt;
     my $queue = $Ticket-&amp;gt;QueueObj;&lt;br /&gt;
     my $realname = $queue-&amp;gt;Description;&lt;br /&gt;
     my $email = $queue-&amp;gt;CorrespondAddress || RT-&amp;gt;Config-&amp;gt;Get(&#039;CorrespondAddress&#039;);&lt;br /&gt;
     $output = &#039;From: &amp;quot;&#039; . $realname . &#039;&amp;quot; &amp;lt;&#039; . $email . &#039;&amp;gt;&#039; if $group-&amp;gt;Name eq &#039;Support Team&#039;;&lt;br /&gt;
   }&lt;br /&gt;
   $output;&lt;br /&gt;
 }&lt;br /&gt;
 RT-Attach-Message: yes &lt;br /&gt;
 &lt;br /&gt;
 {$Transaction-&amp;gt;Content()} &lt;br /&gt;
** Edit Resolved template and add the following to the end:&lt;br /&gt;
 {&lt;br /&gt;
  my $old_user = $Ticket-&amp;gt;CurrentUser;&lt;br /&gt;
  $Ticket-&amp;gt;CurrentUser( $RT::SystemUser );&lt;br /&gt;
  my $batch = $Ticket-&amp;gt;TransactionBatch;&lt;br /&gt;
  my $comment;&lt;br /&gt;
  if( !$batch || !ref($batch) ) {&lt;br /&gt;
    $RT::Logger-&amp;gt;info(&amp;quot;TransactionBatch stage is disabled,&lt;br /&gt;
                      fallback to last comment.&lt;br /&gt;
                      Turn on TransactionBatch stages for acurate results.&amp;quot;);&lt;br /&gt;
    my $transactions = $Ticket-&amp;gt;Transactions;&lt;br /&gt;
    $transactions-&amp;gt;Limit( FIELD =&amp;gt; &#039;Type&#039;, VALUE =&amp;gt; &#039;Comment&#039; );&lt;br /&gt;
    $transactions-&amp;gt;OrderByCols( { FIELD =&amp;gt; &#039;Created&#039;,&lt;br /&gt;
                                  ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                                  { FIELD =&amp;gt; &#039;id&#039;,&lt;br /&gt;
                                    ORDER =&amp;gt; &#039;DESC&#039; } );&lt;br /&gt;
    $transactions-&amp;gt;RowsPerPage(1);&lt;br /&gt;
    $comment = $transactions-&amp;gt;First;&lt;br /&gt;
  } else {&lt;br /&gt;
    $comment = (grep { ($_-&amp;gt;Type eq &#039;Comment&#039;)? 1: 0;} @$batch)[0];&lt;br /&gt;
  }&lt;br /&gt;
  $OUT = &amp;quot; &amp;quot;;&lt;br /&gt;
  if ( $comment ) {&lt;br /&gt;
    $OUT = &amp;quot;Resolution:\n&amp;quot;;&lt;br /&gt;
    $OUT .= (&amp;quot;-&amp;quot;x76) .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $OUT .= $comment-&amp;gt;Content;&lt;br /&gt;
  }&lt;br /&gt;
  $Ticket-&amp;gt;CurrentUser( $old_user );&lt;br /&gt;
 } &lt;br /&gt;
* Test that inbound and outbound emails, creating tickets by email and replying to ticket emails works as expected:&lt;br /&gt;
** Emails from end-users should be sent to support@example.com&lt;br /&gt;
** Those emails are either created as a new ticket in RT, or if the subject line contains a ticket ID, then it&#039;s inserted into the appropriate ticket&lt;br /&gt;
** Ticket comments and correspondence will be sent on to support-list@example.com, which is an mlmmj list, which can be subscribed to using support-list+subscribe@example.com&lt;br /&gt;
** The RT4 web interface is available at http://fqdn.in.example.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Mail]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
&lt;br /&gt;
== Upgrading RT ==&lt;br /&gt;
Upgrading the web interfaces should be easy as upgrading any Alpine package&lt;br /&gt;
{{Cmd|apk add -u rt4}}&lt;br /&gt;
Now upgrade the database:&lt;br /&gt;
{{Cmd|rt-setup-database --dba postgres --datadir /etc/rt4/upgrade --action upgrade}}&lt;br /&gt;
Answers to the questions asked.&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10474</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10474"/>
		<updated>2015-02-09T13:02:35Z</updated>

		<summary type="html">&lt;p&gt;Larena: sqlite installation is good&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10473</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10473"/>
		<updated>2015-02-09T12:42:56Z</updated>

		<summary type="html">&lt;p&gt;Larena: install php-cgi with lighty&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd php-cgi}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10342</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10342"/>
		<updated>2015-01-23T08:37:05Z</updated>

		<summary type="html">&lt;p&gt;Larena: Add run-from-RAM settings and note about php-fpm children&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running-from-RAM and you&#039;re dealing with large files you might need to move the FastCGI temp file from /tmp to /var/tmp or to a directory that is mounted on hdd&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_temp_path /var/tmp/nginx/fastcgi 1 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are serving serveral users make sure to tune the *&#039;&#039;children&#039;&#039; settings in /etc/php/php-fpm.conf}}&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=10151</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=10151"/>
		<updated>2014-09-17T07:08:28Z</updated>

		<summary type="html">&lt;p&gt;Larena: Add port-forwarding to a different port&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall ({{pkg|AWall}}) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain {{pkg|AWall}} from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{pkg|AWall}} is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax.&lt;br /&gt;
&lt;br /&gt;
Some of the below features and examples assumes that you are running {{pkg|AWall}} version 0.2.12 or later.&amp;lt;BR&amp;gt;&lt;br /&gt;
Make sure you are running latest version by running the following commands:&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk add -u awall&lt;br /&gt;
apk version awall}}&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your {{pkg|AWall}} firewall configuration file(s) goes to {{Path|/etc/awall/optional}}&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{note| {{pkg|AWall}} versions prior 0.2.12 will only look for &#039;&#039;Policy&#039;&#039; files in {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;From version 0.2.12 and higher, {{pkg|AWall}} will look for &#039;&#039;Policy&#039;&#039; files in both {{Path|/etc/awall/optional}} and {{Path|/usr/share/awall/optional}}}}&lt;br /&gt;
You may have multiple &#039;&#039;Policy&#039;&#039; files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|{{pkg|AWall}}&#039;s &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
An {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing {{pkg|AWall}}, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after {{pkg|AWall}} installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to {{pkg|AWall}}.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure {{pkg|AWall}} to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/etc/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/etc/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| {{pkg|AWall}} has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/etc/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/etc/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
{{pkg|AWall}} will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository ({{pkg|AWall}} v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|{{pkg|AWall}} already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
If you need to forward to a different port (e.g. 8080) you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;dnat&amp;quot;: [&lt;br /&gt;
  {&amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &amp;quot;to-addr&amp;quot;: &amp;quot;$APACHE&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &amp;quot;to-port&amp;quot;: 8080 }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10133</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10133"/>
		<updated>2014-08-16T21:26:22Z</updated>

		<summary type="html">&lt;p&gt;Larena: update on Alpine version supported&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, firewall, etc.).  [[Small Office Services]] offers additional services such as DHCP for clients, http proxying, and a basic SIP telephone system.&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
;NBMA: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
;Hub: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
;Spoke: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 3.0 has also a Musl issue in getprotobyname(). Alpine 2.7.x has been thoroughly tested and 3.0.3 hasn&#039;t shown any issue so far.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine enable its modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Boot Alpine USB == &lt;br /&gt;
Follow the instructions on  http://wiki.alpinelinux.org/wiki/Create_a_Bootable_USB about how to create a bootable USB.&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;Interface&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Subnet&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|bond0.3&lt;br /&gt;
|Management&lt;br /&gt;
|10.1.0.129/26&lt;br /&gt;
|-&lt;br /&gt;
|bond0.101&lt;br /&gt;
|LAN&lt;br /&gt;
|10.1.0.0/25&lt;br /&gt;
|-&lt;br /&gt;
|bond0.256&lt;br /&gt;
|Internet from ISP1&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.257&lt;br /&gt;
|Internet from ISP2&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.620&lt;br /&gt;
|Transit between wifi proxy and dmvpn spoke node&lt;br /&gt;
|10.1.0.252/30&lt;br /&gt;
|-&lt;br /&gt;
|bond0.701&lt;br /&gt;
|WiFi clients (no access to DMVPN network)&lt;br /&gt;
|172.17.48.0/24&lt;br /&gt;
|-&lt;br /&gt;
|bond0.1101&lt;br /&gt;
|Voice&lt;br /&gt;
|10.2.0.0/24&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|setup-alpine}}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.101&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.101? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.101 configuration for bond0.620, bond0.701, bond0.1101, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
Update the networking configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add interfaces:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
auto bond0.101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.1.0.1&lt;br /&gt;
        netmask 255.255.255.192&lt;br /&gt;
&lt;br /&gt;
auto bond0.620&lt;br /&gt;
iface bond0.620 inet static&lt;br /&gt;
        address 10.1.0.253&lt;br /&gt;
        netmask 255.255.255.252&lt;br /&gt;
&lt;br /&gt;
auto bond0.701&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 172.17.48.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.1101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.2.0.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.256&lt;br /&gt;
iface bond0.256 inet static&lt;br /&gt;
        address &amp;lt;%ISP1_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP1_NETMASK%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
auto bond0.257&lt;br /&gt;
iface bond0.257 inet static&lt;br /&gt;
        address &amp;lt;%ISP2_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP2_NETMASK%&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add &amp;lt;code&amp;gt;bond-mode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bond-miimon&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond-updelay&amp;lt;/code&amp;gt; parameters to the &amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt; stanza:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto bond0&lt;br /&gt;
iface bond0 inet manual&lt;br /&gt;
     bond-slaves eth0 eth1&lt;br /&gt;
     bond-mode balance-tlb&lt;br /&gt;
     bond-miimon 100&lt;br /&gt;
     bond-updelay 500&lt;br /&gt;
     ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new bonding settings:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifdown bond0&lt;br /&gt;
ifup bond0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
Restart ssh:&lt;br /&gt;
{{Cmd|/etc/init.d/sshd restart}}&lt;br /&gt;
&lt;br /&gt;
== NTP server ==&lt;br /&gt;
In order to have attached devices syncing their time agains this host, we need to do some modifications to chrony config.&amp;lt;BR&amp;gt;&lt;br /&gt;
Add &#039;&amp;lt;code&amp;gt;allow all&amp;lt;/code&amp;gt;&#039; to the end of the &#039;&amp;lt;code&amp;gt;/etc/chrony/chrony.conf&amp;lt;/code&amp;gt;&#039; so the file looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/chrony/chrony.conf|&lt;br /&gt;
server pool.ntp.org &lt;br /&gt;
initstepslew 10 pool.ntp.org&lt;br /&gt;
commandkey 10&lt;br /&gt;
keyfile /etc/chrony/chrony.keys&lt;br /&gt;
driftfile /etc/chrony/chrony.drift&lt;br /&gt;
allow all&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Restart chronyd for the changes to take effect&lt;br /&gt;
 {{cmd|/etc/init.d/chronyd restart}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/unbound/unbound.conf|&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start unbound and start using unbound on this host:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
auto gre1&lt;br /&gt;
iface gre1 inet static&lt;br /&gt;
      pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
      address 172.16.1.1&lt;br /&gt;
      netmask 255.255.0.0&lt;br /&gt;
      post-down ip tunnel del $IFACE || true&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new &amp;lt;code&amp;gt;gre1&amp;lt;/code&amp;gt; interface:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/ipsec.conf|&lt;br /&gt;
spdflush;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create missing directory:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into &amp;lt;code&amp;gt;/etc/racoon&amp;lt;/code&amp;gt;, using the filenames &#039;&#039;&#039;&amp;lt;code&amp;gt;ca.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;code&amp;gt;cert.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, and &#039;&#039;&#039;&amp;lt;code&amp;gt;key.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039; (see [[Dynamic_Multipoint_VPN_%28DMVPN%29#Extract_Certificates|instructions above]] for command).&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/racoon/racoon.conf|&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/racoon&amp;lt;/code&amp;gt; and unset &amp;lt;code&amp;gt;RACOON_PSK_FILE&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/conf.d/racoon|&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE{{=}}&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.620&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;&amp;lt;code&amp;gt;hub.example.com&amp;lt;/code&amp;gt;&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make it executable and start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and &amp;lt;code&amp;gt;%HUB_GRE_IP%&amp;lt;/code&amp;gt; with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
* Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Configure openvpn:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/openvpn/openvpn.conf|&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/params.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot;: &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot;: &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;DE_IF&amp;quot;: &amp;quot;bond0.620&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot;: &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot;: &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/internet-host.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/openvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/clampmss.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/mark.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/dmvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/vpnc.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;DE&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$DE_IF&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;DE&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;DE&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ping&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Activate the firewall:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate -f&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond0.257&amp;lt;/code&amp;gt; interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/pingu.conf|&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/route-rules|&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
Commit configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following &amp;quot;up&amp;quot; commands:&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto gre1&lt;br /&gt;
...&lt;br /&gt;
     up ip rule add lookup nhrp_shortcut pref 11000&lt;br /&gt;
     up ip rule add lookup quagga pref 11001&lt;br /&gt;
     up ip rule add lookup nhrp_mtu pref 11999&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
{{Todo|...}}&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10132</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10132"/>
		<updated>2014-08-16T21:20:14Z</updated>

		<summary type="html">&lt;p&gt;Larena: formatting fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, firewall, etc.).  [[Small Office Services]] offers additional services such as DHCP for clients, http proxying, and a basic SIP telephone system.&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
;NBMA: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
;Hub: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
;Spoke: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 2.6.1 or later should be okay instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine enable its modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Boot Alpine USB == &lt;br /&gt;
Follow the instructions on  http://wiki.alpinelinux.org/wiki/Create_a_Bootable_USB about how to create a bootable USB.&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;Interface&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Subnet&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|bond0.3&lt;br /&gt;
|Management&lt;br /&gt;
|10.1.0.129/26&lt;br /&gt;
|-&lt;br /&gt;
|bond0.101&lt;br /&gt;
|LAN&lt;br /&gt;
|10.1.0.0/25&lt;br /&gt;
|-&lt;br /&gt;
|bond0.256&lt;br /&gt;
|Internet from ISP1&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.257&lt;br /&gt;
|Internet from ISP2&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.620&lt;br /&gt;
|Transit between wifi proxy and dmvpn spoke node&lt;br /&gt;
|10.1.0.252/30&lt;br /&gt;
|-&lt;br /&gt;
|bond0.701&lt;br /&gt;
|WiFi clients (no access to DMVPN network)&lt;br /&gt;
|172.17.48.0/24&lt;br /&gt;
|-&lt;br /&gt;
|bond0.1101&lt;br /&gt;
|Voice&lt;br /&gt;
|10.2.0.0/24&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|setup-alpine}}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.101&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.101? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.101 configuration for bond0.620, bond0.701, bond0.1101, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
Update the networking configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add interfaces:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
auto bond0.101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.1.0.1&lt;br /&gt;
        netmask 255.255.255.192&lt;br /&gt;
&lt;br /&gt;
auto bond0.620&lt;br /&gt;
iface bond0.620 inet static&lt;br /&gt;
        address 10.1.0.253&lt;br /&gt;
        netmask 255.255.255.252&lt;br /&gt;
&lt;br /&gt;
auto bond0.701&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 172.17.48.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.1101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.2.0.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.256&lt;br /&gt;
iface bond0.256 inet static&lt;br /&gt;
        address &amp;lt;%ISP1_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP1_NETMASK%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
auto bond0.257&lt;br /&gt;
iface bond0.257 inet static&lt;br /&gt;
        address &amp;lt;%ISP2_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP2_NETMASK%&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add &amp;lt;code&amp;gt;bond-mode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bond-miimon&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond-updelay&amp;lt;/code&amp;gt; parameters to the &amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt; stanza:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto bond0&lt;br /&gt;
iface bond0 inet manual&lt;br /&gt;
     bond-slaves eth0 eth1&lt;br /&gt;
     bond-mode balance-tlb&lt;br /&gt;
     bond-miimon 100&lt;br /&gt;
     bond-updelay 500&lt;br /&gt;
     ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new bonding settings:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifdown bond0&lt;br /&gt;
ifup bond0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
Restart ssh:&lt;br /&gt;
{{Cmd|/etc/init.d/sshd restart}}&lt;br /&gt;
&lt;br /&gt;
== NTP server ==&lt;br /&gt;
In order to have attached devices syncing their time agains this host, we need to do some modifications to chrony config.&amp;lt;BR&amp;gt;&lt;br /&gt;
Add &#039;&amp;lt;code&amp;gt;allow all&amp;lt;/code&amp;gt;&#039; to the end of the &#039;&amp;lt;code&amp;gt;/etc/chrony/chrony.conf&amp;lt;/code&amp;gt;&#039; so the file looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/chrony/chrony.conf|&lt;br /&gt;
server pool.ntp.org &lt;br /&gt;
initstepslew 10 pool.ntp.org&lt;br /&gt;
commandkey 10&lt;br /&gt;
keyfile /etc/chrony/chrony.keys&lt;br /&gt;
driftfile /etc/chrony/chrony.drift&lt;br /&gt;
allow all&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Restart chronyd for the changes to take effect&lt;br /&gt;
 {{cmd|/etc/init.d/chronyd restart}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/unbound/unbound.conf|&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start unbound and start using unbound on this host:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
auto gre1&lt;br /&gt;
iface gre1 inet static&lt;br /&gt;
      pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
      address 172.16.1.1&lt;br /&gt;
      netmask 255.255.0.0&lt;br /&gt;
      post-down ip tunnel del $IFACE || true&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new &amp;lt;code&amp;gt;gre1&amp;lt;/code&amp;gt; interface:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/ipsec.conf|&lt;br /&gt;
spdflush;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create missing directory:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into &amp;lt;code&amp;gt;/etc/racoon&amp;lt;/code&amp;gt;, using the filenames &#039;&#039;&#039;&amp;lt;code&amp;gt;ca.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;code&amp;gt;cert.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, and &#039;&#039;&#039;&amp;lt;code&amp;gt;key.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039; (see [[Dynamic_Multipoint_VPN_%28DMVPN%29#Extract_Certificates|instructions above]] for command).&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/racoon/racoon.conf|&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/racoon&amp;lt;/code&amp;gt; and unset &amp;lt;code&amp;gt;RACOON_PSK_FILE&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/conf.d/racoon|&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE{{=}}&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.620&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;&amp;lt;code&amp;gt;hub.example.com&amp;lt;/code&amp;gt;&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make it executable and start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and &amp;lt;code&amp;gt;%HUB_GRE_IP%&amp;lt;/code&amp;gt; with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
* Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Configure openvpn:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/openvpn/openvpn.conf|&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/params.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot;: &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot;: &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;DE_IF&amp;quot;: &amp;quot;bond0.620&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot;: &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot;: &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/internet-host.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/openvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/clampmss.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/mark.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/dmvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/vpnc.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;DE&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$DE_IF&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;DE&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;DE&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ping&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Activate the firewall:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate -f&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond0.257&amp;lt;/code&amp;gt; interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/pingu.conf|&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/route-rules|&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
Commit configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following &amp;quot;up&amp;quot; commands:&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto gre1&lt;br /&gt;
...&lt;br /&gt;
     up ip rule add lookup nhrp_shortcut pref 11000&lt;br /&gt;
     up ip rule add lookup quagga pref 11001&lt;br /&gt;
     up ip rule add lookup nhrp_mtu pref 11999&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
{{Todo|...}}&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10131</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10131"/>
		<updated>2014-08-16T21:18:17Z</updated>

		<summary type="html">&lt;p&gt;Larena: add ip rules for routing tables&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, firewall, etc.).  [[Small Office Services]] offers additional services such as DHCP for clients, http proxying, and a basic SIP telephone system.&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
;NBMA: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
;Hub: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
;Spoke: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 2.6.1 or later should be okay instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine enable its modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Boot Alpine USB == &lt;br /&gt;
Follow the instructions on  http://wiki.alpinelinux.org/wiki/Create_a_Bootable_USB about how to create a bootable USB.&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;Interface&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Subnet&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|bond0.3&lt;br /&gt;
|Management&lt;br /&gt;
|10.1.0.129/26&lt;br /&gt;
|-&lt;br /&gt;
|bond0.101&lt;br /&gt;
|LAN&lt;br /&gt;
|10.1.0.0/25&lt;br /&gt;
|-&lt;br /&gt;
|bond0.256&lt;br /&gt;
|Internet from ISP1&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.257&lt;br /&gt;
|Internet from ISP2&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.620&lt;br /&gt;
|Transit between wifi proxy and dmvpn spoke node&lt;br /&gt;
|10.1.0.252/30&lt;br /&gt;
|-&lt;br /&gt;
|bond0.701&lt;br /&gt;
|WiFi clients (no access to DMVPN network)&lt;br /&gt;
|172.17.48.0/24&lt;br /&gt;
|-&lt;br /&gt;
|bond0.1101&lt;br /&gt;
|Voice&lt;br /&gt;
|10.2.0.0/24&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|setup-alpine}}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.101&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.101? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.101 configuration for bond0.620, bond0.701, bond0.1101, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
Update the networking configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add interfaces:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
auto bond0.101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.1.0.1&lt;br /&gt;
        netmask 255.255.255.192&lt;br /&gt;
&lt;br /&gt;
auto bond0.620&lt;br /&gt;
iface bond0.620 inet static&lt;br /&gt;
        address 10.1.0.253&lt;br /&gt;
        netmask 255.255.255.252&lt;br /&gt;
&lt;br /&gt;
auto bond0.701&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 172.17.48.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.1101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.2.0.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.256&lt;br /&gt;
iface bond0.256 inet static&lt;br /&gt;
        address &amp;lt;%ISP1_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP1_NETMASK%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
auto bond0.257&lt;br /&gt;
iface bond0.257 inet static&lt;br /&gt;
        address &amp;lt;%ISP2_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP2_NETMASK%&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add &amp;lt;code&amp;gt;bond-mode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bond-miimon&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond-updelay&amp;lt;/code&amp;gt; parameters to the &amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt; stanza:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto bond0&lt;br /&gt;
iface bond0 inet manual&lt;br /&gt;
     bond-slaves eth0 eth1&lt;br /&gt;
     bond-mode balance-tlb&lt;br /&gt;
     bond-miimon 100&lt;br /&gt;
     bond-updelay 500&lt;br /&gt;
     ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new bonding settings:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifdown bond0&lt;br /&gt;
ifup bond0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
Restart ssh:&lt;br /&gt;
{{Cmd|/etc/init.d/sshd restart}}&lt;br /&gt;
&lt;br /&gt;
== NTP server ==&lt;br /&gt;
In order to have attached devices syncing their time agains this host, we need to do some modifications to chrony config.&amp;lt;BR&amp;gt;&lt;br /&gt;
Add &#039;&amp;lt;code&amp;gt;allow all&amp;lt;/code&amp;gt;&#039; to the end of the &#039;&amp;lt;code&amp;gt;/etc/chrony/chrony.conf&amp;lt;/code&amp;gt;&#039; so the file looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/chrony/chrony.conf|&lt;br /&gt;
server pool.ntp.org &lt;br /&gt;
initstepslew 10 pool.ntp.org&lt;br /&gt;
commandkey 10&lt;br /&gt;
keyfile /etc/chrony/chrony.keys&lt;br /&gt;
driftfile /etc/chrony/chrony.drift&lt;br /&gt;
allow all&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Restart chronyd for the changes to take effect&lt;br /&gt;
 {{cmd|/etc/init.d/chronyd restart}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/unbound/unbound.conf|&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start unbound and start using unbound on this host:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
auto gre1&lt;br /&gt;
iface gre1 inet static&lt;br /&gt;
      pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
      address 172.16.1.1&lt;br /&gt;
      netmask 255.255.0.0&lt;br /&gt;
      post-down ip tunnel del $IFACE || true&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new &amp;lt;code&amp;gt;gre1&amp;lt;/code&amp;gt; interface:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/ipsec.conf|&lt;br /&gt;
spdflush;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create missing directory:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into &amp;lt;code&amp;gt;/etc/racoon&amp;lt;/code&amp;gt;, using the filenames &#039;&#039;&#039;&amp;lt;code&amp;gt;ca.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;code&amp;gt;cert.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, and &#039;&#039;&#039;&amp;lt;code&amp;gt;key.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039; (see [[Dynamic_Multipoint_VPN_%28DMVPN%29#Extract_Certificates|instructions above]] for command).&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/racoon/racoon.conf|&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/racoon&amp;lt;/code&amp;gt; and unset &amp;lt;code&amp;gt;RACOON_PSK_FILE&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/conf.d/racoon|&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE{{=}}&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.620&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;&amp;lt;code&amp;gt;hub.example.com&amp;lt;/code&amp;gt;&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make it executable and start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and &amp;lt;code&amp;gt;%HUB_GRE_IP%&amp;lt;/code&amp;gt; with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
* Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Configure openvpn:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/openvpn/openvpn.conf|&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/params.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot;: &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot;: &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;DE_IF&amp;quot;: &amp;quot;bond0.620&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot;: &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot;: &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/internet-host.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/openvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/clampmss.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/mark.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/dmvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/vpnc.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;DE&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$DE_IF&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;DE&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;DE&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ping&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Activate the firewall:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate -f&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond0.257&amp;lt;/code&amp;gt; interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/pingu.conf|&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/route-rules|&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
Commit configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following commands into /etc/network/interfaces:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto gre1&lt;br /&gt;
...&lt;br /&gt;
     up ip rule add lookup nhrp_shortcut pref 11000&lt;br /&gt;
     up ip rule add lookup quagga pref 11001&lt;br /&gt;
     up ip rule add lookup nhrp_mtu pref 11999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
{{Todo|...}}&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10122</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10122"/>
		<updated>2014-08-05T20:10:18Z</updated>

		<summary type="html">&lt;p&gt;Larena: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10121</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10121"/>
		<updated>2014-08-05T20:07:43Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Publish owncloud */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== Publish owncloud (Lighttpd only) ===&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10120</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10120"/>
		<updated>2014-08-05T20:06:54Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Configure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== Publish owncloud ===&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://mysite.mydomain.com&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10119</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10119"/>
		<updated>2014-08-05T20:06:00Z</updated>

		<summary type="html">&lt;p&gt;Larena: /* Additional packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== Publish owncloud ===&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor, documents and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-documents owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10118</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10118"/>
		<updated>2014-08-05T20:04:46Z</updated>

		<summary type="html">&lt;p&gt;Larena: add nginx setup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|nginx}} or {{pkg|lighttpd}}. &#039;&#039;Nginx&#039;&#039; is preferred over &#039;&#039;Lighttpd&#039;&#039; since the latter when working with large files will consume a lot of memory (see [http://redmine.lighttpd.net/issues/1283 lighty bug #1283]). You are free to install any other webserver of your choice as long as it supports PHP and FastCGI. We&#039;re not explaining how to generate an SSL certificate for your webserver.&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
Install the needed packages&lt;br /&gt;
{{cmd|apk add nginx php-fpm}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remove/comment&#039;&#039;&#039; any section like this in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
server {&lt;br /&gt;
        listen ...&lt;br /&gt;
       }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Include the following directive in&lt;br /&gt;
{{cat|/etc/nginx/nginx.conf|&lt;br /&gt;
http {&lt;br /&gt;
      ...&lt;br /&gt;
      include /etc/nginx/sites-enabled/*;&lt;br /&gt;
      ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for your websites&lt;br /&gt;
{{cmd|mkdir /etc/nginx/sites-available}}&lt;br /&gt;
&lt;br /&gt;
Create a configuration file for your site in /etc/nginx/sites-available/mysite.mydomain.com&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:80; #uncomment for IPv6 support&lt;br /&gt;
        listen       80;&lt;br /&gt;
	return 301 https://$host$request_uri;&lt;br /&gt;
	server_name mysite.mydomain.com;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
        #listen       [::]:443 ssl; #uncomment for IPv6 support&lt;br /&gt;
        listen       443 ssl;&lt;br /&gt;
        server_name  mysite.mydomain.com;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/vhosts/mysite.mydomain.com/www;&lt;br /&gt;
        index  index.php index.html index.htm;&lt;br /&gt;
	disable_symlinks off;&lt;br /&gt;
&lt;br /&gt;
        ssl_certificate      /etc/ssl/cert.pem;&lt;br /&gt;
        ssl_certificate_key  /etc/ssl/key.pem;&lt;br /&gt;
&lt;br /&gt;
        ssl_session_cache    shared:SSL:1m;&lt;br /&gt;
        ssl_session_timeout  5m;&lt;br /&gt;
&lt;br /&gt;
        #Enable Perfect Forward Secrecy and ciphers without known vulnerabilities&lt;br /&gt;
        #Beware! It breaks compatibility with older OS and browsers (e.g. Windows XP, Android 2.x, etc.)&lt;br /&gt;
	#ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA;&lt;br /&gt;
        #ssl_prefer_server_ciphers  on;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
            try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;br /&gt;
        location ~ [^/]\.php(/|$) {&lt;br /&gt;
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;br /&gt;
                if (!-f $document_root$fastcgi_script_name) {&lt;br /&gt;
                        return 404;&lt;br /&gt;
                }&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
		#fastcgi_pass unix:/var/run/php-fpm/socket;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi.conf;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set user and group for php-fpm in /etc/php/php-fpm.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
user = nginx&lt;br /&gt;
group = www-data&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make nginx user member of www-data group&lt;br /&gt;
{{cmd|addgroup nginx www-data}}&lt;br /&gt;
&lt;br /&gt;
Enable your website&lt;br /&gt;
{{cmd|ln -s ../sites-available/mysite.mydomain.com /etc/nginx/sites-enabled/mysite.mydomain.com}}&lt;br /&gt;
&lt;br /&gt;
Start services&lt;br /&gt;
{{cmd|rc-service php-fpm start&lt;br /&gt;
rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== Publish owncloud ===&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Owncloud&amp;diff=10117</id>
		<title>Owncloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Owncloud&amp;diff=10117"/>
		<updated>2014-08-05T19:09:08Z</updated>

		<summary type="html">&lt;p&gt;Larena: deprecated info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[OwnCloud]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10113</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=10113"/>
		<updated>2014-07-30T17:12:18Z</updated>

		<summary type="html">&lt;p&gt;Larena: remove folder permission section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;&amp;lt;br&amp;gt;&#039;&#039;(Seems to work OK 2013-05-27)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|lighttpd}} but you are free to install any other webserver of your choise as long as it supports php and FastCGI.&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== Publish owncloud ===&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10109</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=10109"/>
		<updated>2014-07-26T15:30:08Z</updated>

		<summary type="html">&lt;p&gt;Larena: fix route tables creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, firewall, etc.).  [[Small Office Services]] offers additional services such as DHCP for clients, http proxying, and a basic SIP telephone system.&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
;NBMA: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
;Hub: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
;Spoke: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 2.6.1 or later should be okay instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine enable its modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Boot Alpine USB == &lt;br /&gt;
Follow the instructions on  http://wiki.alpinelinux.org/wiki/Create_a_Bootable_USB about how to create a bootable USB.&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;Interface&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Subnet&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|bond0.3&lt;br /&gt;
|Management&lt;br /&gt;
|10.1.0.129/26&lt;br /&gt;
|-&lt;br /&gt;
|bond0.101&lt;br /&gt;
|LAN&lt;br /&gt;
|10.1.0.0/25&lt;br /&gt;
|-&lt;br /&gt;
|bond0.256&lt;br /&gt;
|Internet from ISP1&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.257&lt;br /&gt;
|Internet from ISP2&lt;br /&gt;
|Allocated from ISP&lt;br /&gt;
|-&lt;br /&gt;
|bond0.620&lt;br /&gt;
|Transit between wifi proxy and dmvpn spoke node&lt;br /&gt;
|10.1.0.252/30&lt;br /&gt;
|-&lt;br /&gt;
|bond0.701&lt;br /&gt;
|WiFi clients (no access to DMVPN network)&lt;br /&gt;
|172.17.48.0/24&lt;br /&gt;
|-&lt;br /&gt;
|bond0.1101&lt;br /&gt;
|Voice&lt;br /&gt;
|10.2.0.0/24&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|setup-alpine}}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.101&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.101? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.101 configuration for bond0.620, bond0.701, bond0.1101, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
Update the networking configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add interfaces:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
auto bond0.101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.1.0.1&lt;br /&gt;
        netmask 255.255.255.192&lt;br /&gt;
&lt;br /&gt;
auto bond0.620&lt;br /&gt;
iface bond0.620 inet static&lt;br /&gt;
        address 10.1.0.253&lt;br /&gt;
        netmask 255.255.255.252&lt;br /&gt;
&lt;br /&gt;
auto bond0.701&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 172.17.48.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.1101&lt;br /&gt;
iface bond0.101 inet static&lt;br /&gt;
        address 10.2.0.1&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
auto bond0.256&lt;br /&gt;
iface bond0.256 inet static&lt;br /&gt;
        address &amp;lt;%ISP1_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP1_NETMASK%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
auto bond0.257&lt;br /&gt;
iface bond0.257 inet static&lt;br /&gt;
        address &amp;lt;%ISP2_IP_ADDRESS%&amp;gt;&lt;br /&gt;
        netmask &amp;lt;%ISP2_NETMASK%&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add &amp;lt;code&amp;gt;bond-mode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bond-miimon&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond-updelay&amp;lt;/code&amp;gt; parameters to the &amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt; stanza:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto bond0&lt;br /&gt;
iface bond0 inet manual&lt;br /&gt;
     bond-slaves eth0 eth1&lt;br /&gt;
     bond-mode balance-tlb&lt;br /&gt;
     bond-miimon 100&lt;br /&gt;
     bond-updelay 500&lt;br /&gt;
     ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new bonding settings:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifdown bond0&lt;br /&gt;
ifup bond0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
Restart ssh:&lt;br /&gt;
{{Cmd|/etc/init.d/sshd restart}}&lt;br /&gt;
&lt;br /&gt;
== NTP server ==&lt;br /&gt;
In order to have attached devices syncing their time agains this host, we need to do some modifications to chrony config.&amp;lt;BR&amp;gt;&lt;br /&gt;
Add &#039;&amp;lt;code&amp;gt;allow all&amp;lt;/code&amp;gt;&#039; to the end of the &#039;&amp;lt;code&amp;gt;/etc/chrony/chrony.conf&amp;lt;/code&amp;gt;&#039; so the file looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/chrony/chrony.conf|&lt;br /&gt;
server pool.ntp.org &lt;br /&gt;
initstepslew 10 pool.ntp.org&lt;br /&gt;
commandkey 10&lt;br /&gt;
keyfile /etc/chrony/chrony.keys&lt;br /&gt;
driftfile /etc/chrony/chrony.drift&lt;br /&gt;
allow all&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Restart chronyd for the changes to take effect&lt;br /&gt;
 {{cmd|/etc/init.d/chronyd restart}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/unbound/unbound.conf|&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start unbound and start using unbound on this host:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
auto gre1&lt;br /&gt;
iface gre1 inet static&lt;br /&gt;
      pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
      address 172.16.1.1&lt;br /&gt;
      netmask 255.255.0.0&lt;br /&gt;
      post-down ip tunnel del $IFACE || true&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new &amp;lt;code&amp;gt;gre1&amp;lt;/code&amp;gt; interface:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/ipsec.conf|&lt;br /&gt;
spdflush;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create missing directory:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into &amp;lt;code&amp;gt;/etc/racoon&amp;lt;/code&amp;gt;, using the filenames &#039;&#039;&#039;&amp;lt;code&amp;gt;ca.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;code&amp;gt;cert.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, and &#039;&#039;&#039;&amp;lt;code&amp;gt;key.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039; (see [[Dynamic_Multipoint_VPN_%28DMVPN%29#Extract_Certificates|instructions above]] for command).&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/racoon/racoon.conf|&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/racoon&amp;lt;/code&amp;gt; and unset &amp;lt;code&amp;gt;RACOON_PSK_FILE&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/conf.d/racoon|&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE{{=}}&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.620&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;&amp;lt;code&amp;gt;hub.example.com&amp;lt;/code&amp;gt;&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make it executable and start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and &amp;lt;code&amp;gt;%HUB_GRE_IP%&amp;lt;/code&amp;gt; with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
* Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Configure openvpn:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/openvpn/openvpn.conf|&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/params.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot;: &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot;: &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;DE_IF&amp;quot;: &amp;quot;bond0.620&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot;: &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot;: &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/internet-host.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/openvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/clampmss.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/mark.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/dmvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/vpnc.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;DE&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$DE_IF&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;DE&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;DE&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ping&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Activate the firewall:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate -f&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond0.257&amp;lt;/code&amp;gt; interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/pingu.conf|&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/route-rules|&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
Commit configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
{{Cmd|echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n}} &amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
{{Todo|...}}&lt;/div&gt;</summary>
		<author><name>Larena</name></author>
	</entry>
</feed>