opensips: getting media IP

June 9th, 2024

To get the IP address from the SDP part of incoming INVITE:

http://lists.opensips.org/pipermail/users/2024-June/048189.html

NetBSD 10: httpd with PHP support

April 24th, 2024

By default httpd is run under _httpd user. To start from command line and specify another user (e.g. nobody) type:

To start httpd automatically, edit /etc/rc.conf (not /etc/rc.local , not /etc/defaults/rc.conf):

Ubuntu 20.04 remove old unused kernels

April 13th, 2024

https://askubuntu.com/a/1253348

Check what current kernel You are running:

So, this system runs 5.6.13-050613-lowlatency kernel.

List all installed kernels in Your OS:

Uninstall kernels You don’t need:

flameshot

March 10th, 2024

flameshot – a good alternative for Deepin Screenshot which seems to be unavailable in *buntu 23.10

OpenSIPS dispatching algorithms

February 20th, 2024

Just some explanation of dispatcher module argorithms.

hash over callid – ensures that all requests within a dialog goes to same box
hash over from uri – ensures that all requests from same user goes to same box
hash over to uri – ensures that registrations of an AoR goes to same box
hash over request-uri – ensures that requests to same destination are processes by same box
#hash over config variable – for different needs

NetBSD useful links

February 20th, 2024

https://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-keyboard-layout

https://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-system-time

https://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-mount-cdrom

https://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-pkgsrc

https://netbsd.org/docs/misc/index.html#wifi

https://netbsd.org/docs/misc/index.html#package-management

https://netbsd.org/docs/misc/index.html#installing-rootcerts

https://netbsd.org/docs/misc/index.html#managing-services

https://netbsd.org/docs/misc/index.html#run-on-startup

https://netbsd.org/docs/misc/index.html#viewing-disks

https://netbsd.org/docs/guide/en/chap-rmmedia.html#using-usb-flash-drives

https://netbsd.org/docs/guide/en/chap-rmmedia.html#cdrom

https://netbsd.org/docs/guide/en/chap-rmmedia.html#cdrom-users

https://netbsd.org/docs/guide/en/chap-rmmedia.html#vnconfig

NPF: NetBSD Packet Filter:

https://rmind.github.io/npf/nat.html

https://github.com/rmind/npf/tree/master/docs

https://rmind.github.io/npf/

3nmp (like LAMP)
https://wiki.netbsd.org/tutorials/services/3nmp/

how to install a lamp server
https://wiki.netbsd.org/pkgsrc/how_to_install_a_lamp_server/

setting up blocklistd (like fail2ban)
https://wiki.netbsd.org/tutorials/setting_up_blocklistd/

the netbsd system manager’s manual
https://wiki.netbsd.org/tutorials/the_netbsd_system_manager__39__s_manual/

tuning netbsd for performance
https://wiki.netbsd.org/tutorials/tuning_netbsd_for_performance/

unicode
https://wiki.netbsd.org/tutorials/unicode/

fail2ban, wordpress, lighttpd

February 20th, 2024

/etc/fail2ban/jail.local:

/etc/fail2ban/filter.d/botsearch-common.conf:

rsyslog: redirect logs from certain host to a separate file

November 30th, 2023

Linksys PAP2T-NA phone adapter is configured to send logs to a remote syslog server 10.11.0.10.

Enable UDP listener in /etc/rsyslog.conf and allow in it’s config a remote ip/subnet address:

module(load="imudp")
input(type="imudp" port="514")
$AllowedSender TCP, 10.11.0.0/16

Here is how logs look like after this (and sure after configuring your server’s ip as a syslog server on the remote device). Most likely they will appear in /var/log/syslog :

Nov 25 15:39:19 10.11.13.102 [1: 0]RTP Tx Dn
Nov 25 15:39:19 10.11.13.102 [1: 0]ENC INIT 8
Nov 25 15:39:19 10.11.13.102 [1: 0]RTP Tx Up (pt=8->0a48000a:18076)
Nov 25 15:39:19 10.11.13.102 CC: Remote Resume
Nov 25 15:39:19 10.11.13.102 CC: Connected
Nov 25 15:39:19 10.11.13.102 RTP: SSRC changed 787a1882->1df25275
Nov 25 15:39:29 10.11.13.102 syscfg_update_hdlr!!!
Nov 25 15:39:29 10.11.13.102 syscfg_update_hdlr!!!
Nov 25 15:39:51 10.11.13.102 syscfg_update_hdlr!!!


To redirect logs from remote host with ip address 10.11.13.102 do the following:


Create /etc/rsyslog.d/11-linksys-gw.conf with the following lines:


if $fromhost-ip == '10.11.13.102' then /var/log/linksys-gw.log
& stop


Create /var/log/linksys-gw.log empty file. At least in Debian you need to chown root:adm for this file.

Finally, restart rsyslog daemon. After that all logs going from remote ip-address 10.11.13.102 will be stored in a separate file.

VirtualBox: if VM does not start from console

September 18th, 2023

Trying to start VM from console, but unsuccessful:

lexus@lexus-H110M-S2H:~$ vboxmanage startvm 21eaceac-f85e-4622-a52b-c586352aa9eb
Waiting for VM "21eaceac-f85e-4622-a52b-c586352aa9eb" to power on...
VBoxManage: error: The virtual machine 'centos7-ast-16' has terminated unexpectedly during startup because of signal 6
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

The solution is "--type headless" option:

lexus@lexus-H110M-S2H:~$ vboxmanage startvm 21eaceac-f85e-4622-a52b-c586352aa9eb --type headless
Waiting for VM "21eaceac-f85e-4622-a52b-c586352aa9eb" to power on...
VM "21eaceac-f85e-4622-a52b-c586352aa9eb" has been successfully started.

VirtualBox: mastering console usage, starting/stopping/restarting VMs, getting VM’s IP addresses

April 9th, 2023

A new post after nearly a year of lull!

Imagine the situation when there is some remote host machine with several VMs. You have an SSH access to host machine, but no VNC to manage easily those VMs, even doing the most elementary actions.

Listing all your VMs:

alexey@amd:~$ vboxmanage list vms
"centos7-orig" {e4077fae-1be5-42f4-ae40-b399f98c6e3d}
"debian9.rtpengine" {d2fb6655-29ab-4103-a70c-b7234c835a79}
"debian9.opensips1" {757f6235-27d4-470d-a461-c12fbfe0cfd7}
"debian9.opensips2" {09b11945-d696-409d-b90b-e5f2b5af6c4a}
"centos7-ast-16" {21eaceac-f85e-4622-a52b-c586352aa9eb}
"centos7-rtpengine8" {935a0191-a17e-4c95-8cf4-022f7ad1a398}
"centos7.osips3.2" {e39ddc59-70cc-4bcb-8f6d-3b6bd9e78d3d}
"centos7.osips3.2_node2" {ecb64a86-aa90-4f53-bd12-5bb253d02058}

Listing all your running VMs:

alexey@amd:~$ vboxmanage list runningvms

Starting VM (vm remains working even if you log out from host machine):

alexey@amd:~$ vboxmanage startvm centos7-ast-16
Waiting for VM "centos7-ast-16" to power on...
VM "centos7-ast-16" has been successfully started.

Stopping VM:

alexey@amd:~$ vboxmanage controlvm centos7-ast-16 poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

The more the better.

Now I would like to get the IP address of some VM. But there is no any way to do it until we use GuestAdditions. I mean that you’ve already started your VM with the appropriate console command and now need to log in via SSH, but you don’t know it’s IP address (e.g. in case of bridged network settings of the VM).

To be able to see VM’s IP address from host’s machine console, you have to install VitualBox to your guest machine. Then you need to “insert” an .iso containing GuestAdditions to your guest machine (the easiest way is to do it using VirtualBox GUI, but I’m sure there is also a console command).

If the VM’s cd-rom with this .iso is not mounted automatically, do it manually:

[root@flexisip ~]# mount /dev/cdrom /mnt/cdrom/

After that the .iso’s files are available:

[root@flexisip cdrom]# ls -l /mnt/cdrom/
total 47008
-r--r--r--. 1 root root      763 feb 20  2020 AUTORUN.INF
-r-xr-xr-x. 1 root root     6384 jan 14  2022 autorun.sh
dr-xr-xr-x. 2 root root      792 jan 14  2022 cert
dr-xr-xr-x. 2 root root     1824 jan 14  2022 NT3x
dr-xr-xr-x. 2 root root     2652 jan 14  2022 OS2
-r-xr-xr-x. 1 root root     4821 jan 14  2022 runasroot.sh
-r--r--r--. 1 root root      592 jan 14  2022 TRANS.TBL
-r--r--r--. 1 root root  4029558 jan 14  2022 VBoxDarwinAdditions.pkg
-r-xr-xr-x. 1 root root     3949 jan 14  2022 VBoxDarwinAdditionsUninstall.tool
-r-xr-xr-x. 1 root root  7474611 jan 14  2022 VBoxLinuxAdditions.run
-r--r--r--. 1 root root  9439232 jan 14  2022 VBoxSolarisAdditions.pkg
-r-xr-xr-x. 1 root root 16895432 jan 14  2022 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x. 1 root root   270840 jan 14  2022 VBoxWindowsAdditions.exe
-r-xr-xr-x. 1 root root 10000520 jan 14  2022 VBoxWindowsAdditions-x86.exe
-r--r--r--. 1 root root      259 oct  4  2021 windows11-bypass.reg

Now we need to install GuestAdditions to the guest machine (VM):

[root@flexisip ~]# cd /mnt/cdrom
[root@flexisip cdrom]# sh ./VBoxLinuxAdditions.run 
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.32 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
3.10.0-1160.88.1.el7.x86_64.

And now you can see VM’s IP address from your host machine console (NAT network settings):

alexey@amd:~$ VBoxManage guestproperty get centos-flexisip "/VirtualBox/GuestInfo/Net/0/V4/IP"
Value: 10.0.2.15

The same for bridged networking:

alexey@amd:~$ VBoxManage guestproperty get centos-flexisip "/VirtualBox/GuestInfo/Net/0/V4/IP"
Value: 192.168.88.239

More VM properties:

alexey@amd:~$ VBoxManage guestproperty enumerate centos-flexisip

But this command still does not show the IP address of the VM, though it shows its MAC:

alexey@amd:~$ vboxmanage showvminfo centos-flexisip

After this you may unattach an .iso from your VM cd-rom.