Some tips for me and other

IIS + get configuration

get-website | ForEach-Object -Process { $xSite=”IIS:\sites\”+$_.Name cd $xSite $xSite $myWebApp=get-webApplication $myWebApp | Format-Table -AutoSize Path , @{Label= “anonim:” ; Expression = {(Get-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -Name Enabled -PSPath $xSite -location $_.Path).value }}, @{Label= “Basic:”; Expression = {(Get-WebConfigurationProperty -Filter /system.webServer/security/authentication/basicAuthentication -Name Enabled -PSPath $xSite -location $_.Path).value }}, @{Label= “ClientCert:”; Expression = {(Get-WebConfigurationProperty -Filter /system.webServer/security/authentication/clientCertificateMappingAuthentication -Name Enabled -PSPath […]

Centos + No more mirrors to try

yum clean all yum –disablerepo=\* –enablerepo=base,extras,updates update

Port forward with Windows 10

netsh interface portproxy add v4tov4 listenaddress= listenport=9000 connectaddress= connectport=80 netsh interface portproxy delete v4tov4 listenaddress= listenport=9000

Zabbix + certificates monitoring

There is the fine script and template for certificates monitoring. Just create the script, import the template and link it to the host. Monitoring SSL Certificates with Zabbix #! /bin/sh SERVER=$1 TIMEOUT=25 RETVAL=0 TIMESTAMP=`echo | date` if [ -z “$2” ] then PORT=443; else PORT=$2; fi EXPIRE_DATE=`echo | openssl s_client -connect $SERVER:$PORT 2>/dev/null | openssl […]

Pfsense + Zabbix + Temperature monitoring via com-port

pw usermod zabbix -G uucp Services: Zabbix Agent 4.2: Agent: Advanced: User Parameters: UserParameter=temperature, /root/digitemp_DS9097 -c /root/.digitemprc -q -t 0 | awk ‘{if ($7 == “85.00”) print “36”; else print $7}’ | bc Add a new item to a host as Numeric (float), a graph and a trigger.

ActiveMQ + Docker + network ports conflict

We got some errors like: When ActiveMQ started from the Docker container “Error starting userland proxy: Bind for unexpected Error response from daemon: failed to create endpoint SpinWay on network nat: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20). Solution: netsh int ipv4 […]

PFSense + ssh copy + keep authorized_keys after reboot

If you copy keys with: cat >> ~/.ssh/authorized_keys they will disappear after reboot. You have to add a key via Web GUI: System – Users – Edit user admin – add authorized keys from from your PC below.  

Powershell + string to array

An array is created with the -split operator. Like so, $myString=”Four score and seven years ago” $arr = $myString -split ‘ ‘ $arr # Print output Four score and seven years ago When you need a certain item, use array index to reach it. Mind that index starts from zero. Like so, $arr[2] # 3rd […]

Group policy + Account lockout audit

Found out the strange thing: my script for locked out accounts stopped working after 21 November 2018. I checked eventlog and didn’t see any 4740 events. After investigation I resolved it. It must be turned on there: Computer configuration/Policies/Windows Settings/Security settings/Advanced Audit Policy Configuration/Logon/Logoff/Audit Account Lockout Then I checked it: Auditpol /get /category:*

MDT + Script for joining to a domain

$strUser = “domain\user” $strDomain = “domain.local” $strPassword = ConvertTo-SecureString “password” -AsPlainText -Force $Credentials = New-Object System.Management.Automation.PsCredential $strUser, $strPassword $strOU = “OU=Computers,DC=domainn,DC=local” Add-computer -DomainName $strDomain -Credential $Credentials -OUPath $strOU

Previous Posts