A monorepo that uses the AWS Cloud Development Kit to deploy and configure nanomdm on AWS lambda.

Overview

NanoMDM on AWS

This repo builds and configures a nanomdm server to run on AWS lambda. It uses the Cloud Development Kit and tries to follow best practices. It uses 4 stacks:

  • SharedInfrastructure: configures a shared VPC instance
  • MDMServerStack: configures API Gateway, nanomdm in a lambda function, and a backend EFS filesystem
  • SCEPServerStack: configures API Gateway, scep server in a lambda function, and a backend EFS filesystem
  • MDMProfileServer: generates a simple enroll.mobileconfig file on S3 the devices can download

WARNING: EFS requires a NAT gateway IP to be run permanently, and these stacks create two of them, which can get costly. Watch your AWS bill. EFS isn't a great long-term solution for this.

Architecture

The project structure follows the AWS Well-Architected Framework by organizing the project directory structure into logical units (e.g. SCEP Server, MDM Server, etc). Each unit should have a directory and include the related infrastructure, runtime, and configuration code. I used this recommendation as guidance.

|-- mdmserver
|   |-- infrastructure.ts
|   |-- nanomdm                 # NanoMDM server (forked and submoduled)
|-- scepserver
|   |-- infrastructure.ts
|   |-- scep                    # MicroMDM's SCEP server (forked and submoduled)
|-- mdmProfileServer
|   |-- infrastructure.ts
|-- app.ts                      # main app entrypoint
|-- cdk.json                    # tells the CDK CLI how to deploy our app
|-- shared_infrastructure.ts    # infrastructure shared by multiple stacks

Installation and setup

Prerequisites

Make sure that you've run init and update for the submodules:

  • git submodule update --init --recursive

Prerequisites:

  • Install Docker Desktop
  • Install the AWS CLI
  • Configure the AWS CLI: aws configure
  • Install the CDK CLI: npm install -g aws-cdk
  • Install all NPM modules: npm install
  • Install Go

Configure your servers

Before building and deploying, you'll want to prepare your keys and secrets.

  • add four files to the secrets folder: scep_ca.key, scep_ca.pem, apns_push.key, apns_push.pem. See SECRETS for details on the required secrets.
  • update the cdk.context.json's local stanza with your own parameters. The CDK will use this when starting servers, generating profiles, etc.

Note that we do not rely on the scep server to generate its own public cert/private key; we pass it in to provide more control over it.

Build & Deploy

The first time you build/deploy your App into an AWS account, you need to bootstrap your environment: cdk bootstrap.

Then we need to synth and deploy the SCEP and MDM server stacks first, because the profile server relies on the URL endpoints to be generated:

  • cdk synth MDMServerStack SCEPServerStack
  • cdk deploy MDMServerStack SCEPServerStack

After that, synth & deploy the full app with cdk synth && cdk deploy --all.

The deploy output should contain a bunch of useful variables (server urls and whatnot) you can use for testing.

Testing basic functionality

The deploy should output a MDMProfileServerStack.mdmProfileUrl. That's the location of the enrollment profile that you can test installing.

To test that the servers are doing the right thing, try this:

  • test SCEP server: curl '<SCEP_SERVER_URL>/scep?operation=GetCACert' | openssl x509 -inform DER
  • test MDM server: curl '<MDM_SERVER_URL>/version'

Config MDM Server for push notifications

The MDM server needs the APNS push certs to be able to speak to devices. Following this guide, you'll need to do this next:

cat ./secrets/apns_push.pem ./secrets/apns_push.key | curl -T - -u 'nanomdm:<API_PASSWORD>' '<MDM_SERVER_URL>/v1/pushcert'

And you can test it's working with this:

./mdmserver/nanomdm/tools/cmdr.py -r | curl -T - -u 'nanomdm:<API_PASSWORD>' '<MDM_SERVER_URL>/v1/enqueue/<DEVICE_ID>'

You might also like...

Lumos is an AWS Lambda visualizer and open source alternative to AWS CloudWatch.

Lumos is an AWS Lambda visualizer and open source alternative to AWS CloudWatch.

Lumos Lambda Metrics Visualizer Table of Contents About Lumos Techologies Used Getting Started Key Lambda Metrics How to Contribute License Contributo

Nov 5, 2022

Everynode allows you to run any version of Node.js in AWS Lambda, in any commercial AWS region

Everynode allows you to run any version of Node.js in AWS Lambda, in any commercial AWS region

Run Any Node.js Version in AWS Lambda Everynode allows you to run any version of Node.js in AWS Lambda, in any commercial AWS region. We add support f

Dec 15, 2022

local docker-compose environment to deploy and configure backoffice

backoffice-local local docker-compose environment to deploy and configure backoffice How to install To install the repo dependencies yarn install be s

Dec 15, 2022

Create deployment files and configure GitHub Actions workflows to deploy applications to Azure Kubernetes Service (AKS).

Create deployment files and configure GitHub Actions workflows to deploy applications to Azure Kubernetes Service (AKS).

Azure Kubernetes Service (AKS) DevX (Developer experience) Extension for Visual Studio Code (Preview) The AKS DevX extension for Visual Studio Code (P

Oct 1, 2022

Service Installer for VMware Tanzu is a one-click automation solution that enables VMware field engineers to easily and rapidly install, configure, and operate VMware Tanzu services across a variety of cloud infrastructures.

Service Installer for VMware Tanzu Service Installer for VMware Tanzu seeks to provide a one-click automation solution to enable our VMware engineers

Dec 1, 2022

Remix TypeScript monorepo with Turborepo pipelines, Prisma, PostgreSQL, Docker deploy to Fly.io, pnpm, TailwindCSS and Tsyringe for DI.

Remix TypeScript monorepo with Turborepo pipelines, Prisma, PostgreSQL, Docker deploy to Fly.io, pnpm, TailwindCSS and Tsyringe for DI.

Remix template with Turborepo, TypeScript and pnpm. The remix app deploys to fly.io or build to Docker image. Example packages for Database with prisma, Tsyringe dependency injection, UI, and internal TypeScript packages.

Dec 29, 2022

Speed up the your micro-frontend development. Configure less and delivery more.

Speed up the your micro-frontend development. Configure less and delivery more.

React Micro Speed up the your micro-frontend development. Configure less and delivery more. You don't need to waste more time trying to change your ap

Nov 7, 2022

a stack-separated way to bringing together common AWS services useful in a fullstack application that uses AWS Amplify libraries

Fullstack CDK Helpers This project helps developers create common AWS services that are useful in creating fullstack applications. Backend services ar

Nov 26, 2022

AWS Lambda and API Gateway, simplified for Javascript

AWS Lambda and API Gateway, simplified for Javascript

alanajs AWS Lambda and API Gateway, simplified for JavaScript About alanajs Make setting up Lambda microservices easier than ever. alanajs is a free,

Aug 1, 2022
Owner
Stevie Clifton
Stevie Clifton
MerLoc is a live AWS Lambda function development and debugging tool. MerLoc allows you to run AWS Lambda functions on your local while they are still part of a flow in the AWS cloud remote.

MerLoc MerLoc is a live AWS Lambda function development and debugging tool. MerLoc allows you to run AWS Lambda functions on your local while they are

Thundra 165 Dec 21, 2022
AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository -> https://www

awsrun 35 Dec 17, 2022
Deploy an Architect project from GitHub Actions with keys gathered from aws-actions/configure-aws-credentials

Deploy an Architect project from GitHub Actions with keys gathered from a specific AWS IAM Role federated by an IAM OIDCProvider. CloudFormation to cr

Taylor Beseda 4 Apr 6, 2022
For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker. We will create a frontend, a backend, and a database to deploy the Pulumipus Boba Tea Shop. Along the way, we'll learn more about how Pulumi works.

Kat Cosgrove 9 Dec 29, 2022
Cloudy is a set of constructs for the AWS Cloud Development Kit that aim to improve the DX by providing a faster and type-safe code environment.

cloudy-ts These packages aren't yet published on npm. This is still highly experimental. Need to figure out a few things before releasing the first ve

Cristian Pallarés 5 Nov 3, 2022
Sample code for resizing Images with Lambda@Edge using the Custom Origin. You can deploy using AWS CDK.

Resizing Images with Lambda@Edge using the Custom Origin You can resize the images and convert the image format by query parameters. This Lambda@Edge

AWS Samples 16 Dec 11, 2022
Under the Sea is an official AWS workshop delivered by AWS SAs and AWS Partners to help customers and partners to learn about AIOps with serverless architectures on AWS.

Under the Sea - AIOps with Serverless Workshop Under the Sea is an exciting MMORPG developed by the famous entrepreneur behind Wild Rydes, the most po

AWS Samples 4 Nov 16, 2022
Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Panacloud Multi-Cloud Internet-Scale Modern Global Apps 89 Jan 3, 2023
A serverless AWS expense tracker API. AWS Lambda functions, API gateway, and Dynamodb are among the ingredients.

AWS-Serverless-API A serverless AWS expense tracker API. AWS Lambda functions API gateway Dynamodb Endpoints Create a new expense: Method: POST Body f

Ondiek Elijah Ochieng 1 Jul 16, 2022