groovy for system administrators

28
Groovy for System Administrators Dan Woods London, Dec 2013

Upload: daniel-woods

Post on 17-May-2015

1.067 views

Category:

Technology


7 download

DESCRIPTION

Slides from my talk, "Groovy for System Administrators" at GGX 2013

TRANSCRIPT

Page 1: Groovy for System Administrators

Groovy for System AdministratorsDan Woods

London, Dec 2013

Page 2: Groovy for System Administrators

Groovy for System Administrators

About Me

@danveloper /danveloper

#[email protected]

Page 3: Groovy for System Administrators

Groovy for System Administrators

About Me

Page 4: Groovy for System Administrators

Groovy for System Administrators

“System Administration is a multi-faceted problem domain,

not dissimilar from programming.”

- Me, just now.

Page 5: Groovy for System Administrators

Groovy for System Administrators

At a high level...

Provisioning

Deployment

Management

Page 6: Groovy for System Administrators

Groovy for System Administrators

Provisioning

./“Building” the server

./Creating installation media

./Installing the server

Page 7: Groovy for System Administrators

Groovy for System Administrators

Deployment

./Getting our app on the server

./Making sure it runs there

./Managing environment dependencies

Page 8: Groovy for System Administrators

Groovy for System Administrators

Management

./Maintaining users

./Managing resource authorization

./Designing security

Page 9: Groovy for System Administrators

Groovy for System Administrators

“We need to rethink the way that we build and work with

server environments.” - Me, just now.

Page 10: Groovy for System Administrators

Groovy for System Administrators

Environment Considerations

./Disaster Recovery

./Auditing

./Testing (Test Network)

Page 11: Groovy for System Administrators

Groovy for System Administrators

Environment Considerations

Should be able to rapidly recover or reproduce an environment from

configuration and archives

Page 12: Groovy for System Administrators

Groovy for System Administrators

Programmatic Strategy

./Download install media

./Modify with kickstart

./Produce and archive reusable install media

Page 13: Groovy for System Administrators

Groovy for System Administrators

Build Servers with Gradle./“Version Control” the infrastructure

./Integrate with CI

./Archive “Builds” for recovery/regeneration purposes

./Whole environment build and deploy

Page 14: Groovy for System Administrators

Groovy for System Administrators

Provisioning Gradle Pluginhttp://github.com/danveloper/provisioning-gradle-plugin

Page 15: Groovy for System Administrators

Groovy for System Administrators

Provisioning and Deployment Through CI

“qa-web-server”

\--- application-services (rabbitmq) `-- build: jar, packaging: rpm `-- deployment: “Network Yum Repo”

\--- application-webapp (grails) `-- build: war, packaging: rpm `-- deployment: “Network Yum Repo”

Page 16: Groovy for System Administrators

Groovy for System Administrators

Authentication Hacking.with(Groovy)

Page 17: Groovy for System Administrators

Groovy for System Administrators

Pluggable Authentication Modules

* Account Details * Authentication * Password Changes * Session Interaction

Page 18: Groovy for System Administrators

Groovy for System Administrators

PAM Account & Authentication

./LDAP Integration (pam_ldap)

./Active Directory

./Radius

./etc...

Page 19: Groovy for System Administrators

Groovy for System Administrators

PAM Account & Authentication

Why not Spring Security from Grails?

Page 20: Groovy for System Administrators

Groovy for System Administrators

Pluggable Authentication Modules

pam_exec.so – allows an external script to provide for any layer of the PAM

stack

Page 21: Groovy for System Administrators

Groovy for System Administrators

PAM Account & Authentication w/ GrailsAdd to /etc/pam.d/login:

auth sufficient pam_exec.so debug expose_authtok /etc/security/onauthaccount sufficient pam_exec.so /etc/security/onaccount

Create /etc/security/onauth script and mark it executable:

#!/bin/shpass=`cat`;result=$(curl -s -d "user=$PAM_USER&pass=$pass" http://192.168.0.106:8080/grails-springsec/auth)if [ "$result" != "success" ]; then exit 1;else /usr/sbin/useradd $PAM_USER -m -k /etc/skel exit 0;fi

Page 22: Groovy for System Administrators

Groovy for System Administrators

Kernel Hacking.with(Groovy)

#include <linux/kernel.h>#include <linux/module.h>#include “groovy.h”

#define ITEM_1 “Kernel Space IPC with User Space Groovy”#define ITEM_2 “sys_call_table manipulation”#define ITEM_3 “syscall hacking for Groovy-defined ruleset”#define ITEM_4 “Groovy DSLs for every occasion!”

Page 23: Groovy for System Administrators

Groovy for System Administrators

Kernel Hacking The Kernel is modular, allows influence from

external sources

Provides a variety of “hooks” into nearly all aspects of the server and its state

Handling of logistical operations, like metrics and reporting

Influence over nearly all of the server’s operation

Page 24: Groovy for System Administrators

Groovy for System Administrators

Kernel Space IPC w/ User Space Groovy

Kernel Memory

Kernel Processes

Userland Memory

Userland Processes

procfs

netlink

mmap

udp

Page 25: Groovy for System Administrators

Groovy for System Administrators

Groovy ACL DSL for Filesystem Behavior

MKDIR

syscalltable

mkdir_code

filesystem

mkdir()

__NR_mkdirwrite the entry

Page 26: Groovy for System Administrators

Groovy for System Administrators

Groovy ACL DSL for Filesystem Behavior

MKDIR

syscalltable

originalmkdir_code

filesystem

mkdir()

__NR_mkdir

write the entry

interceptedmkdir_code

ok to mkdir?

yes?

no

Page 27: Groovy for System Administrators

Groovy for System Administrators

Kernel HackingOther Thing We Might Do...

Packet inspection (a la IDS)

Network manipulation (rewrite headers, compression, etc)

Tag packets, and correlate with process/application

User and application oriented metrics gathering

Page 28: Groovy for System Administrators

Groovy for System Administrators

try { “Groovy for System Administrators”()} finally { Utilize.groovy() as FullstackInfrastructureComponent}

The end.