Varnish sample vcl for rtmp / m3u8 stream

vcl 4.0;
import std;
backend default {
.host = "127.0.0.1";
.port = "8090";
}
acl purge {
"127.0.0.1";
}
sub vcl_recv {
if(req.method == "PURGE"){
if (!client.ip ~ purge) {
return(synth(405,"Not allowed."));
}
return (purge);
}
return (hash);
}

sub vcl_backend_response {

if (bereq.url ~ "m3u8") {
# assuming chunks are 2 seconds long
set beresp.ttl = 1s;
set beresp.grace = 0s;
} else {
set beresp.ttl = 10m;
set beresp.grace = 5m;
}
}
Share

Centos disk XFS xfs_repair

  1. During bootup, when the GRUB2 menu shows up, press the e key for edit
  2. Add the following parameter at the end of the linux16 line, after quiet:
    quiet systemd.unit=emergency.target
  3. Press Ctrl+x to boot the system with the parameter.
  4. first find your device UUID in /dev/disk/by-uuid
  5. umount
    umount /dev/disk/by-uuid/198s5364-a29c-429e-b16d-e772acd
  6. repair
    xfs_repair /dev/disk/by-uuid/198s5364-a29c-429e-b16d-e772acd

Reboot

edit:
sometimes you have to force it by deleting the log file

xfs_repair -L /dev/disk/by-uuid/198s5364-a29c-429e-b16d-e772acd
Share

Install pfSense Qemu Guest Agent

Software Versions

The following software versions were used in this post.

  • pfSense Community Edition – 2.6.0
  • QEMU Guest Agent – 5.0.1

Install the qemu-guest-agent package.

pkg install -y qemu-guest-agent

Once installed, there is a note on how to setup the agent.

Modify your `/etc/rc.conf` by adding these settings

qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"

and run Continue reading “Install pfSense Qemu Guest Agent” »

Share

Install OnlyOffice 7 on Ubuntu 22

Install OnlyOffice Document Server on Ubuntu

OnlyOffice document server depends on PostgreSQL, Node.js, Redis Server, RabbitMQ server and Nginx. The following steps are tested on a Ubuntu 22.04 server but should also be applicable to Linux distributions in the Debian family.

Install PostgreSQL on Ubuntu

PostgreSQL is available from the default Ubuntu repository. The PostgreSQL team always strives to make performance improvements with every new version. Run the following commands to install the latest version of PostgreSQL from the postgresql.org repository.

echo "deb [signed-by=/etc/apt/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo mkdir -p /etc/apt/keyrings/
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/keyrings/postgresql.asc
sudo apt update
sudo apt install -y postgresql postgresql-contrib postgresql-15 postgresql-client-15
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

Note: Both the username and password must be onlyoffice. Continue reading “Install OnlyOffice 7 on Ubuntu 22” »

Share

Install Apache2, PHP 7.2 and MariaDB 10.5 on Debian 11

First, update all the packages of the system by below-mentioned command:

sudo apt update

After updating packages, now install the dependencies required by the below-mentioned command:

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https

Enable SURY Repository

The following step is to integrate the SURY repository into our system. SURY is a Debian-based third-party PHP repository that bundles PHP software, run the following command to add SURY repository: Continue reading “Install Apache2, PHP 7.2 and MariaDB 10.5 on Debian 11” »

Share

Configure Zimbra to use SendGrid as Smarthost

Switch to user Zimbra

su zimbra

Add credentials to relay_password file:

nano /opt/zimbra/conf/relay_password

Add:

smtp.sendgrid.net yourSendGridUsername:yourSendGridPassword

Apply configuration to Zimbra

postmap /opt/zimbra/conf/relay_password
postmap -q smtp.sendgrid.net /opt/zimbra/conf/relay_password
zmprov ms `zmhostname` zimbraMtaSmtpSaslPasswordMaps lmdb:/opt/zimbra/conf/relay_password
zmprov ms `zmhostname` zimbraMtaSmtpSaslAuthEnable yes
zmprov ms `zmhostname` zimbraMtaSmtpCnameOverridesServername no
zmprov ms `zmhostname` zimbraMtaSmtpTlsSecurityLevel may
zmprov ms `zmhostname` zimbraMtaSmtpSaslSecurityOptions noanonymous
zmprov ms `zmhostname` zimbraMtaRelayHost smtp.sendgrid.net:587

Now wait for a couple of minutes and start testing it by sending out some test mails. Follow the log file to see if it works or not:

tail -f /var/log/zimbra.log
Share

Extreme slow internet speed pfsense over proxmox

For a qemu proxmox guest PFSense acts weriedly with the network speed- it gets extremely slow. So her goes the little tweaks that worked for me-

First, I chose Intel E1000 Interfaces instead VirtIO.

Second, in the PFSense webconsole-

In pfSense GUI, System > Advanced > Networking > Tick on-

  • Disable hardware checksum offload
  • Disable hardware TCP segmentation offload
  • Disable hardware large receive offload
Share

Linux Screen Cheatsheet

To create a screen

screen

List all the detached (running) screens with their screen IDs.

screen -list

Connect / Attach to a specific running screen.

screen -x [screen id]

While in a screen to Terminate / Stop a screen from running.

Ctrl + D

While in a screen to detach from screen without disturbing it.

Ctrl + A, Then press D

Detach or terminate all screens.

killall screen
Share

Force stop xen vm using command line

Instructions

  1. Disable High Availability (HA) so you don’t run into issues.
  2. Log into the Xenserver host that is running your VM with issues via ssh or console via XenCenter. Run the following command to list VMs and their UUIDs
    xe vm-list resident-on=<uuid_of_host>
  3. First you can try just the normal shutdown command with force
    xe vm-shutdown uuid=<UUID from step 3> force=true
  4. If that just hangs, use CONTROL+C to kill it off and try to reset the power state.  The force is required on this command
    xe vm-reset-powerstate uuid=<UUID from step 3> force=true
  5. If the VM is still not shutdown, we may need to destroy the domain.  Run this command to get the domain id of the VM.  It is the number in the first row of output. The list will be the VMs on the host.  Dom0 will be the host itself and all numbers after are running VM
    list_domains
  6. Now run this command using the domain ID from the output of step 7
    xl destroy <DOMID from step 7>
Share