Asterisk with fail2ban

I recently started to add some security features to my asterisk server. One was adding a fail2ban jail. Because I have asterisk running inside of docker, I mounted my log folder and changed fail2ban (installed on my docker host itself) to use the message file (in my case: /opt/asterisk/log/messages) . Start by editing /etc/fail2ban/jail.d/asterisk.conf: [asterisk] enabled = true filter = asterisk action = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp] %(banaction)s[name=%(__name__)s-udp, port="%(port)s", protocol="udp", chain="%(chain)s", actname=%(banaction)s-udp] banaction = iptables-multiport logpath = /opt/asterisk/log/messages maxretry = 5 findtime = 3h bantime = 1d Fail2ban needs a specific timestamp format and to prevent asterisk from creating GBs of logs I changed it to only log notice and error messages in the /etc/asterisk/logger....

February 2, 2019 Â· 1 min Â· Anton Bracke

Pfsense / OPNsense Voip

Wer mit Pfsense oder OPNsense seine Firewall Zuhause oder im Betrieb betreibt und zusätzlich noch Voip Telefonie hinter dieser nutzen möchte kommt schnell auf ein kleines Problem. Die beiden Firewalls zur erhöhten Sicherheit ein System, bei dem Ausgehende Verbindungen dynamische Ports verwenden, nutzen. Dies ist SIP allerdings ein Dorn im Auge. Die schnellste Lösung ist daher, für die klassischen SIP Ports die dynamische Port Wahl abzuschalten. Dazu legt man am besten eine Alias VOIP_PORTS mit allen notwendigen SIP Ports (meist 5060, 10000:20000) an oder trägt die Ports einfach direkt ein....

November 17, 2018 Â· 1 min Â· Anton Bracke

Sip Configs

Da ich selber andauernd die richtige Konfiguration der verschiedenen Provider nach lesen muss und auch öfters danach gefragt werde, beginne ich nun hier mal mit einer kleinen Sammlung. Tipps zum Sip Config auslesen Von Julian R. habe ich ein paar nützliche Tipps erhalten um die notwendigen VoIP Einstellungen eines Providers zu erhalten, die ich an dieser Stelle nochmal teilen möchte: Einer Fritzbox mit Wireshark zugehören, wie sie sich verbindet. (Kann auch jeder andere Router sein) Logging der SIP-Pakete im Asterisk aktivieren: sip set debug on pjsip logger on Den Status abchecken mit: pjsip show registrations pjsip show endpoints Telekom SIP-ID/Benutzer: Telefonnummer (+49…) Bildschirmname (falls vorhanden): Telefonnummer (+49…) Authentifizierungsname/Benutzername: E-Mail-Adresse...

November 17, 2018 Â· 5 min Â· Anton Bracke

Openvpn: Update dns servers FIX

Because newer Ubuntu versions are using systemd for dns resolution instead of resolvconf, you need to modify your Openvpn client config a bit. Add following lines to your config (/etc/openvpn/myconnection.conf): script-security 2 setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin up /etc/openvpn/update-systemd-resolved down /etc/openvpn/update-systemd-resolved down-pre Simply add the new update script by running: sudo apt install openvpn-systemd-resolved Or add the script manually: sudo wget https://raw.githubusercontent.com/jonathanio/update-systemd-resolved/master/update-systemd-resolved -P /etc/openvpn/ Server config To route all clients over the vpn gateway add following lines to your server config:...

September 10, 2018 Â· 1 min Â· Anton Bracke

Proxmox changing lxc network config

When using a lxc container in Proxmox it (sometimes) happens that Proxmox overrides the network config of the container and applies its own. In most cases this is contraproductive and not so easy to find out. To stop this, touch /etc/network/.pve-ignore.interfaces to tell Proxmox to not change the network configuration.

September 10, 2018 Â· 1 min Â· Armin Jacob

Postfix sender_login_maps

As recommended you should add reject_sender_login_mismatch to your sender_restrictions to only allow users to send with their own address as FORM. Anyways some special cases are requiring you to login with one address, but send as another like WordPress on most php setups tries to. I created an account called relay@mydomain.de and changed some settings to allow this specific user to send with all addresses. main.cf sender_restrictions = reject_sender_login_mismatch,... master.cf...

August 27, 2018 Â· 2 min Â· Anton Bracke

Bash helpers

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

August 27, 2018 Â· 1 min Â· Anton Bracke

Deutsche Glasfaser: IPv6 vs. pfSense/opnSense

Dieser Eintrag wurde nach der Erstveröffentlichung wesentlich erweitert und verändert. An dieser Stelle besten Dank an Sven Hofacker für das gemeinsame Erarbeiten einer besseren Konfiguration. Wenn man statt der weit verbreiteten Fritz!Boxen (und einigen anderen Routern) eine pfSense-Installation für die Bereitstellung des Internetzuganges nutzen will, sind einige Punkte zu beachten. DHCPv6 oder SLAAC oder 6rd? (WAN-Seite) Da bei IPv6 im Gegensatz zu IPv4 reichlich Adressen vorhanden sind, sind keine Krücken wie NATs vorgesehen....

August 19, 2018 Â· 4 min Â· Armin Jacob

Docker IPv6

There are diffrent ways to support IPv6 in Docker. The easiest is to enable ipv6 on the docker host and simply use the docker proxy to forward ipv6 via ipv4 to the containers. But one disadvantage of this method is, that your container is unable to see the clients remote address. Each request seems to be send from the docker host. Especially nginx and php or a spam filter for your mailserver are depending on a correct client ip....

August 18, 2018 Â· 2 min Â· Anton Bracke

Browsersync

Stop reloading your browser by hand anytime your css, js or template re-renders. Try using Browsersync. I really started loving this tool. Everytime your sass or js gets compiled or you simply changed one thing in your template, browsersync detects the file change and simply reloads your page. One nice extra is that css is reloaded without reloading the complete page. To use it just install it via npm: npm install -g browser-sync I just created a small helper script for my Silverstripe projects, but you could simply change the folder and use it with everything else:...

August 8, 2018 Â· 1 min Â· Anton Bracke