Loading...

Change all users to an alternate domain suffix

In Active Directory users and computers, right click Queries> New. Give it a name, click “define query”. Stay on the “Users” tab. Select “Is not” and type an invalid name like testtesttest. Click ok, ok. It should return a result with all users whose name is <<not>> testtesttest. Select all, right click> Properties. Go to Account tab> check “UPN Suffix” and change it to the appropriate suffix. That’s it! There are PowerShell methods to do this too but when handling hundreds of user accounts, you have to be absolutely careful in PowerShell. There are solutions online that work fine that I am not going to post here. This is purely for the GUI. Good luck!

Exchange and AD Powershell Useful Commands

I’ve had a few odd issues & tasks with Exchange 2010 and AD recently and wanted to take a moment to document them as well as the command used to resolve the issue:

The following command was useful to resolve an issue of multiple copies of the same shared mailbox showing where only one would allow access and the other copies would only fail to open.

Add-MailboxPermission -Identity <shared mailbox alias> -User <your mailbox alias> -AccessRights FullAccess -InheritanceType All -Automapping $false

The following will find all active user accounts whose Password Never Expires attribute is set to true formatted in a nice table of username and the value. Value is not really necessary because it should only return true, but everyone loves a sanity check right?

get-aduser -filter * -properties Name, PasswordNeverExpires | where { $_.passwordNeverExpires -eq "true" } | where {$_.enabled -eq "true"} | Format-Table -Property Name, PasswordNeverExpires -AutoSize

Set up Blue Iris Surveillance software with IFTTT

I have two cameras in which I’d like to always have a notification for if I’m not home. Initially I set this up to always send me an alert but I’m sure as you can imagine, my phone blew up with me walking around. Blue Iris has a neat feature which is simply a traffic light. If red, it will disable various things including recording (not desired for me in this case), but it can also disable alerts. I selected to only disable alerts if the traffic light is red. In the past, I had never used this feature. So here’s a brief how-to.

Click settings button and modify the settings as illustrated.

Set User Account that will perform this action.

Set Traffic Signal to Alerts Only

Verify web server port & disable Secure only for the web server

  1. On your server computer (Blue Iris Windows machine), install something like WAMP or XAMPP to handle web requests.
  2. After install set up a script similar to this one in PHP (create a php file with the name of your choice and .php extension):
    1. After you’ve created the script, drop it in your HTDOCs directory in WAMP or XAMPP
      1. For example, my directory is here: C:\Bitnami\wampstack-7.1.19-0\apache2\htdocs
<?php
$home = $_GET['home']; //get and set variable for the home status.
$my_file = 'log.txt'; //store logs so we know if our server is being used improperly and by whom

if($home == 'true')
{
	$handle = fopen($my_file, 'a') or die('Cannot open file:  '.$my_file);
	$data = date("Y.m.d.h.i.s") . ' on requesting ip: ' . $_SERVER['REMOTE_ADDR'] . ' Request to set RED.' . "\r\n";
	fwrite($handle, $data);
	fclose($handle);
	file_get_contents("http://10.1.1.99:8080/admin?user=admin&pw=password&signal=1");
	echo "home";
}
elseif($home == 'false')
{
	$handle = fopen($my_file, 'a') or die('Cannot open file:  '.$my_file);
	$data = date("Y.m.d.h.i.s") . ' on requesting ip: ' . $_SERVER['REMOTE_ADDR'] . ' Request to set GREEN.' . "\r\n";
	fwrite($handle, $data);
	fclose($handle);

	file_get_contents("http://10.1.1.99:8080/admin?user=admin&pw=password&signal=1");
	echo "away";
}
else
{
		
	$handle = fopen($my_file, 'a') or die('Cannot open file:  '.$my_file);
	$data = date("Y.m.d.h.i.s") . ' on requesting ip: ' . $_SERVER['REMOTE_ADDR'] . ' FAILED REQUEST!!! Request: ' . $home . "\r\n";
	fwrite($handle, $data);
	fclose($handle);
	echo "invalid";
	//donothing
}
?>
  1. Now let’s explain the URL in there so you can get an idea of what is happening and how Blue Iris is interpreting it. http://10.1.1.99:8080/admin?user=admin&pw=password&signal=1
    1. Where 8080 is the port you’ve set blue iris to
    2. User is the user account you create in Blue Iris
    3. PW is the password for said account (recommended to restrict this account down to admin tasks only not viewing rights or anything else).
    4. Signal is the traffic symbol where 1 is active (green) and 0 is inactive (red).
  2. Now if you browse to your local host URL 127.0.0.1/myphpfile.php?home=false you should have a value returned. In this case, you should see “away” in your web browser. If you see this, that means your PHP script is working. Blue Iris at this point should also change the animation in the traffic symbol.

  3. Let’s take a moment to understand all of what just happened and why. You set up a web server with a script to change the alert status on the local Blue Iris machine. Now you’ll need to expose the web server to the internet (or if your security aware, you may also set it to only work with IFTTT IP addresses). This step I will not outline as there are too many router combinations, but you need to port forward to your web server.
  4. IFTTT is super easy! Just log in, select Location for the “this” (set up an enter an area and set it appropriately for your home) and a “that” with a webhook in which you will put in your IP/ domain so something like x.x.x.x:PORT/myphpfile.php?home=true for enter and home=false for exit. You will create 2 webhook applets, one for enter and one for exit, each with the appropriate URL.

This guide is somewhat advanced as it assumes you know/ can port forward and you have a static IP or a domain set to change with your IP.

InvoiceNinja Install CentOS with Apache

This application is quite useful for tracking payments. This quick tip is going to only go over the app installation for self-hosted versions (not setting up a server from scratch).

What you need to have:

  1. A CentOS server and Apache with PHP updated to version 7 or greater. (By default you usually get PHP 5.6. You may need to manually update this to 7. There are tutorials online for this)
  2. Knowledge or Google-Fu on Virtual Hosts with Apache
  3. Basic knowledge on moving files/ editing files within a Linux system.

What you need to do:

  1. Download the files. You can do this through commands like wget on the box or download it from www.invoiceninja.com on a Windows box and upload it to your web server.
  2. Extract the files either on your linux box or before uploading them through a utility like Filezilla
  3. Move (mv) the files to your web directory (IE: /var/www/html)
  4. I tend to put the application under a folder called ninja and modify permissions/ owner appropriately. Modify/ create a Virtual host for 80 and 443 pointed to the directory /var/www/html/ninja/public.
  5. cd /var/www/html/ninja
  6. composer install
  7. composer update
  8. Now when you navigate to your URL (IE: website.com or web.site.com), you’ll get the setup prompts.

Remember & Note

  • The .env is your settings file. It’s required to connect to any existing database if you are doing an update. If you update, please move this file to the new folder you upload.
  • Composer is a utility that will download necessary dependencies that Ninja will need to run. I tend to run these two commands every time I update the software to get the latest and greatest versions of all the dependencies.

 

Exchange ActiveSync Inheritable Permissions not checked

This issue came up the other day when attempting to get Exchange 2010 ActiveSync profile set up with an iPhone. The behavior was the phone would read the account information and act like it was ready for you to start syncing but when you went into the Mail app, it would say cannot get mail. It turns out this is a very simple permissions issue of the user account not inheriting permissions. This article does an amazing job of explaining it.

Exchange ActiveSync and Inheritable Permissions issue

Why Google’s GSuite?

Google has a ginormous pair of pants. No matter how much you tell it to stop eating, it just keeps getting bigger and bigger. When I was maybe 8 years old, I recall signing up for a Gmail account. This was just after you could sign up without having to have an invitation to do so (yeah, it wasn’t public before, it was invitation only). After signing up, I thought it was plain compared to Yahoo! and I didn’t like the interface. It was the most basic HTML you’ve ever seen (and can still see if you click the link in your Gmail while it’s loading). Over time, I saw chat get added, new tools become available. The interface got a serious face-lift (and has since seen yet another face-lift with even more simplicity). It’s an ever evolving product of products.

The most amazing additions in my opinion were some things by the names of Google Docs and Google Sheets. What’s not to love? As an IT guy, I’m absolutely in love with the fact that it’s browser based (less worry of installing apps), it’s feature rich and getting better all the time. It’s affordable with a Gmail address – FREE and even cheaper than Office365 at just $5 for a basic user. Hosted email, free Office Suite, Drive online storage? How can you really go wrong?

Now admittedly for the power Excel users, you may find some limitations. Even some Word features are lacking a bit. Even still, I don’t take back my comments above about the benefits. I’ve seen bugs in Microsoft Office products that I never see in Google’s suite of products. The products continue to grow. For the fact that it’s purely browser based as well blows me away. So I’ll walk away to buy Google another box of Twinkies to help maintain that large pant size because the days of installing Microsoft Office on hundreds of PCs is dwindling away into a browser based world. And for those true Microsoft Die Hards, the free Office online still does a great job and stacks up nicely against the Google “Office Suite”. They’ve done a great job at carrying that same look and feel of their offline product into the web browser.

VMWare – Formatting a drive

So I have a host with ESXI 6.5. I put in a spare laptop hard drive I had laying around just to store some files on. I wouldn’t recommend a laptop drive in a corporate or production environment, but in my personal “home use” case, this will be just fine. I won’t be streaming from this drive either, just data at rest really. So I powered down the host and put in the new hard drive. I turned it back on and the ESXI web GUI kept crashing when I was trying to add the drive. I searched for a bit and tried deleting partitions. Nothing seemed to work. I found a resolution by completely formatting the drive using mklabel. See below for details. Here was the error:

Error: Both the primary and backup GPT tables are corrupt.  Try making a fresh table, and using Parted's rescue feature to recover partitions.

  1. SSH into your ESXI Host.
  2. Type: ls /vmfs/devices/disks/
  3. Find the disk in question. I’ve found that VMWare does a pretty good job of labeling it by the drive tray it is in, but this may not always be the case. There are some VMWare articles you will want to reference to verify you are making changes to the right disk. This is especially true for a production machine that you have live data on. The last thing you want to do is delete production data.
  4. In my case, this was the disk name: mpx.vmhba1:C0:T1:L0 
  5. Now let’s get to the formatting!
  6. Run this: partedUtil mklabel /vmfs/devices/disks/mpx.vmhba1:C0:T1:L0 gpt

Here are some of the articles I used to determine which drives needed to be formatted:

  • https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1036609
  • https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1008886

WannaCry

Have you ever tried to open a can without a can opener? It’s at that very moment you realize the person that made a device to open metal cans is a genius while the guy that put it in a can in the first place without a pop top should be arrested immediately. WannaCry and it’s variants are very similar in this way. They created a phenomenal product to squeeze money out of people. Viruses, trojans, and other malware are not new to the PC world. They already cause issues for end users on a daily basis. Why not add a payment component to it?

With all that said, being in my position as the IT System Administrator for several companies, I have to ensure machines are protected with anti-malware, and that each workstation is updated. Thankfully, of all the machines we manage, not one device acquired WannaCry. The variations are inevitable and I cannot speak for those since they are likely being developed as I type this. It does feel good knowing we have the multi-layer security set up to prevent such a malicious attack like the one by WannaCry.

While I, as the IT Systems Administrator, feel the creators should be “arrested immediately” like the human who invented cans without pop top lids, I also think it is one of the most creative malware programs I’ve seen so far. This of course is not the first ransomware product to come out, but it is the first one to gain this much publicity.

 

 

Updating InvoiceNinja on Windows Bitnami Install (Also works with Linux)

This guide will show you how to update your Bitnami NinjaInvoice Stack on Windows to the latest. Note: This did work with no issues going from 2.5.2.2 to 2.9.1 which is the current version as of today. For Linux, review steps 6-12.

  1. Navigate to C:\Bitnami\invoiceninja-2.5.2.2-0\apps\invoiceninja\htdocs
  2. Download the latest copy of InvoiceNinja from https://www.invoiceninja.com/self-host/
  3. Extract the contents of the freshly downloaded zip file
  4. I suggest renaming the HTDOCS folder before doing this… it creates an extra step or two but it might be worth it.
  5. Create a new htdocs folder
  6. Paste all of the contents of the downloaded zip file into the folder (or www\ninja folder for Linux).
  7. Go to your OLD install and copy the .env in the root directory to your new folder. This is the file that contains settings such as database connection settings.
  8. Go to your url with /update at the end. IE: www.mywebsite.com/ninja/update
  9. Wait a while for the upgrade.
  10. It should say successful. In a new tab, attempt to browse to the page! Should be updated and good to go.

Note: Bitnami no longer supports InvoiceNinja. You may have a hard time finding a copy. It’s relatively easy to install on Centos with Apache in my experience. The documentation for install is pretty great too.

Swap Domain Controller

I was tasked with moving the domain controller to another server so the license for the Server Essentials 2012 could be re-purposed for a specific software program. This also removed the 25 user restriction limit of Server Essentials. I had to first virtualize the environment which is another story altogether. So here’s what I had to do:

  1. Install the Server 2012 Standard
  2. Install the Active Directory Role — the process is pretty straightforward
  3. Point DHCP server to the new Server Install IP for DNS.
  4. Verify a few clients have picked up the new IP over the next few days. It will take time to renew the IP leases. I didn’t uninstall the DNS role from the Essentials copy anyhow so this wasn’t mandatory for me.
  5. Open Active Directory Users and Computers on the new DC
  6. Right click and choose Operations Masters. Click change on each tab.
  7. Open Active Directory Domains and Trusts, right click the root node and click Operations Master. Click Change.
  8. Open cmd as admin and type regsvr32 schmmgmt.dll and push enter
  9. Type mmc and push enter
  10. File> Add/Remove snapin, Find Active Directory Schema snap-in and open it
  11. Right click the new snapin, click Change Active Directory Domain Controller…
  12. Click on your new DC and click OK. You’ll get a message, don’t worry about it.
  13. Right click again on the snapin and click Operations Master… Click Change
    1. Change grayed out? Make sure you are a schema admin member in AD Users/ Groups. Log off and back on.
  14. Run dcdiag /a to verify everything is ok and proceed to demoting your old DC.

 

This is a great tutorial as well:

Transferring FSMO Roles