Posts

Unifi Video Controller NVR for UNRAID

If you run UNRAID at home and you have a UniFi Camera system then check out my latest container….

https://hub.docker.com/r/superd/unifi-nvr/

A dockerised UniFi NVR

Ubiquiti UniFi-Video-Controller (NVR) – Docker Container

Ubuntu 16.04, UniFi-Video-Controller 3.8.3

Setup / Quick Start

docker run \
--net=host \
-v /var/lib/unifi-video/:<YOUR DATA DIR> \
-v /var/log/unifi-video/:<YOUR LOG DIR> \
superd/unifi-nvr

Troubleshooting

UNRAID - If you have issue with MongoDB continually restarting please check your data mapping. I have seen issues where user shares do not work correctly. Please try mapping direct to a single disk or to cache drive to ensure smooth operation.

my first few docker containers

This is my first dabbling in creating my OWN git hub (for the code) and docker hub (for the orchestration / build)

https://hub.docker.com/u/superd/

I have created a container for Unifi-Video NVR and storj. Yet to update documentation on Storj container.

I’m currently working on building containers for a news indexer, either newsnab or nzedb. There is another docker project called pynab which was an interesting idea, but seems to have gone stale over time. It used to be almost hands free indexer that ran reasonably efficiently. I’m hoping to re-create something similar soon.

netdata - live server metrics

If your looking for a really good opensource realtime resource monitoring tool check out netdata.io

Very light, looks great and is super fast. I have it running as a docker instance on my unraid server (which runs this website, and a couple of other docker instances).

If you want to show extra info about containers / docker running on your host add the following host mappings;

container <- host

/var/run/docker.sock  <–  /var/run/docker.sock /host/proc  <–  /proc /host/sys  <–  sys

Docker - Running Ubiquiti NVR and Plex

downloadBye bye virtual machines and their inherent OS bloat. Docker and containerization is here…

The trick to containerization is picking the right workload (as with most things). Think about data, its state and where it lives and whether there are any benefits to running as a container.

Both Ubiquiti’s NVR and Plex’s media server software run’s some base application, this app within its own container then maps to data (which can exist outside the instance) that is consistent.

eachine 250 quad racer - PIDs

download (2)Building a new FPV racer i have quickly found myself tweaking the firmware and PID settings. Here are some of best bits i have found around the Eachine 250 racer.

http://wikirotors.com/index.php?title=Eachine_Racer_250

Roll: Kp 0.0034 Ki 0.0119 Kd 0.000046

Pitch: Kp 0.00454 Ki 0.01589 Kd 0.000061

Yaw: Kp 0.00794 Ki 0.01509 Kd 0.000067

These are designed for use with a 1500 mAH Lipo mounted on the lower plate. Note: these are not tuned for use with Gopro or other camera.

change windows 2012 to core mode

downloadFound yourself considering hyper-v? Microsoft has come a long way and is now becoming more popular as a serious contender in the hypervisor area. My preference is still VMware, but some businesses may find their Microsoft allegiance makes hyper-v a valid option.

Note, i do not consider Microsoft a “cheaper” solution in any circumstance. The current state of hyper-v, SDN options, clustering and VMM management falls very short of what VMware has out of the box. Anyhow, if you do choose windows, here is how you remove the GUI - hopefully saving you a little bit of RAM and reducing the running footprint open for attacks and vulnerabilities….

Finding orphaned GPO policies

download (1)I’ve used the following attached script to find orphaned GPOs.

It can do the following;

  • GPOs that exist within SYSVOL but not within the GPO management console.
  • Also vice versa - GPOs in management console but not in SYSVOL.

Very handy. GPO Check

pc engine - pfsense as router / firewall

download (1)Just built a pfsense router on  a pc engine to replace my aging 7390 fritzbox…. Very very awesome and fast!

Perfect for UFB (ultra fast broadband) here in New Zealand - FTTH has arrived :)

I’m currently running these services on it (2 x 1GHZ cpu, 4GB RAM, 16GB msata SSD);

  • dhcpd - DHCP server
  • miniupnpd - UPnP server
  • ntpd - NTP server
  • squid - Transparent Proxy & Reverse Proxy
  • snort - IDS (Intrusion Detection System) / IPS (Intrusion Prevention System)
  • ssd - SSH server
  • unbound - DNS Server
  • ipsec - IPsec VPN (site to site VPN)
  • openvpn - Open VPN (client VPN)

Check these links for some great advise…

Creating a .pem with the Private Key and Entire Trust Chain

download (3)You may find you install a SSL cert, but certain browsers show the connection as unsafe (i.e. mobile browser has issues but desktop browsers are happy)

This generally points to not having the cert chain correct. You can check your cert chain at sites like -

https://ssltools.websecurity.symantec.com/checker/views/certCheck.jsp

https://www.sslshopper.com/ssl-checker.html

 

  1. Download your Intermediate and Primary Certificates.

  2. Open a text editor (such as notepad) and paste the entire body of each certificate into one text file in the following order:

    1. The Private Key - your_domain_name.key
    2. The Primary Certificate - your_domain_name.crt
    3. The Intermediate Certificate - gd_bundle_g2_g1.crt
    4. The Root Certificate - TrustedRoot.crt

    Make sure to include the beginning and end tags on each certificate. The result should look like this:

    -—-BEGIN RSA PRIVATE KEY—– (Your Private Key: your_domain_name.key) —–END RSA PRIVATE KEY—– —–BEGIN CERTIFICATE—– (Your Primary SSL certificate: your_domain_name.crt) —–END CERTIFICATE—– —–BEGIN CERTIFICATE—– (Your Intermediate certificate: DigiCertCA.crt) —–END CERTIFICATE—– —–BEGIN CERTIFICATE—– (Your Root certificate: TrustedRoot.crt) —–END CERTIFICATE—–

    Save the combined file as your_domain_name.pem. The .pem file is now ready to use.

unraid smart check - dead WD green drive

errors on unraid GUI - sometimes its a loose cable, sometimes its an issue with the drive.

Run this command to check smart status

smartctl -a -d ata /dev/sda or if you are using a newer SATA controller smartctl -a -A /dev/sda

http://lime-technology.com/wiki/index.php/Troubleshooting

unfortunately in my case, looks like drive is pretty much dead… not too bad for a drive almost 5 years old.

its pretty typical of a WD green drive in its default config to die in this type of environment, no plans to replace it with a similar type drive. You can see below the incredibly high LCC count which indicates the drive header has parked this many times over its life. This is probably part of the problem - there is a tool you can run (check this vid, link for  WDIDDLE3 also in comments - http://www.youtube.com/watch?v=J2eYyRI_F98) which disables the intellipark feature of the green drive. I never disabled the park timeout before this drive died (which defaults to 8 seconds!) – note: i have disabled it completely on my other green drives.

SQL Server Setup - Error code 0x84B30002

SQL Server Setup has encountered the following error: No feature were uninstalled during the setup execution. The requested features may not be installed. Please review the summary.txt logs for further details.

Error code 0x84B30002.

Follow the below steps it may help to uninstall, Before follow this procedure please make sure you have some idea about registry

1. Open Registry Editor 2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ 3. Browse Ids one by one and identify the GUIDs for SQL Server 2008 4. Run the below command for all SQL Server 2008 Guids one by one

SQL Express - Backup Plan

SQL express doesn’t have the luxury of SQL maintenance plans, but you can still write a SQL script to dump a database to a particular location and run it via task scheduler on a daily basis.

Create SQL query and save it to a particular location… (NightlyBackup.sql)

DECLARE @pathName NVARCHAR(512)

SET @pathName = ‘D:\SQL Backup\database_’ + Convert(varchar(8), GETDATE(), 112) + ‘.bak’

BACKUP DATABASE [database] TO DISK = @pathName WITH NOFORMAT, NOINIT, NAME = N’db_backup’, SKIP, NOREWIND, NOUNLOAD, STATS = 10

ERROR: No forward-proxy ports configured

I had the above issue after a squid upgrade and after changing from http_port 3128 transparent to http_port 3128 intercept.

Add “http_port 8080” line to squid.config to avoid this message, if you are not already using that port.

The changes in security require that a separate port be setup for forwarding proxy requests

nginx - and gzip

i only have vdsl at home and host my website via it… the following graphs shows when nginx started serving faster than the vdsl connection could handle (which is about 9Mbits)

ngnix with cache enabled, gzip enabled and set to 6

http://loadimpact.com/load-test/sigtar.com-6a246200e28f354c64582cf2c0b6ce46

ngnix with cache enabled, gzip enabled and set to 9 (maximum)

http://loadimpact.com/load-test/sigtar.com-1422b3e7250c4e3acb7868177f2b2056

ngnix with cache disabled, gzip enabled and set to 9 (maximum)

http://loadimpact.com/load-test/sigtar.com-19561e7422e24f35fb557c662d20beac

nginx - setup as reverse proxy

Previously to take down this wordpress site all you needed to do was hold down F5 for about 20 seconds then the site would take about 5 mins to recover.

There were a few factors causing this and quite a few different methods to solving the problem. Wordpress itself is run on php / apache, apache has an evasive mod which can block certain IPs depending on the defined abusive behavior (typical DDOS attack). Since i like to run a few websites behind a single IP i looked at fixing the issue closer to the perimeter….

setup vmware environment

vmwareOne of the scripts i use to standardise our vmware host deployments;

# Author : Darren T # v1 : Setup vcenter parameters # Usage ; # Please manually connect to vCenter, use "Connect-VIServer" -- this promotes usernames and passwords not being saved with script. # Modify Variables below before running. # ------------------- VARIABLES ------------------------- # Database Retention Policy $Days_Retension = "30" # Set SMTP Server & Sender Account $SMTP_Server = "192.168.9.10" $Sender_Account = "[email protected]" # ------------------- CODE ONLY BELOW ------------------- # Database Retention Policy -- Enable limits # Get-AdvancedSetting -Entity $defaultVIServer | where {$_.Name -match "^task.|^event."} Write-Host "Setting Database Retension... " -NoNewLine; Get-AdvancedSetting -Entity $defaultVIServer -Name "event.maxAge" | Set-AdvancedSetting -Value $Days_Retension -Confirm:$false Get-AdvancedSetting -Entity $defaultVIServer -Name "event.maxAgeEnabled" | Set-AdvancedSetting -Value $true -Confirm:$false Get-AdvancedSetting -Entity $defaultVIServer -Name "task.maxAge" | Set-AdvancedSetting -Value $Days_Retension -Confirm:$false Get-AdvancedSetting -Entity $defaultVIServer -Name "task.maxAgeEnabled" | Set-AdvancedSetting -Value $true -Confirm:$false # Set SMTP Server & Sender Account Write-Host "Setting SMTP Server & Sender Account... " -NoNewLine; Get-AdvancedSetting -Entity $defaultVIServer -Name "mail.smtp.server" | Set-AdvancedSetting -Value $SMTP_Server -Confirm:$false Get-AdvancedSetting -Entity $defaultVIServer -Name "mail.sender" | Set-AdvancedSetting -Value $Sender_Account -Confirm:$false

activate windows from command line - slmgr

Temporarily extend evaluation period (limited execution - see output below)…

C:\Windows\System32>cscript slmgr.vbs /rearm

C:\Windows\System32>shutdown -r -t 1

Show detailed license information…

C:\Windows\System32>cscript slmgr.vbs /dlv

License Status: Initial grace period Time remaining: 43200 minute(s) (30 day(s)) Remaining Windows rearm count: 0

Activate windows…

C:\Windows\System32>cscript slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

C:\Windows\System32>cscript slmgr.vbs /ato

Will require access to the internet - most of the time the issues are either time sync or connectivity to internet.

Active Directory- redirect default Containers to Organisational Units

One really useful tidbit I picked up last week –

Redirusr & redircmp

Configures the default OU for computers and users so they don’t appear in the default containers when they are added (effectively meaning they only get root domain policies).

As you would guess – it helps keep the default AD containers clean by placing machines straight into an OU and also applying any policies attached.

windows 2012 change key from evaluation to standard

get current version;

dism /online /get-currentedition

Deployment Image Servicing and Management tool Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Current edition is:

Current Edition : ServerStandardEval

dism /online /set-edition:ServerStandard /ProductKey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /AcceptEula

Deployment Image Servicing and Management tool Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Starting to update components… Starting to install product key… Finished installing product key.

Removing package Microsoft-Windows-ServerStandardEvalEdition31bf3856ad364e35amd64~~6.2.9200.16384 [==========================100.0%==========================] Finished updating components.

Starting to apply edition-specific settings… Finished applying edition-specific settings.

The operation completed successfully. Restart Windows to complete this operation. Do you want to restart the computer now? (Y/N)