My OMV got hacked, I need help

  • Agreed. Running wide open is a major security concern, but that was already mentioned above.


    My reverse proxy/fail2ban comments along with the mention of only exposing things that you want others to access using a login is the the whole point.


    Minimize the attack surface by reducing the number of things exposed to the world, secure it with some kind of authentication, and do it through a reverse proxy so the open open ports are minimized and something like fail2ban can be implemented to monitor the logs and automatically institute bans if someone is hammering to try to get in.


    That is the minimum requirement as far as I am concerned, and realistically it's basically what you need in order to make the cloudflare/firewall things that others suggested functional.


    The other options like the cloudflare thing can work, but once again to make it effective, something like fail2ban via a connector needs to report failed attempts to cloudflare. Without that you are just masking your wan ip address. The pfsense/opnsense thing can help by instituting a good firewall with lots of control, but once again, unless it is actually handling the reverse proxy and failed login monitoring, it has no way to block someone from hammering.

  • Suggest open to scrutiny developer, perhaps reacts:


    [FEAT] add htpasswd or some mechanism to protect webGUI with user/password · Issue #462 · AnalogJ/scrutiny
    I use your valuable piece of software on a docker and expose webGUI throught heimdall, I have secure conecction (https), but scrutiny do not ask for…
    github.com

  • Suggest open to scrutiny developer, perhaps reacts:

    There's always the possibility to add Authelia via SWAG but didn't give it much thought.

    It's a simple container that I don't need to have it running full-time, :)

  • There's always the possibility to add Authelia via SWAG but didn't give it much thought.

    It's a simple container that I don't need to have it running full-time, :)

    Yeah, verbatim, I could not get authelia to work with swag worth a damn!!! But I got it working on NGINX, but then NGINX I could not get it to redirect to my other hosts on different ips, like SWAG could.

    So I said F it all, I am done.

    ONE thing on SWAG; Heimdall. Heimdall has LAN IP for links so inaccessible from Internet, which makes heimdall pointless.


    So, I just connect to LAN via Wireguard and it is all there.

  • Yeah, verbatim, I could not get authelia to work with swag worth a damn!!! But I got it working on NGINX, but then NGINX I could not get it to redirect to my other hosts on different ips, like SWAG could.

    So I said F it all, I am done.

    ONE thing on SWAG; Heimdall. Heimdall has LAN IP for links so inaccessible from Internet, which makes heimdall pointless.


    So, I just connect to LAN via Wireguard and it is all there.

    I use nginx-proxy-manager. I have no problems helping you or anyone else with the setup if I can, by supplying some info. I have no idea about using authelia with it though. I have never tried it.


    The basic setup is fairly simple though.


    Put it in the same docker network as your docker service that you want to expose.

    The host is then set up using HTTP [container name] port.

    I recommend enabling the block common exploits option.

    The cache assets is optional, but this allows npm to cache static elements for faster access, and the websockets support is usually not needed since most containers are actually running their own web server via http and not using sockets


    The access lists allow for restricting access to LAN, WAN, or adding a login to things that don't have a login.


    You can also enable ssl and get a lets encrypt cert. If you then enable the force ssl option, all traffic is forced to ssl encryption. No need for HTTPS in the containers since NPM converts to it.

    HTTP/2 is the newer HTTP protocols and considered more secure (I can't tell your the exact reasoning though)

    The HSTS options are more secure again.


    NPM does not support wildcard certs, so you need a cert per host.


    Custom locations and advanced are usually not needed, bit do allow for some more advanced things. ie. nextcloud requires some custom locations to be set and some advanced options to be set for it to behave properly when running in a VM. I would assume the docker install would also require them.


    If the service is not a docker, but instead a vm or lxc, substitute the ip address in place of the container name. You can also use the ip if the container is not on this docker network, but it is cleaner in regards to LAN traffic if they are on the same docker networ and use the container name.


    If you want fail2ban then you deploy the following docker, modifying as required for your setup:

    In the fail2ban persistent data bind, create the following npm-docker.local file in the jail.d, adjusting the maxretry, bantime and findtime to suit your needs:

    Code: npm-docker.local
    [npm-docker]
    enabled = true
    ignoreip = 127.0.0.1/8 192.168.2.0/24
    chain = INPUT
    action = iptables-nft[type=allports, chain=DOCKER-USER]
    logpath = /var/log/default-host_*.log
              /var/log/proxy-host-*.log
    maxretry = 5
    bantime  = 10800
    findtime = 3600

    Create this npm-docker.conf file in the filter.d

    Code: npm-docker.conf
    [INCLUDES]
    
    [Definition]
    
    failregex = ^<HOST>.+" (4\d\d|3\d\d) (\d\d\d|\d) .+$
                ^.+ 4\d\d \d\d\d - .+ \[Client <HOST>\] \[Length .+\] ".+" .+$

    and create this iptables-nft.local file in the action.d

    restart fail2ban.


    The filter file is a regex expression that looks for 400 errors and passes them to the jail file which takes those values and performs the action file on them.


    The action file creates an iptables ban on the host in the DOCKER-USER chain to block the ip's that exceed the the maxretry value within the findtime (in seconds) and bans them for the bantime (in seconds)

    • Offizieller Beitrag

    at the very least you should be using a reverse proxy like swag or nginx-proxy-manager with fail2ban enabled so that hammering by a hacker is blocked after a few failed login attempts.

    Here is shown how to use fail2ban from swag for applications like nextcloud

    Securing SWAG - Advanced Configurations


  • So, I want to be clear about something. The fail2ban instance mentioned above is solely used for NPM in this configuration? I ask simply for two reasons.


    1.) I see in the fail2ban stack that it has an added path to NPM logs, which leads me to believe this fail2ban instance is simply for NPM only

    2.) If I wanted to used fail2ban (outside of OMV) I would need to create a second fail2ban container.


    I guess I just am confused a little bit.. I have it up and running as is and it appears to be fine thus far, I am just curious how I would implement this instance to my other containers, or if I would not, and create a different fail2ban.

  • Yes. you can configure it to watch whatever logs you want by giving it access to the logs and creating the appropriate jail and filter config files. The default config I posted is a basic monitor for any proxy host that is reporting a 400 group or 300 group error, which includes some unauthorized, bad request, bad redirects, etc.


    Depending on the host though, this may not be enough and further jails and filters may be required. For example, my nextcloud instance monitors it's own logs with fail2ban, but uses a different jail and filter, because the nextcloud logs are a lot more complicated and it doesn't log just the basic error code. I guess i could pull it in under a single fail2ban instance used with NPM, but I just haven't done it yet. Also my nextcloud is not a docker container. It runs as an lxc vm which I recently converted to from a full qcow2 vm, so the config has changed a bit and I haven’t gone back to figure out the access and assess if it would be better to handle at the NPM level or the vm level due to the tangly nature of the nextcloud logs.


    I do have plans to investigate this, but have to try to get through the next month or two of upgrades at the office before I will have the time to investigate.


    Code: fail2ban/filter.d/nextcloud.conf
    [Definition]
    _groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
    failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
                ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Trusted domain error.
    datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"
  • Just saw this one now:

    Heimdall has LAN IP for links so inaccessible from Internet, which makes heimdall pointless.

    This is not correct:
    When editing the HOP, just use the URL you want it to point to:


    If your SWAG is reverse-proxying that service and your ROUTER does allow it (hairpinning), you'll be using only HTTPS links, and not LAN.

  • Just saw this one now:

    This is not correct:
    When editing the HOP, just use the URL you want it to point to:


    If your SWAG is reverse-proxying that service and your ROUTER does allow it (hairpinning), you'll be using only HTTPS links, and not LAN.


    Morning. I did get this figured out a bit back… Though I went from SWAG to NGINX. Initially the issue was me not having local DNS correctly so what I meant was, at the time, I can’t access links when I remote in cause my internet doesn’t understand the LAN IP’s to connect to…. I resolved this in 2 ways, one was like you show changing the ips to host names and having local dns (using Opnsense unbound for local queries) and then also if I were to connect/remote via WireGuard I am “on the lan”.

    It was my lack of understanding initially. Thank you for the response!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!