Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
prosody [05.12.2015 21:44] – angelegt havelock | prosody [25.12.2015 11:13] (aktuell) – [Konfiguration] x1lent | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | Prosody | + | ====== |
- | | + | * Installation auf ffpi-services |
- | | + | * Ist unter xmpp.ffpi oder xmpp.pinneberg.freifunk.net erreichbar |
- | Warum Prosody? | + | ===== Warum Prosody? |
- | Sicher fragt man sich warum wir kein ejabberd nutzen. Dies ist schlicht und ergreifend eigenen Präferenz. Ich persöhnlich | + | Sicher fragt man sich warum wir kein ejabberd nutzen. Dies ist schlicht und ergreifend eigenen Präferenz. Ich persönlich |
- | Installation | + | |
+ | ===== Installation | ||
Vorausgesetzt wird ein Debian Jessie 8.1 System. | Vorausgesetzt wird ein Debian Jessie 8.1 System. | ||
Zeile 13: | Zeile 14: | ||
Als erstes muss die Paketquelle von Prosody hinzugefügt werden: | Als erstes muss die Paketquelle von Prosody hinzugefügt werden: | ||
+ | < | ||
echo "deb http:// | echo "deb http:// | ||
wget https:// | wget https:// | ||
apt-get update | apt-get update | ||
+ | </ | ||
Nachdem dies erledigt wurde wird prosody an sich installiert: | Nachdem dies erledigt wurde wird prosody an sich installiert: | ||
+ | < | ||
apt-get update | apt-get update | ||
- | apt-get install prosody lua-sec | + | apt-get install prosody lua-sec |
+ | </ | ||
- | Sollte die Version von lua-sec aus dem offiziellen Package Repos < 5.0 sein solltet ihr anstatt | + | Sollte die Version von lua-sec aus dem offiziellen Package Repos < 5.0 sein solltet ihr anstelle |
- | Modifikation | + | |
- | Da es nur Clients aus dem FFPI Netz erlaubt werden soll einen Account beim XMPP Server zu erstellen muss die mod_register.lua modifiziert werden, da prosody das nicht von Haus aus unterstützt. Weiterhin wollen wir, dass der XMPP Server bei der Registration für mehrere VirtualHosts einen Account erstellt. | + | ===== Modifikation ===== |
- | / | + | Da es nur Clients aus dem FFPI Netz erlaubt werden soll einen Account beim XMPP Server zu erstellen und dieser Account weiterhin auf beiden Hosts (xmpp.ffpi und xmpp.pinneberg.freifunk.net) registriert werden muss benutzen wir mod_register_web in einer modifizierten Version. |
- | [...] | + | < |
- | local blacklisted_ips = module: | + | cd / |
- | local whitelist_ip_starts_with = module: | + | apt-get install git |
- | local register_hosts = module: | + | git clone https://github.com/ |
- | --IP Check for FFPI -- | + | </ |
- | function checkIP(ipadress, | + | ===== Konfiguration ===== |
- | for i, ipstart in ipairs(whitelist_start) do | + | |
- | if string.sub(ipadress, | + | |
- | return true | + | |
- | end | + | |
- | | + | |
- | | + | |
- | end | + | |
- | + | ||
- | [...] | + | |
- | + | ||
- | elseif blacklisted_ips[session.ip] or (whitelist_only and not whitelisted_ips[session.ip]) then | + | |
- | | + | |
- | if (whitelist_only and not checkIP(session.ip, | + | |
- | session.send(st.error_reply(stanza, | + | |
- | | + | |
- | end | + | |
- | [...] | + | |
- | + | ||
- | else | + | |
- | -- TODO unable to write file, file may be locked, etc, what's the correct error? | + | |
- | local error_reply | + | |
- | + | ||
- | for i, reg_host in ipairs(register_hosts) do | + | |
- | module: | + | |
- | if usermanager_create_user(username, | + | |
- | if next(data) and not account_details: | + | |
- | usermanager_delete_user(username, | + | |
- | session.send(error_reply); | + | |
- | return true; | + | |
- | end | + | |
- | session.send(st.reply(stanza)); | + | |
- | module: | + | |
- | module: | + | |
- | username | + | |
- | session | + | |
- | else | + | |
- | session.send(error_reply); | + | |
- | end | + | |
- | end | + | |
- | [...] | + | |
- | Konfiguration | ||
Als erstes wird der DH-Schlüssel für FS (Forward Secrecy) generiert: | Als erstes wird der DH-Schlüssel für FS (Forward Secrecy) generiert: | ||
+ | < | ||
openssl dhparam -out / | openssl dhparam -out / | ||
+ | </ | ||
+ | Dies kann einige Zeit dauern. In der Zwischenzeit erstellen wir daher einen User und eine Datenbank für prosody: | ||
- | Dies kann einige Zeit dauern. Also in der Zwischenzeit einen Kaffee machen. | + | < |
+ | mysql -u root -p | ||
+ | mysql> create database prosody; | ||
+ | mysql> grant usage on *.* to prosody@localhost identified by ' | ||
+ | mysql> grant all privileges on prosody.* to prosody@localhost; | ||
+ | </ | ||
- | Nun geht es an die eigentliche | + | Nun geht es an die eigentliche |
- | / | + | <file lua / |
+ | -- Prosody XMPP Server Configuration | ||
+ | -- | ||
+ | -- Information on configuring Prosody can be found on our | ||
+ | -- website at http:// | ||
+ | -- | ||
+ | -- Tip: You can check that the syntax of this file is correct | ||
+ | -- when you have finished by running: luac -p prosody.cfg.lua | ||
+ | -- If there are any errors, it will let you know what and where | ||
+ | -- they are, otherwise it will keep quiet. | ||
+ | -- | ||
+ | -- Good luck, and happy Jabbering! | ||
+ | |||
+ | |||
+ | ---------- Server-wide settings ---------- | ||
+ | -- Settings in this section apply to the whole server and are the default settings | ||
+ | -- for any virtual hosts | ||
+ | |||
+ | -- This is a (by default, empty) list of accounts that are admins | ||
+ | -- for the server. Note that you must create the accounts separately | ||
+ | -- (see http:// | ||
+ | -- Example: admins = { " | ||
+ | admins = {} | ||
+ | |||
+ | -- Enable use of libevent for better performance under high load | ||
+ | -- For more information see: http:// | ||
+ | use_libevent = true; | ||
- | -- Prosody XMPP Server Configuration | + | |
- | -- | + | plugin_paths |
- | -- Information on configuring Prosody can be found on our | + | |
- | -- website at http:// | + | -- This is the list of modules Prosody will load on startup. |
- | -- | + | -- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too. |
- | -- Tip: You can check that the syntax of this file is correct | + | -- Documentation on modules can be found at: http:// |
- | -- when you have finished by running: luac -p prosody.cfg.lua | + | modules_enabled = { |
- | -- If there are any errors, it will let you know what and where | + | |
- | -- they are, otherwise it will keep quiet. | + | -- Generally required |
- | -- | + | " |
- | -- Good luck, and happy Jabbering! | + | " |
- | + | " | |
- | + | " | |
- | ---------- Server-wide settings ---------- | + | " |
- | -- Settings in this section apply to the whole server and are the default settings | + | " |
- | -- for any virtual hosts | + | |
- | + | -- Not essential, but recommended | |
- | -- This is a (by default, empty) list of accounts that are admins | + | " |
- | -- for the server. Note that you must create the accounts separately | + | " |
- | -- (see http:// | + | |
- | -- Example: admins | + | -- These are commented by default as they have a performance impact |
- | | + | --" |
- | + | " | |
- | -- Enable use of libevent for better performance under high load | + | |
- | -- For more information see: http:// | + | -- Nice to have |
- | --use_libevent = true; | + | " |
- | + | " | |
- | -- This is the list of modules Prosody will load on startup. | + | |
- | -- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too. | + | " |
- | -- Documentation on modules can be found at: http:// | + | " |
- | modules_enabled = { | + | " |
- | | + | " |
- | -- Generally required | + | --" |
- | " | + | |
- | " | + | -- Admin interfaces |
- | " | + | " |
- | " | + | --" |
- | " | + | |
- | " | + | -- HTTP modules |
- | | + | --" |
- | -- Not essential, but recommended | + | " |
- | " | + | |
- | " | + | -- Other specific functionality |
- | | + | --" |
- | -- These are commented by default as they have a performance impact | + | --" |
- | --" | + | --" |
- | --" | + | --" |
- | | + | --" |
- | -- Nice to have | + | --" |
- | " | + | }; |
- | " | + | |
- | " | + | -- These modules are auto-loaded, |
- | " | + | -- to disable them then uncomment them here: |
- | " | + | modules_disabled = { |
- | " | + | -- " |
- | | + | -- " |
- | -- Admin interfaces | + | -- " |
- | " | + | }; |
- | --" | + | |
- | | + | -- Disable account creation by default, for security |
- | -- HTTP modules | + | -- For more information see http:// |
- | --" | + | allow_registration = true; |
- | --" | + | registration_hosts={' |
- | | + | |
- | -- Other specific functionality | + | daemonize = true; |
- | --" | + | -- Required for init scripts and prosodyctl |
- | --" | + | pidfile = "/ |
- | --" | + | |
- | --" | + | http_files_dir="/ |
- | --" | + | http_dir_listing=true; |
- | --" | + | |
- | }; | + | http_ports = { 5280 } |
- | | + | http_interfaces = { " |
- | -- These modules are auto-loaded, | + | |
- | -- to disable them then uncomment them here: | + | -- These are the SSL/ |
- | modules_disabled = { | + | -- to use SSL/TLS, you may comment or remove this |
- | -- " | + | ssl = { |
- | -- " | + | key = "/ |
- | -- " | + | certificate = "/ |
- | }; | + | } |
- | | + | |
- | -- Disable account creation by default, for security | + | -- Force clients to use encrypted connections? |
- | -- For more information see http:// | + | -- prevent clients from authenticating unless they are using encryption. |
- | allow_registration = true; | + | |
- | | + | c2s_require_encryption = true |
- | registration_whitelist_starts_with = { ' | + | |
- | | + | -- Force certificate authentication for server-to-server connections? |
- | | + | -- This provides ideal security, but requires servers you communicate |
- | + | -- with to support encryption AND present valid, trusted certificates. | |
- | | + | -- NOTE: Your version of LuaSec must support certificate verification! |
- | -- Required for init scripts and prosodyctl | + | -- For more information see http:// |
- | pidfile = "/ | + | |
- | | + | s2s_require_encryption = true |
- | -- These are the SSL/ | + | s2s_secure_auth = false |
- | -- to use SSL/TLS, you may comment or remove this | + | |
- | ssl = { | + | -- Many servers don't support encryption or have invalid or self-signed |
- | key = "/ | + | -- certificates. You can list domains here that will not be required to |
- | certificate = "/ | + | -- authenticate using certificates. They will be authenticated using DNS. |
- | } | + | |
- | | + | s2s_insecure_domains = { " |
- | -- Force clients to use encrypted connections? | + | |
- | -- prevent clients from authenticating unless they are using encryption. | + | -- Even if you leave s2s_secure_auth disabled, you can still require valid |
- | | + | -- certificates for some domains by specifying a list here. |
- | c2s_require_encryption = true | + | |
- | | + | s2s_secure_domains = { " |
- | -- Force certificate authentication for server-to-server connections? | + | |
- | -- This provides ideal security, but requires servers you communicate | + | -- Select the authentication backend to use. The ' |
- | -- with to support encryption AND present valid, trusted certificates. | + | -- use Prosody' |
- | -- NOTE: Your version of LuaSec must support certificate verification! | + | -- To allow Prosody to offer secure authentication mechanisms to clients, the |
- | -- For more information see http:// | + | -- default provider stores passwords in plaintext. If you do not trust your |
- | | + | -- server please see http:// |
- | s2s_require_encryption = true | + | -- for information about using the hashed backend. |
- | s2s_secure_auth = false | + | |
- | | + | --authentication = " |
- | -- Many servers don't support encryption or have invalid or self-signed | + | |
- | -- certificates. You can list domains here that will not be required to | + | -- we want passwords to be hashed on disk! |
- | -- authenticate using certificates. They will be authenticated using DNS. | + | authentication = " |
- | | + | |
- | s2s_insecure_domains = { " | + | -- Select the storage backend to use. By default Prosody uses flat files |
- | | + | -- in its configured data directory, but it also supports more backends |
- | -- Even if you leave s2s_secure_auth disabled, you can still require valid | + | -- through modules. An " |
- | -- certificates for some domains by specifying a list here. | + | -- additional dependencies. See http:// |
- | | + | |
- | s2s_secure_domains = { " | + | storage = " |
- | | + | |
- | -- Select the authentication backend to use. The ' | + | -- For the " |
- | -- use Prosody' | + | --sql = { driver = " |
- | -- To allow Prosody to offer secure authentication mechanisms to clients, the | + | sql = { driver = " |
- | -- default provider stores passwords in plaintext. If you do not trust your | + | --sql = { driver = " |
- | -- server please see http:// | + | |
- | -- for information about using the hashed backend. | + | -- Logging configuration |
- | | + | -- For advanced logging see http:// |
- | --authentication = " | + | log = { |
- | | + | info = "/ |
- | -- we want passwords to be hashed on disk! | + | error = "/ |
- | authentication = " | + | |
- | | + | |
- | -- Select the storage backend to use. By default Prosody uses flat files | + | -- " |
- | -- in its configured data directory, but it also supports more backends | + | } |
- | -- through modules. An " | + | |
- | -- additional dependencies. See http:// | + | |
- | | + | |
- | --storage = " | + | |
- | | + | http_paths = { |
- | -- For the " | + | register_web = "/"; |
- | --sql = { driver = " | + | files="/ |
- | --sql = { driver = " | + | } |
- | --sql = { driver = " | + | |
- | | + | http_host = " |
- | -- Logging configuration | + | |
- | -- For advanced logging see http:// | + | ----------- Virtual hosts ----------- |
- | log = { | + | -- You need to add a VirtualHost entry for each domain you wish Prosody to serve. |
- | info = "/ | + | -- Settings under each VirtualHost entry apply *only* to that host. |
- | error = "/ | + | |
- | | + | |
- | | + | --VirtualHost " |
- | -- " | + | |
- | } | + | -- Section for host |
- | | + | |
- | ----------- Virtual hosts ----------- | + | VirtualHost "xmpp.ffpi" |
- | -- You need to add a VirtualHost entry for each domain you wish Prosody to serve. | + | --enabled = false -- Remove this line to enable this host |
- | -- Settings under each VirtualHost entry apply *only* to that host. | + | |
- | | + | -- Assign this host a certificate for TLS, otherwise it would use the one |
- | VirtualHost " | + | -- set in the global section (if any). |
- | | + | -- Note that old-style SSL on port 5223 only supports one certificate, |
- | -- Section for host | + | -- use the global one. |
- | | + | ssl = { |
- | VirtualHost "hier der domain name" | + | key = "/ |
- | --enabled = false -- Remove this line to enable this host | + | certificate = "/ |
- | | + | |
- | -- Assign this host a certificate for TLS, otherwise it would use the one | + | -- We do not want SSL2 and SSL3, no compression, |
- | -- set in the global section (if any). | + | options = { " |
- | -- Note that old-style SSL on port 5223 only supports one certificate, | + | --options = { " |
- | -- use the global one. | + | --options = { " |
- | ssl = { | + | -- Only FS (Forward Secrecy) Ciphers |
- | key = "/ | + | ciphers = " |
- | certificate = "/ | + | dhparam = "/ |
- | | + | } |
- | -- We do not want SSL2 and SSL3, no compression, | + | |
- | options = { " | + | |
- | --options = { " | + | |
- | --options = { " | + | VirtualHost " |
- | -- Only FS (Forward Secrecy) Ciphers | + | --enabled = false -- Remove this line to enable this host |
- | ciphers = " | + | |
- | dhparam = "/ | + | -- Assign this host a certificate for TLS, otherwise it would use the one |
- | } | + | -- set in the global section (if any). |
- | | + | -- Note that old-style SSL on port 5223 only supports one certificate, |
- | ------ Components ------ | + | -- use the global one. |
- | -- You can specify components to add hosts that provide special services, | + | ssl = { |
- | -- like multi-user conferences, | + | key = "/ |
- | -- For more information on components, see http:// | + | certificate = "/ |
- | | + | |
- | -- Set up a MUC (multi-user chat) room server on conference.example.com: | + | -- We do not want SSL2 and SSL3, no compression, |
- | --Component " | + | options = { " |
- | | + | --options = { " |
- | -- Set up a SOCKS5 bytestream proxy for server-proxied file transfers: | + | --options = { " |
- | --Component " | + | -- Only FS (Forward Secrecy) Ciphers |
- | | + | ciphers = " |
- | ---Set up an external component (default component port is 5347) | + | dhparam = "/ |
- | --Component " | + | } |
- | -- component_secret = " | + | |
+ | ------ Components ------ | ||
+ | -- You can specify components to add hosts that provide special services, | ||
+ | -- like multi-user conferences, | ||
+ | -- For more information on components, see http:// | ||
+ | |||
+ | -- Set up a MUC (multi-user chat) room server on conference.example.com: | ||
+ | --Component " | ||
+ | |||
+ | -- Set up a SOCKS5 bytestream proxy for server-proxied file transfers: | ||
+ | --Component " | ||
+ | |||
+ | ---Set up an external component (default component port is 5347) | ||
+ | --Component " | ||
+ | -- component_secret = " | ||
+ | |||
+ | </ | ||
Bei der Auswahl der Ciphers wurde ein besonderes Augenmerk auf die Sicherheit der Übertragung gelegt. Leider lässt sich eine eine ausschließe Verwendung von FS-Ciphers nicht umsetzen, da viele Server kein FS Support haben. Um aber trotzdem mit diesen Servern kommunizieren zu können wurde AES-128/256 im GCM (Galois-Counter-Mode) aktiviert. | Bei der Auswahl der Ciphers wurde ein besonderes Augenmerk auf die Sicherheit der Übertragung gelegt. Leider lässt sich eine eine ausschließe Verwendung von FS-Ciphers nicht umsetzen, da viele Server kein FS Support haben. Um aber trotzdem mit diesen Servern kommunizieren zu können wurde AES-128/256 im GCM (Galois-Counter-Mode) aktiviert. | ||
- | DNS-Konfiguration | + | |
+ | ===== DNS-Konfiguration | ||
Jetzt müssen noch die richtigen DNS Einträge für den Server gesetzt werden. | Jetzt müssen noch die richtigen DNS Einträge für den Server gesetzt werden. | ||
- | ffpi.zone | + | <file conf ffpi.zone> |
; _service._proto.name TTL class SRV priority weight port target | ; _service._proto.name TTL class SRV priority weight port target | ||
_xmpp-client._tcp.ffpi. 86400 IN SRV 5 0 5222 srv02.ffpi. | _xmpp-client._tcp.ffpi. 86400 IN SRV 5 0 5222 srv02.ffpi. | ||
_xmpp-server._tcp.ffpi. 86400 IN SRV 5 0 5269 srv02.ffpi. | _xmpp-server._tcp.ffpi. 86400 IN SRV 5 0 5269 srv02.ffpi. | ||
+ | </ | ||
- | Abschluss | + | ===== Abschluss |
- | Anschließend | + | Abschließend |
- | service prosody restart | + | |