May 12, 2016

Azure - Connect ExpressRoute from a different subscription

  1. Login-AzureRmAccount
  2. Select-AzureRmSubscription -SubscriptionId SUB_THAT_HAS_THE_EXPRESSROUTE_CIRCUIT
  3. $circuit = Get-AzureRmExpressRouteCircuit -Name "ExpressRoute-Sydney-ARM-Private" -ResourceGroupName "Azure-rgrp-ProdPrivate"
  4. Add-AzureRmExpressRouteCircuitAuthorization -ExpressRouteCircuit $circuit -Name "ClientConnect-AustraliaEast-Internal-Auth"
  5. Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $circuit

  1. select-azurermsubscription -SubscriptionId SUB_THAT_WANTS_TO_CONNECT
  2. $id = "/subscriptions/xxxxxxxx-8cd4-40ea-876c-be3bdf0a89af/resourceGroups/Azure-rgrp-ProdPrivate/providers/Microsoft.Network/expressRouteCircuits/ExpressRoute-Sydney-ARM-Private"  
  3. $gw = Get-AzureRmVirtualNetworkGateway -Name "CC-AustraliaEast-Internal-vnetgw" -ResourceGroupName "CC-Prod-Private"
  4. $connection = New-AzureRmVirtualNetworkGatewayConnection -Name "ExpressRoute-Sydney-Connection-CC-AE" -ResourceGroupName "CC-Prod-Private" -Location "AustraliaEast" -VirtualNetworkGateway1 $gw -PeerId $id -ConnectionType ExpressRoute -AuthorizationKey "xxxxxx-92a1-48b4-a520-ea02f8ec2acf"

Installing Powershell for use with Azure


  • Install Powershell Modules Preview from https://www.powershellgallery.com/
  • Run Powershell as Administrator
  • At the powershell command line:

# Install the Azure Resource Manager modules from the PowerShell Gallery
Install-Module AzureRM

# Install the Azure Service Management module from the PowerShell Gallery
Install-Module Azure  

References:

  • https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/ 

May 10, 2016

Ripe Atlas Graph

May 02, 2016

Flexget iwth Systemd in Ubuntu 15 & 16

Assumptions:

Config & DB Location: /etc/flexget/
User: debian-deluged
Group: debian-deluged

chown -R debian-deluged:debian-deluged /etc/flexget

nano /etc/systemd/system/flexget.service

[Unit]
Description=Flexget Daemon
After=network.target
[Service]
Type=simple
User=debian-deluged
Group=debian-deluged
UMask=022
WorkingDirectory=/etc/flexget/
ExecStart=/usr/local/bin/flexget --logfile /var/log/flexget.log --loglevel verbose daemon start
ExecStop=/usr/local/bin/flexget daemon stop
Restart=Always
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target

systemctl enable flexget.service
systemctl start flexget

April 26, 2016

Install StartSSL Cert on Postfix

Remove key from key file:

openssl rsa -in xxx-multihost.key -out /etc/ssl/xxx.xxx.xxx/xxx-multihost.key.unencrypted

copy 1_root_bundle from ApacheServer.zip to /etc/ssl/startssl-ca-bundle.pem
copy 2_blah from ApacheServer.zip to /etc/ssl/xxx.xxx.xxx/xxx-multihost.crt

in Main.cf

smtpd_tls_CAfile = /etc/ssl/startssl-ca-bundle.pem
smtpd_tls_cert_file = /etc/ssl/xxx.xxx.xxx/xxx-multihost.crt
smtpd_tls_key_file = /etc/ssl/xxx.xxx.xxx/xxx-multihost.key.unencrypted

restart postfix "service postfix restart"

test using:

http://www.checktls.com/perl/TestReceiver.pl?FULL

Install StartSSL Certificate on Dovecot IMAP Server

wget http://www.startssl.com/certs/sub.class1.server.ca.pem -O sub.class1.server.ca.pem

cat www_certificate.pem sub.class1.server.ca.pem > /etc/ssl/certs/dovecot.pem

cat www_privatekey.pem > /etc/ssl/private/dovecot.pem

chown root:ssl-cert /etc/ssl/private/dovecot.pem

chmod 644 /etc/ssl/private/dovecot.pem

chown root:root /etc/ssl/certs/dovecot.pem

chmod 444 /etc/ssl/certs/dovecot.pem

In /etc/dovecot/conf.d/10-ssl.conf

ssl_cert_file = /etc/ssl/certs/dovecot.pem

ssl_key_file = /etc/ssl/private/dovecot.pem

wget http://www.startssl.com/certs/ca.pem -O /tmp/ca.pem

openssl s_client -CAfile /tmp/ca.pem -connect mail.example.org:993

February 03, 2016

init.d check if mount point exists

# Exit if mount point does not exist
if [ ! -s "/media/media-dupe/freenas" ]; then
  echo "Mount Point not Found"
  exit 0
fi