OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard [email protected].

55
OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard [email protected]

Transcript of OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard [email protected].

Page 1: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

OPS-11: OpenEdge® and OS Security

Gus BjörklundWizard

[email protected]

Page 2: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation2

Please interrupt if you have a question.

Page 3: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation3

“Be brief, for no discoursecan please when too long.”

Miguel de Cervantes

Page 4: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation4

“When I try to be brief,I become obscure.”

Quintus Horatius Flaccus

Page 5: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation5

Topics

Background Starting a Database Server Connecting To a Database Stopping a Database Database Utilities Advice

Page 6: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation6

Background

Page 7: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation7

Basic Database Environment

db files

shared memory space

dbserver(s)

otherfiles

server

client

4GL code

4gl client

4GL code

4gl client

4GL code

jvm

java codejdbc driver

TCP/IP

remote 4GL apps

remote Java appsself-serving 4GL apps

server machine

Page 8: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation8

OpenEdge and OS Security

The OpenEdge RDBMS is architected, designed, and implemented to be installed, started, run, and stopped under the system

administrator’s account

Security best practices recommend NOT running an application under the system administrator’s account.

OpenEdge 4GL applications can and should be run under normal user accounts.

Page 9: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation9

800 lb gorilla

Why Run As The System Administrator

Can control any process (stop, owner, … )

Authenticate to user accounts

Ignore resource access controls

Ignore process limits

Ignore system limits

The administrator is the 800 lb gorilla in the forest

Page 10: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation10

Why Not to Run As the System Administrator

IT denies access to administrator account

Prohibited by company policies or standards

A non-auditable group account

It is dangerous …• Bypass system protections• Provides limitless hacking opportunities

Sometimes the forest cannot support an 800 lb gorilla

Page 11: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation11

Comparing UNIX & Windows Administrators

S-1-5-32-544(Administrators)

system-dependentA member of the administrator’s group

member of groupS-1-5-32-544

user-id = 0An administrator when

SID = S-1-5-18(LOCAL_SYSTEM)

N/AThe built-in1 system account when

SID =S-1-5-domain-500(Administrator)

uid = 0(superuser2)

The administrator when:

WindowsUNIX

You are:

1. Cannot log into built-in Windows accounts

2. superuser is the “root” account on Mac OS X, Linux, and UNIX

Page 12: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation12

UNIX and Linux user ID’s

Each process has 6 id’s• real user id real group id

• effective user id effective group id

• saved user id saved group id

Child (fork’ed) processes inherit these

Page 13: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation13

UNIX/Linux exec()

exec() of a program uses process’ 6 id’s UNLESS• setuid bit of program file is on

– effective and saved uid set to that of file owner• setgid bit of program file is on

– effective and saved gid set to that of file group

Program executes with different privileges than the invoking user• NOT the user’s real or effective uid/gid• could be higher or lower !

Page 14: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation14

UNIX, Linux authorisation and access control

root (superuser), users, groups no-login accounts for daemons, etc. file and directory

• protection masks (rwx for owner, group, other)• access control lists

Login authentication (PAM)• user name, password or others• NIS, LDAP, SecurId, Kerberos, others (custom too)

Limits on• processes, subprocesses• memory (address space, paging space, shared mem)• file handles, sockets, etc.

Page 15: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation15

Windows authorisation and access control

Same as UNIX, plus• Login authentication

– User-name, Windows domain, password– Active Directory, SAM, others

• Registry Access Control Lists (ACL)• Windows Services privileges• Windows Services – desktop restrictions

Also, like UNIX, limits on file handles, memory,processes, etc.

Page 16: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation16

Comparing Access Control Systems

Registry ACLs-----Windows registry

Object ACLsowner, group, other read/write

Shared memory

File system ACLsowner, group, other rwx permissions, and ACLs

File system

Service ACLsdaemonWindows service

WindowsUNIX

UNIX daemons and Windows servicesare essentially the same thing

Page 17: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation17

UNIX File & Directory access

File Directory

Set user IDSet group ID

Set effective user IDSet effective group ID

No effectset new file group ID

User readUser writeUser Execute

User readUser writeUser execute

User read directoryUser remove/create filesUser search in PATH

Group readGroup writeGroup Execute

Group readGroup writeGroup execute

Group read directoryGroup remove/create filesGroup search in PATH

Other readOther writeOther Execute

Others readOthers writeOthers execute

Others readOthers writeOthers execute

Page 18: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation18

Comparing UNIX & Windows File Access

merged user & group file permissions

process effective

group id

Group readGroup writeGroup execute

owner file permissionsprocess effective

user id

User readUser writeUser execute

N/AN/AN/A

Others readOthers writeOthers execute

WindowsUNIX

Page 19: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation19

UNIX/Linux Interactive User Login Example

System Library /etc/nsswitch.conf

NISdatabases

passwd/<shadow>

PAM Library

/etc/pam.conf

/bin/login

Local OS LDAP RSA

Page 20: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation20

Windows Login

Page 21: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation21

Windoze Interactive User Login Example

System Library Registry

ActiveDirectory

SAM

GINA .dll

Winlogin

Local OS LDAP RSA

Page 22: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation22

Starting a Database Server

(running _mprosrv)

Page 23: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation23

OpenEdge Admin Server

System Library nsswitchconfiguration

NISdatabases

passwd/<shadow>

jvmStart

AdminServer (user connection)

[Active Directory] [SAM]

[Registry]

_proapsv/_progress

(AppServer)(WebSpeed)

creates

_mprosrvcreates

ubroker(java)

creates

Page 24: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation25

Database Server Has To Be Able To

Load shared libraries Open database files (ai, bi, and data extents) Create or open database .lg file Create shared memory and semaphores Raise its ulimit, ignore process size limit Read, write, expand the files Create and use sockets Spawn subprocesses (servers) Send signals to all connected processes

Page 25: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation26

Installed OpenEdge programs

OpenEdge installer is run as root• executable files are owned by root

• Installer turns setuid bit ON for many programs

• Few actually require it !!!

executing a setuid root program such as _mprosrv or _progres causes it tostart executing with

root’s privileges (uid 0, group 0)

Page 26: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation27

Starting the Database Server:

_mprosrvreal uid: 123effective uid: 0real gid: 678effective gid: 0

_mprosrv

set user id: 0set group id: 0

user shellreal uid: 123effective uid: 123real gid: 678effective gid: 678

OS

Sys

tem

Lib

rary

Page 27: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation28

But: IF _mprosrv has

Instead of default setuid root:• change to setuid progress (user 233)

• change to setgid dbadmin (group 543)

Page 28: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation29

Starting the Database Server:

_mprosrvreal uid: 123effective uid: 233real gid: 678effective gid: 543

_mprosrv

set user-id: 233set group-id: 543

user shellreal uid: 123effective uid: 123real gid: 678effective gid: 678

OS

Sys

tem

Lib

rary

when NOT setuid root

Page 29: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation30

Starting the Database Server:Database File Access Controls

OS Security System

Database Files

user-access(123)

group-access(555)

others-access

user readuser write

user execute group readgroup write

group execute other readother write

other execute

UNIX WindowsACL: allow

o:<sid>:<perm…>

g:<sid>:<perm…>

g:<sid>:<perm…>

g:<sid>:<perm…>

_mprosrveffective uid: 123effective gid: 543

Page 30: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation31

Starting the Database Server:Buffer-pool Access Controls

OS Security System

Shared-memory

user-access(123)

group-access(555)

user readuser write

group readgroup write

UNIXWindows

ACL: allowo:<sid>:<rw>

g:<sid>:<rw>

g:<sid>:<rw>

g:<sid>:<rw>

_mprosrv

real uid: 123.db owner 123

group 555

Page 31: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation32

Starting the Database Server:Changing System File Limits

OS System Library

_mprosrv

hard file-size x 2GBhard number-files y …

.db

.db

.db

file-size

number-files

system ulimitshard file-sizehard number-files…

Page 32: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation33

Connecting To a Database

(running _progres

self-serving on local system)

Page 33: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation34

User has to be able to

Execute _progres (or _prowin) Run OpenEdge 4GL programs Interact with 4GL programs Update data in the database

• via 4GL programs only

print, email, etc. depending on application

Page 34: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation35

Users should NOT be able to

Modify any executables or shared libraries Read, copy, or modify any production database files Run any database utilities Start or stop database servers Read or modify other users files Change configuration files Sometimes we want:

• no access to shell or other programs,• _progres started automatically when user logs in to

system Touch database server machines !

Page 35: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation36

Disaster

Page 36: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation37

Self-serving client Has To Be Able To

Load shared libraries Open database files Connect to shared memory and semaphores Read and write database files Read .p, .r, and other files Create new .r files Create temporary files Map shared procedure library files etc.

Page 37: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation38

Starting Self-service ABL Clients:Connecting to the Buffer-pool

OS Security System

Shared-memory

user-access(123)

group-access(555)

_progres

effective uid: 0effective gid: 0

Page 38: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation39

_progresreal uid: 245effective uid: 0 245real gid: 597effective gid: 0

Starting the ABL Clients: Removing Privileges

Lowers uid after startup parameters executed

Cannot re-set to a more privileged state

Does not lower group-id

[Does not remove privileges or ACEs]

OpenEdge _progres:

Page 39: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation40

Connecting To a Database

(running _progres

with network connection)

Page 40: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation41

User has to be able to

Execute _progres Run OpenEdge 4GL programs Interact with 4GL programs Communicate with server over network print, email, etc. depending on application

Page 41: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation42

Network Client Has To Be Able To

Load shared libraries Read and write database files Read .p, .r, and other files Create new .r files Create temporary files Map shared procedure library files etc.

NO special privileges required

Page 42: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation43

What about AppServers,

and WebSpeed® ?

Page 43: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation44

Shutting Down A Database

(running _mprshut)

Page 44: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation45

Stopping The Database

_mprosrvreal uid: 123effective uid: 0real gid: 678effective gid: 0

_mprshutreal uid: 123effective uid: 0real gid: 678effective gid: 0

OS

Sys

tem

Lib

rary

Signal Signal

Ope

nEdg

e

IPC IPC

eq

Page 45: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation46

About Database Utilities

Page 46: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation47

Database utilities need to be able to

Load shared libraries Open database files Connect to shared memory and semaphores Read and write database files Create and delete database files Create temporary files

Page 47: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation48

Offline Database Utilities

Many utilities can run in single-user mode(and some have to)

(e.g. database is offline)• Index rebuild

• Offline backup

• procopy

• etc.

Connect same way as single-user _progres

Page 48: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation49

Online Database Utilities

Many utilities can be run online (e.g. database is in multi-user mode)

• dbanalysis• prostrct add• dbtool• online backup• etc.

Connect same way as self-serving _progress

Page 49: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation50

Advice

Page 50: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation51

Advice

Keep things simple Don’t mix AdminServer & command-line

database utilities Do administration locally to avoid user

authentication issues• OR: Use ssh for remote access

(putty on Windows)

Start with nothing is allowed

Page 51: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation52

Advice: Break the Administrator Habit

Develop access control plan

Know requirement for bypassing system limits

Use your own user accounts and groups

Make maximum use of group level access

Reserve root access to install, updates & emergencies

Use the “sudo” utility

Page 52: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation53

Advice: Learn sudo

sudo can be used to• allow limited root access• allow limited access to other accounts• limit access to specific commands

sudo can• log usage• log attempted usage• email when unauthorised attempts are made

config file: /etc/sudoers Read the man page Example:

sudo more /etc/sudoers

Page 53: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation54

Best Practices

Start with changing file & group ownership• Take away group and world access from

– database files– database directories– backup files and directories– archived ai files and directories

Take away world xrw from database utilities Create a database admin group

• Add set-group-id to $DLC/bin as appropriate

Page 54: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation55

In Summary

Server security requirements are increasing

OpenEdge security depends on the OS security system

Administrator requirements are few,

and there are alternativemethods

Page 55: OPS-11: OpenEdge ® and OS Security Gus Björklund Wizard gus@progress.com.

© 2008 Progress Software Corporation56

OS SecurityReferences:

NSA Guides:http://www.nsa.gov/snac/

Securing RedHat Linuxhttp://www.nsa.gov/notices/notic00004.cfm?Address=/snac/os/redhat/rhel5-guide-i731.pdf

Securing Windows Server 2003http://www.nsa.gov/notices/notic00004.cfm?Address=/snac/os/win2003/MSCG-001R-2003.pdf

Questions