Err(()).unwrap()

I take my shitposts very seriously.

  • 2 Posts
  • 167 Comments
Joined 3 years ago
cake
Cake day: June 24th, 2023

help-circle
  • I use Docker Compose to run my Nextcloud server using the community image, which in turn lives inside an unprivileged LXC container.

    compose.yaml
    volumes:
      db:
    
    services:
      db:
        image: mariadb:lts
        container_name: mariadb
        restart: always
        command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
        volumes:
          - db:/var/lib/mysql
        secrets:
          - mysql_root_password
          - mysql_nextcloud_password
        environment:
          - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
          - MYSQL_PASSWORD_FILE=/run/secrets/mysql_nextcloud_password
          - MYSQL_DATABASE=nextcloud
          - MYSQL_USER=nextcloud
    
      nextcloud:
        image: nextcloud:latest
        container_name: nextcloud
        restart: always
        ports:
          - 8080:80
        depends_on:
          - db
        volumes:
          - /var/www/html:/var/www/html
          - /srv/nextcloud:/srv
        environment:
          - MYSQL_PASSWORD_FILE=/run/secrets/mysql_nextcloud_password
          - MYSQL_DATABASE=nextcloud
          - MYSQL_USER=nextcloud
          - MYSQL_HOST=db
    
    secrets:
      mysql_root_password:
        file: ./secrets/mysql_root_password.txt
      mysql_nextcloud_password:
        file: ./secrets/mysql_nextcloud_password.txt
    

    Nextcloud’s file storage is a mount point at /srv/nextcloud, which is backed by a ZRAID pool. The secrets are stored in files with 600 permissions. The web server is initially exposed on port 8080.

    When you run the container for the first time, it will show a first time setup dialog. You’ll have to fill it out manually, using mariadb for the database type and db for the database hostname.

    If Nextcloud works through HTTP, you can then set up a proxy for HTTPS. I used Nginx running on the same LXC. I can’t guarantee that my config is adequately secure, use it at your own risk.

    10-nextcloud.conf
    upstream php-handler {
    	server 127.0.0.1:9000;
    }
    
    server {
    	listen 80;
    	listen [::]:80;
    	server_name nextcloud.your.domain;
    	return 301 https://$host$request_uri;
    }
    
    server {
    	listen 443 ssl http2;
    	listen [::]:443 ssl http2;
    	server_name nextcloud.your.domain;
    	keepalive_timeout 70;
    	client_max_body_size 32G;
    
    	ssl_certificate /etc/nginx/ssl/ssl.crt;
    	ssl_certificate_key /etc/nginx/ssl/ssl.key;
    	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    	ssl_ciphers HIGH:!aNULL:!MD5;
    
    	add_header Referrer-Policy "no-referrer" always;
    	add_header X-Content-Type-Options "nosniff" always;
    	add_header X-Download-Options "noopen" always;
    	add_header X-Frame-Options "SAMEORIGIN" always;
    	add_header X-Permitted-Cross-Domain-Policies "none" always;
    	add_header X-Robots-Tag "none" always;
    	add_header X-XSS-Protection "1; mode=block" always;
    
    	fastcgi_hide_header X-Powered-By;
    
    	location / {
    		proxy_pass http://127.0.0.1:8080/;
    	}
    }
    

    To allow the web app to work using the DNS name, you’ll have to edit /var/www/html/config/config.php and change/add these values:

    config.php (partial)
    'trusted_domains' => array(
        0 => '127.0.0.1:8080',
        1 => 'nextcloud.your.domain',
        // 2 => whatever other addresses you want to use
    ),
    'overwrite.cli.url' => 'https://nextcloud.your.domain/',
    'overwriteprotocol' => 'https',
    'overwritehost' => 'nextcloud.ng.local'
    

    If at any point you need to start over, remember to delete the contents of /var/www/html.

    (edit) Forgot to mention: the web server will accept connections from all addresses, you’ll need to set up a strict firewall to only allow 443 (maybe 80) and 22.





  • IIRC, somebody tried to trace the company back to its owners, but the chain ended with a company that is likely Chinese. One of the earliest company-hosted relay servers was also located in China based on its IP address. The company now runs multiple servers on various continents.

    Some people also freaked out when the company started offering paid, binary server images and services that added extra features like a management console, assuming (incorrectly) that they would replace the basic, no-cost, open-source images.


  • RustDesk. It works like TeamViewer: install the client on both machines, have the relative read out the client ID and one-time password over the phone, and you can connect immediately. It has self-hostable server components, but you can use the public relay servers without having to configure anything on the clients. You don’t have to open any ports on the firewall either.








  • Open config.php and look for the entry named trusted_domains. Make sure it contains both the domain name and the local IP address:

    'trusted_domains' => array(
        0 => 'nextcloud.your.domain',         // the public FQDN
        1 => '172.22.?.?',                    // the local IP address
        2 => '...',                           // other addresses, like if you're using a VPN
    ),
    

    If the web app is opened using an address or DNS name that isn’t included in this list, the browser will connect, but the app will refuse to work.

    Nevermind, I completely overlooked that the service is Opencloud, not Nextcloud. Nevertheless, you should investigate whether Opencloud has an equivalent config variable.



  • Right at this moment, I’m rebuilding my homelab after a double HDD failure earlier this year.

    The previous build had a RAID 5 array of three 1TB Seagate Barracudas that I picked out of the scrap pile at work. I knew what I was getting into and only kept replaceable files on it. When one of the drives started doing the death rattle, I decided to yank some harder-to-acquire files to my 3TB desktop HDD before trying to resilver the entire array. Guess which device was the next to fail. I could mount and read it, but every operation took 2-5 minutes. SMART showed a reallocation count in the thousands. That drive contained some important files that I couldn’t replace, which were backed up to the (now dead) server. Fortunately ddrescue managed to recover damn near everything and I only lost 80 kilobytes out of the entire disk. That was a very expensive lesson that I’ve learned very cheaply.

    The new setup has a RAIDz1 pool of 3x 4TB Ironwolf disks (constrained by the available SATA sockets on the motherboard), plus a new SSD for the OS and 16GB RAM (upgraded from literally the first SSD I ever bought and 10GB mis-matched DDR3).

    Mounting it was a bit of a dilemma. The previous array was simply mounted to the filesystem from fstab and bind-mounted to the containers. I definitely wanted the storage to be managed from Proxmox’s web UI and to be able to create VDs and LXC volumes on it. Some community members helped me choose ZFS over LVM-on-RAID5. Setting up the correct permissions wasn’t as much of a headache as last time. I’ve just managed to get a Samba+NFS+HTTP file server and Jellyfin running and talking to each other. Forgejo and Nextcloud will be next.







  • If the other person has a Tailscale account, it sounds like the most expedient method is to simply invite them to the tailnet as a non-admin user with strict access control.

    You could share a node with an outside user, but I don’t know how much the quarantine would affect its functionality. You could also use Funnel to expose the node to the internet (essentially like a reverse proxy), but there are obvious vital security considerations with that approach.