HAProxy: redirect http traffic to https

Within HAProxy it is possible to redirect all http traffic to https.It is sufficient to add the following rule within the frontend section: frontend incoming80 bind 10.1.1.13:80 redirect scheme https if !{ ssl_fc }

Read More

HAProxy: configure transparent proxy

If you configure HAProxy by default, the backends will receive the IP address of the HAProxy as incoming IP address. Some applications (or people) don’t want that. It is possible to configure haproxy as transparent proxy, so that the IP…

Read More

Avamar: Query postgresql db

[email protected]:~/>: psql -p 5555 -U viewuser mcdb mcdb=>   Example query:     SELECT * FROM “public”.”v_clients”;     SELECT v_clients.cid, v_clients.client_name, v_clients.client_addr,v_clients.os_type FROM “public”.”v_clients”;        select client_name,status_code,domain FROM v_activities_2 WHERE (status_code=30901 or status_code=30915) and recorded_date_time > current_timestamp…

Read More

PowerShell: using grep alike command

In Powershell, you can also use a grep like you can do on Linux. In order to search for a string in a file, you can use the following command: sls “Searchthisstring” “C:\myfile.log” -ca If you want to have the…

Read More

ModSecurity: Mod Security rules for wordpress/joomla/drupal

You can use the following mod_security rules for wordpress/joomla/drupal ## Rules for the CWP ## SecRuleRemoveById 910006SecRuleRemoveById 950000SecRuleRemoveById 950001SecRuleRemoveById 950005SecRuleRemoveById 950006SecRuleRemoveById 950117SecRuleRemoveById 950907SecRuleRemoveById 958039SecRuleRemoveById 958051SecRuleRemoveById 958291SecRuleRemoveById 959006SecRuleRemoveById 959151SecRuleRemoveById 960008SecRuleRemoveById 960010 SecRuleRemoveById 960011 SecRuleRemoveById 960012 SecRuleRemoveById 960035 SecRuleRemoveById 960335 SecRuleRemoveById 960904 SecRuleRemoveById 960915 SecRuleRemoveById 970003 SecRuleRemoveById 970015 SecRuleRemoveById 970903 SecRuleRemoveById 973301 SecRuleRemoveById…

Read More

SQL-Server: Get Server – Edition – Instance Name with T-SQL

  The following t-sql statement returns the server name, server instance, instance, edition & version of the running SQL-Server.   SELECT SERVERPROPERTY(‘MachineName’) AS [ServerName], SERVERPROPERTY(‘ServerName’) AS [ServerInstanceName], SERVERPROPERTY(‘InstanceName’) AS [Instance], SERVERPROPERTY(‘Edition’) AS [Edition], SERVERPROPERTY(‘ProductVersion’) AS [ProductVersion], Left(@@Version, Charindex(‘-‘, @@version) -…

Read More

Avamar: spawn after execve errno:8 code 8: Exec format error

When running pre/post scripts, it is possible that you are getting the following error message: 2017-03-20 19:43:43 avtar Info <5916>: Executing run-at-start ‘;2017-03-20 19:43:43 avtar Info <6033>: Begin STDERR from run-at-start:avspawn::spawn after execve errno:8 code 8: Exec format error  …

Read More

Linux: run commandline internet speed test

There are different possibilities to run internet speed tests from Linux (and unix) commandline. But personally I don’t always want to install extra applications on the servers.Because of that, I use the following command line. The only thing what is…

Read More

Java: Start profiler

Add the following options to the java: -Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.port=8010-Dcom.sun.management.jmxremote.local.only=false-Dcom.sun.management.jmxremote.authenticate=false-Dcom.sun.management.jmxremote.ssl=false

Read More

Linux: Clear systemd log

You can use the following command, as superuser, to clear the systemd logs: Keep the last 7 days: journalctl –vacuum-time=7d Keep the last 100Mb: journalctl –vacuum-size=100M      

Read More

Powershell: Check when a LOCAL user was last logged in.

Within Powershell you can also see when a LOCAL user was last logged in.This can be done with the following one-liner: $([ADSI]”WinNT://$env:COMPUTERNAME”).Children | where {$_.SchemaClassName -eq ‘user’} | ft name,lastlogin example output: name lastlogin —- ——— {localadmin} {28/09/2016 08:57:19} {nx}…

Read More

Powershell: Find files larger than XXX

With Powershell you can also find files which are larger than a certain size.This can be accomplished with the command below.In this example we are looking for files larger than 100MB, on the C drive. Get-ChildItem c:\ -Recurse | Where-Object…

Read More

Powershell: Open TCP listener port

If you want to test a firewall rule, while the application isn’t ready yet, you can start that port on the Windows server using Powershell.This way you can test the firewall functionality.Those actions can be done with the following commands:…

Read More

Powershell: get TCP counters for IPv4

Performance issues. Everybody had them once, and more 🙂If you are using Windows 2012+ and Powershell, you can use the Get-Counter command in order to provide you more information regarding the TCP connections.In the example below, we are getting the…

Read More

Powershell: Set global dns searchlist

  If you want to configure the DNS suffix search list on Windows 2012+, you can use the set-DnsclientGlobalSetting command, as shown in the example below.This will set the DNS search list to “domain.local”: set-DnsClientGlobalSetting -SuffixSearchList  @(“domain.local”)    

Read More

Postfix: Clear postfix mail queue

Is your postfix mail queue full of spam? You are not the only one 🙂 In that case it could be interesting to clear your queue, before the spam gets send out. In order to remove all mail from the…

Read More