hacker summit 2013 tot rhns api

Upload: mgarg

Post on 02-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    1/14

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    2/14

    Begin Programming Your RedHat Network Satellite Server

    George Hacker

    Curriculum Manager, Red Hat, Inc.June 14, 2013

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    3/14

    Session/Unit Goals

    Upon completion o t!i" unit, #ou "!ould $e a$le to%

    &e"cri$e t!e practical u"e" or t!e Red Hat 'et(ork )*I

    Gi+e an o+er+ie( o $a"ic RH' )*I program "tructure

    Modi# and (rite "imple program" u"ing t!e RH' )*I

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    4/14

    RHN Application Programming Interace

    )pplication programming interace pro+ided $# RH'

    Red Hat 'et(ork )*I u"e"%

    Cu"tom uerie"

    Reporting )utomated RH' admini"tration

    Red Hat 'et(ork )*I unctionalit# continue" to e-pand

    +er# /atellite "er+er !a" rele+ant )*I documentation !ttp%satellite.fqdnr!napidoc

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    5/14

    Supported Programming !anguages

    ork" (it! language" (it! MR*C client "upport

    Mo"t common language" u"ed are *erl and *#t!on

    *erl

    Reuire" perl5rontierR*C package

    'o additional reuirement" or *#t!on

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    6/14

    RHN API Program Structure

    *rogram" (!ic! u"e t!e RH' )*I !a+e a con"i"tentpattern

    Connect to t!e /atellite "er+er +ia MR*C li$rar#

    In mo"t ca"e", aut!enticate a" a +alid u"er

    'ormal /atellite "er+er permi""ion"role" appl#

    *erorm uerie" and operation" o intere"t

    og out 6onl# (!en aut!enticated7

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    7/14

    API "et#ods $ RHN Sotware/Server Admin

    api

    *ro+ide" getVersionand systemVersionmet!od"

    preferences

    Met!od" or locale and time8one coniguration

    proxy

    *ro+ide" met!od" to manage RH' *ro-ie"

    satellite

    *ro+ide" RH' /atellite management met!od"

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    8/14

    API "et#ods $ User/%rgani&ation "anagement

    auth

    *ro+ide" login and logout met!od"

    org

    *ro+ide" met!od" or 9rgani8ation management

    user

    *ro+ide" met!od" or RH' u"er admini"tration

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    9/14

    API "et#ods $ '#annel "anagement

    channel

    *ro+ide" met!od" or managing /ot(are C!annel"

    configchannel

    *ro+ide" met!od" or Coniguration C!annel management

    errata

    *ro+ide" met!od" to manage RH' errata

    packages

    Met!od" t!at "earc! or and delete" package" (it!in RH'

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    10/14

    API "et#ods $ S(stems "anagement

    activationkey

    *ro+ide" met!od" or managing )cti+ation :e#"

    kickstart

    *ro+ide" met!od" to manage kick"tart proile"

    schedule

    Met!od" to "earc! and manage "c!eduled e+ent"

    system

    *ro+ide" met!od" or uerie" and management o regi"tered "#"tem"

    systemgroup

    *ro+ide" met!od" or /#"tem Group admini"tration

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    11/14

    Sample Perl Script

    #!/usr/bin/perluse Frontier::Client;

    my " $ %https://satellite&example&com/rpc/api%;my user $ %rhn'username%;my pass $ %rhn'pass(ord%;

    my client $ ne( Frontier::Client)url $* "+;my session $ client'*call)%auth&login%, user, pass+;

    my systems $ client'*call)%system&listser-ystems%, session+;

    foreach my system ).systems+ print system'*%name%0&12n1;0

    client'*call)%auth&logout%, session+;

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    12/14

    Sample P(t#on Script

    #!/usr/bin/pythonimport xmlrpclib

    " $ 1https://satellite&example&com/rpc/api1user $ 1rhn'username1ps(d $ 1rhn'pass(ord1

    client $ xmlrpclib&-erver)", verbose$3+session $ client&auth&login)user, ps(d+

    list $ client&user&list4assigned4system4groups)session, user+for group in list: print group&get)%name%+

    client&auth&logout)session+

  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    13/14

    Practice )*ercise $ RHN API Programming

    og into #our (ork"tation

    U"ername% "tudent

    *a""(ord% "tudent

    RH' /atellite credential" U"ername% "ummitXX

    *a""(ord% red!at

    /ample "cript" a+aila$le !ttp%"atellitepu$r!napi

    5ollo( !andoutin"truction"

    ork (it! #our neig!$or"

    I all el"e ail", a"k;

    minute"

    http://satellite/http://satellite/
  • 8/10/2019 Hacker Summit 2013 Tot Rhns API

    14/14

    +#ank You or Attending,