• 0 Posts
  • 19 Comments
Joined 2 years ago
cake
Cake day: July 3rd, 2023

help-circle


  • For loops with find are evil for a lot of reasons, one of which is spaces:

    $ tree
    .
    ├── arent good with find loops
    │   ├── a
    │   └── innerdira
    │       └── docker-compose.yml
    └── dirs with spaces
        ├── b
        └── innerdirb
            └── docker-compose.yml
    
    3 directories, 2 files
    $ for y in $(find .); do echo $y; done
    .
    ./are
    t good with fi
    d loops
    ./are
    t good with fi
    d loops/i
    
    erdira
    ./are
    t good with fi
    d loops/i
    
    erdira/docker-compose.yml
    ./are
    t good with fi
    d loops/a
    ./dirs with spaces
    ./dirs with spaces/i
    
    erdirb
    ./dirs with spaces/i
    
    erdirb/docker-compose.yml
    ./dirs with spaces/b
    

    You can kinda fix that with IFS (this breaks if newlines are in the filename which would probably only happen in a malicious context):

    $ OIFS=$IFS
    $ IFS=$'\n'
    $ for y in $(find .); do echo "$y"; done
    .
    ./arent good with find loops
    ./arent good with find loops/innerdira
    ./arent good with find loops/innerdira/docker-compose.yml
    ./arent good with find loops/a
    ./dirs with spaces
    ./dirs with spaces/innerdirb
    ./dirs with spaces/innerdirb/docker-compose.yml
    ./dirs with spaces/b
    $ IFS=$OIFS
    

    But you can also use something like:

    find . -name 'docker-compose.yml' -printf '%h\0' | while read -r -d $'\0' dir; do
          ....
    done
    

    or in your case this could all be done from find alone:

    find . -name 'docker-compose.yml' -execdir ...
    

    -execdir in this case is basically replacing your cd $(dirname $y), which is also brittle when it comes to spaces and should be quoted: cd "$(dirname "$y")".






  • I don’t want to tell you one way or the other because it’s kinda dubious anyway, but if all services run as the same user the need for root is kinda moot when it comes to crossing between services or expanding the scope of an attack. Of course it is better than all things running as root, but if I popped a machine as some “low privilege” user that still had access to all running services I’m not sure I’d care so much about escalating to root.


  • qqq@lemmy.worldtoSelfhosted@lemmy.worldDedicated service user or not ?
    link
    fedilink
    English
    arrow-up
    10
    ·
    edit-2
    5 months ago

    Woah, no. Sure escaping via a kernel bug or some issue in the container runtime is unexpected, but I “escape” containers all the time in my job because of configuration issues, poorly considered bind mounts, or the “contained” service itself ends up being designed to manage some things outside of the container.

    Might be valid to not consider it with the services you run, but that reasoning is very wrong.





  • Nobody is gonna be using a quantum computer to “crack email hashes” of Plex users in a few years… I’m not even sure there is a speedup to hash cracking with quantum computers.

    But depending on the hashing algorithm used, it’s likely pretty easy to crack hashes of email addresses today with a normal computer. They’re not particularly high entropy.






  • Honestly I wouldn’t even go so far as home assistant. Do you have any IP cameras or just USB webcams? If you have IP cameras all you need is the VPN and then just access them as if you’re at home. If you only have USB webcams, you’re going to have to stream the content and I believe ffmpeg is actually capable of taking /dev/videoX and serving it over RTSP somehow, but I don’t remember exactly how. I see some references to it in some quick searches though. Maybe start here (some blog) or here (Stackoverflow question)?

    Another thing to remember is that you’re going to be limited by your upload speed. If you’re not on fiber and in the US that’s likely going to be pretty bad, so set your resolution and the like accordingly.


  • Sorry about your cat. We typically have a Rover stop in to check on our cats when we’re gone for a bit; it’s nice to get them some human interaction and they always send pictures and give updates.

    I personally have a camera setup inside that just streams to HomeAssistant so we can check on them ourselves when we’re out just for the weekend. I disconnect it when Rovers are stopping by though because I don’t want them to feel spied on. No need for anything fancy really, but if you really want NVR I just use Frigate (for other things, the cat camera really is just a stream). It’s free and open source and really easy to set up.

    WireGuard is a very easy way to set up the access. My router has just the single WireGuard UDP port forwarded