Using Azure App Service Certificate for Apache on an Ubuntu VM

Posted by Quinn Madson | Posted in | Posted on 3:07 PM

0


The process of getting my Azure cert to work on an Azure VM seems needlessly complicated and took forever to figure out so, I'm documenting it here. The Powershell script provided by Microsoft produces a console screen full of red errors. I debugged some of them but, never could get the thing to work.

Azure Key Prep

  • Login to portal.azure.com
  • Search for the KeyVault that contains your App Service Certificate and open it.
    • Under Settings, go to Secrets
    • Open the certificate
    • Open the Current Version
    • Click 'Download as a certificate' to download your PFX file.
  • Download and install Win32 OpenSSL Light: https://slproweb.com/products/Win32OpenSSL.html
  • To extract the private key from a .pfx file, run the following OpenSSL command: 
    • openssl.exe pkcs12 -in myAzureKeyVault.pfx -nocerts -out privateKey.pem
  • The private key that you have extracted is encrypted. To decrypt: 
    • openssl.exe rsa -in privateKey.pem -out server.key
  • To get the corresponding Server Certificate: 
    • openssl.exe pkcs12 -in myAzureKeyVault.pfx -clcerts -nokeys -out server.pem

Apache Setup

  • SCP your certs to your VM:
    • /etc/ssl/certs/server.pem
    • /etc/ssl/private/server.key
  • SSH into your VM:
    • sudo a2enmod ssl
    • cd /etc/apache2/sites-available
    • sudo cp default-ssl.conf 000-default-ssl.conf
    • sudo vi 000-default-ssl.conf
      •  SSLCertificateFile      /etc/ssl/certs/server.pem
      •  SSLCertificateKeyFile /etc/ssl/private/server.key
      • (Configure ServerAdmin, Document Root and any other Apache directives you need.)
    • sudo a2ensite 000-default-ssl
    • sudo /etc/init.d/apache2 restart
  • In the Azure Portal, open your VM and go to: Settings >> Networking >> Inbound Port Rules >> Add Inbound Port Rule
    • Source: Any
    • Source port ranges: *
    • Destination: Any
    • Destination port ranges: 443
That should be all you need to get it up and running.

Raspberry PI File Sharing with a Mac

Posted by Quinn Madson | Posted in | Posted on 6:02 PM

0


From the Raspberry Pi terminal or SSH into the Pi:
  1. sudo apt-get update
  2. sudo apt-get install netatalk
  3. sudo /etc/init.d/netatalk stop
  4. sudo vi /etc/netatalk/AppleVolumes.default
    1. Change this line: :DEFAULT: options:upriv,usedots
    2. To this line: :DEFAULT: options:upriv,usedots,rw
  5. sudo /etc/init.d/netatalk start

On a mac connected to the same network: Finder >> Go >> Connect to Server >> Browse. Double-click on the hostname of your Raspberry Pi and click the "Connect as" button. Enter your username and password for the Raspberry Pi and you should see the share contents.

If you cannot browse to the Raspberry Pi: Finder >> Go >> Connect to Server. For server address, put in: afp://[IP ADDRESS OF PI] so, for example: afp://192.168.10.129 and click the "Connect" button.

Add more shares:
  1. sudo vi /etc/netatalk/AppleVolumes.default
  2. Go to the bottom of the file (hit G in vi) and add new paths under: 
    1. ~/                      "Home Directory" 
  3. Example:
    1. /media              "Media"
    2. /mnt                  "Mount"

Mac Optimizations

Posted by Quinn Madson | Posted in | Posted on 10:59 AM

0

Reduce transparency effects 
System Preferences >> Accessibility >> Display >> Reduce transparency (On)

Switch off automatic graphic switching 
System Preferences >> Energy Saver >> Automatic graphics switching (Off)
(Turn this back on if using battery power for long periods.)

Tune Mission Control
System Preferences >> Mission Control >>   
Automatically rearrange Spaces based on most recent use (Off)
Displays have separate Spaces (Off)
Dashboard (Off)

Fix disk permissions, reset System Management Controller, reset PRAM

Setting Raspberry Pi for a Static IP

Posted by Quinn Madson | Posted in | Posted on 4:20 PM

0

sudo -s

cd /etc/network
cp interfaces interfaces.bak
nano interfaces

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

reboot

Mounting Raspberry Pi SD Card on a Mac (with Write Access)

Posted by Quinn Madson | Posted in | Posted on 3:50 PM

0

Download and install: Fuse for OS X (Make sure to check: MacFUSE Compatibility Layer)
Download and install: fuse-ext2
Open Terminal
Type: sudo nano -c /System/Library/Filesystems/fuse-ext2.fs/fuse-ext2.util
Press: [CONTROL W]
Type in: function mount [ENTER]
Arrow down to:

OPTIONS="auto_xattr,defer_permissions"
Change it to:
OPTIONS="auto_xattr,defer_permissions,rw+" 
Press [CONTROL X]
Press [Y]
Press [ENTER]
Plug in the SD Card!

Using SQLite with Railo CFML Server

Posted by Quinn Madson | Posted in | Posted on 5:56 PM

2

I've been building a web app that analyzes data from an application called Ultimate Racer used to control the race track circuit for slot car racing. Ultimate Racer conveniently keeps all of it's data in a SQLite database.

However, getting the SQLite database to work with Railo was a little problematic so, I'm documenting the process here in the event that I need to do it again or someone else is googling how to make it happen.

First, you need the SQLite JDBC driver for Railo. I ran into a bunch of dead links so, I dropbox'd the file here: http://dl.dropbox.com/u/472577/sqlite-jdbc-3.7.2.jar

Place the JAR in your Railo installation under: /PATH/TO/RAILO/lib/ext/sqlite-jdbc-3.7.2.jar

Restart Railo after copying the driver. Go into the Railo Web Administrator and go to "Datasource".

Put in the name of your datasource, for type select Other - JDBC, and click Create.


Scroll down to Class and type in: org.sqlite.JDBC
For DSN type in: jdbc:sqlite:/PATH/TO/SQL/DB/FILE



Click Create and you should be all set.





Korg Monotron Repair Mod

Posted by Quinn Madson | Posted in | Posted on 2:33 PM

1

Due to a series of unfortunate events, the surface mounted 1/8 jack was torn off of the board of this Korg Monotron analog synth. I decided to try and tie into the existing onboard speaker to allow the synth to still connect to external speakers or mixer. 

I drilled a small hole on the left side to allow wires into the enclosure.
I noted the wires so that if pulled, the solder joints won't be stressed.

I ran the new line-out red line into the existing solder joint for the onboard speaker.

I desoldered the black line to the onboard speaker. I made a joint between the new line-out black line, the  speaker black line, and a new jumper.

All soldered together and bit of heat shrink.
Connected the switch (momentary - normally off) to the original speaker black line solder joint and to the jumper from above.
All put together with the switch mounted and a lesbian adapter on the 1/8 inch male plug end.


Here is a video of the synth put back together and operating. First part of the video (~20 secs) is demoing the momentary switch activating the onboard speaker. The rest is using an external speaker system.