home *** CD-ROM | disk | FTP | other *** search
/ ftp.ib.com / 2003-04-09_ftp.ibm.com-os2.zip / tools / dss / secrep.tcl
Text File  |  1996-09-30  |  6KB  |  154 lines

  1. # host rpcprofile setup tcl script
  2. # must be logged in as cell_admin to execute
  3. # example: dcecp setprofile.tcl hostname
  4.  
  5. if {($argc != 2) && ($argc != 1)} {
  6.     puts stdout " "
  7.     puts stdout "Usage: <fullhostname> slim (if host is a slim client)"
  8.     exit
  9. }
  10. set hostname [lindex $argv 0]
  11.  
  12. # ********** setup slim client profile directory ***********************
  13.  
  14. if {$argc == 2 } {
  15.     set slimarg [lindex $argv 1]
  16.     if ![string match slim $slimarg] {
  17.        puts stdout " "
  18.        puts stdout "Invalid usage of second argument"
  19.        puts stdout "Usage: <fullhostname> slim (if host is a slim client)"
  20.        exit
  21.     }
  22.     puts stdout " "
  23.     puts stdout "Enter the LAN profile for slim client $hostname"
  24.     set profilename [gets stdin]
  25.     set profilename /.:/$profilename
  26.     set status [catch {directory list /.:/slim.hosts} dirlist]
  27.     if {$status == 0} {
  28.        if {[string match "*$hostname*" "$dirlist"]} {
  29.           puts stdout "The directory structure /.:/slim.hosts/$hostname already exists"
  30.        } else {
  31.           puts stdout " "
  32.           puts stdout "Creating directory structure for slim.hosts $hostname"
  33.           directory create /.:/slim.hosts/$hostname     
  34.        }
  35.     } else {
  36.        puts stdout " "
  37.        puts stdout "Creating directory structure for slim client $hostname"
  38.        directory create /.:/slim.hosts
  39.        directory create /.:/slim.hosts/$hostname
  40.     }
  41.     set status [catch {rpcprofile show /.:/slim.hosts/$hostname/profile -i 6f264242-b9f8-11c9-ad31-08002b0dc035,1.0} profile]
  42.     if {$status == 0} {
  43.        puts stdout " "
  44.        puts stdout "Slim client $hostname already has a pointer to the following LAN profile(s)"
  45.        puts stdout "$profile"
  46.        puts stdout " "
  47.        puts stdout "Do you want to overright it, y or n"
  48.        set overright [gets stdin]
  49.        while {(($overright != "y") && ($overright != "n"))} {
  50.           puts stdout " "
  51.           puts stdout "ERROR invalid entry type y or n"
  52.           set overright [gets stdin]
  53.        }
  54.        if {$overright == "y"} {
  55.           catch {rpcprofile list /.:/slim.hosts/$hostname/profile} profiles
  56.           foreach e [lrange $profiles 0 end] {
  57.              catch {rpcprofile remove                \
  58.                                  -i 6f264242-b9f8-11c9-ad31-08002b0dc035,1.0  \
  59.                                  -m $e                \
  60.                                   /.:/slim.hosts/$hostname/profile  }
  61.           }
  62.        }
  63.     }
  64.     if {($status != 0) || ($overright == "y")} {
  65.        puts stdout " "
  66.        puts stdout "Creating a pointer to $profilename for slim client $hostname"
  67.        set status [catch {rpcprofile add -a LAN                      \
  68.                            -i 6f264242-b9f8-11c9-ad31-08002b0dc035,1.0     \
  69.                            -m $profilename             \
  70.                            -p 0                        \
  71.                            /.:/slim.hosts/$hostname/profile          \
  72.                            } msg]
  73.        if {$status == 0} {
  74.           puts stdout " "
  75.           puts stdout "A pointer to $profilename for slim client $hostname was added"
  76.        } else {  
  77.             puts stdout "ERROR: $msg"
  78.        }
  79.     }
  80. } else {
  81. # ****************  Gets Host Profile Name  *****************************
  82.   set hostfound ""
  83.   foreach i [directory list /.:/hosts] {
  84.     if {[string match "*$hostname*" "$i"]} {
  85.       set hostfound "true"
  86.       set proflist [rpcprofile list $i/profile]
  87.     }
  88.   }
  89.   if {$hostfound != "true"} {
  90.     puts stdout " "
  91.     puts stdout "ERROR bad host name"
  92.     puts stdout "Usage: <fullhostname> slim (if host is a slim client)"
  93.     exit
  94.   }
  95.   foreach p [lrange $proflist 0 end ] {
  96.     if !([regexp "cell-profile" $p]) {
  97.       set profilename $p
  98.     }
  99.   }
  100.   if {$profilename == ""} {
  101.      puts stdout " "
  102.      puts stdout "ERROR no host profile for $hostname"
  103.      exit
  104.   }
  105.   puts stdout " "
  106.   puts stdout "LAN profile for $hostname is $profilename"
  107. }
  108. # ***************  Get List of Security Servers  ***********************
  109.   set svrlist [rpcgroup list /.:/sec]
  110.   set master [rpcgroup list /.:/sec-v1]
  111.   puts stdout " "
  112.   puts stdout "The master security server is $master"
  113.   puts stdout " "
  114.   puts stdout "The avaliable security servers are:"
  115.   puts stdout "$svrlist"
  116.   puts stdout " "
  117.   set i 0
  118.   set proplist ""
  119.   foreach s [lrange $svrlist 0 end] {
  120.     puts stdout "Enter priority for $s (0-7)"
  121.     set priority [gets stdin]
  122.     while {(($priority < "0") || ($priority > "7"))} {
  123.        puts stdout " "
  124.        puts stdout "ERROR priority out of range Enter (0-7)"
  125.        set priority [gets stdin]
  126.     }
  127. # ***************  add rpcprofile to host profile *********************
  128.     puts stdout " "
  129.     puts stdout "Enter y to add priority $priority for $s "
  130.     puts stdout "to your $profilename or enter q to quit"
  131.     set responce [gets stdin]
  132.     while {(($responce != "y") && ($responce != "q"))} {
  133.        puts stdout " "
  134.        puts stdout "ERROR invalid entry type y or q"
  135.        set responce [gets stdin]
  136.     }
  137.     if {$responce == "y"} {
  138.        set status [catch {rpcprofile add -a rs_bind -i d46113d0-a848-11cb-b863-08001e046aa5,2.0 -m $s -p $priority $profilename} msg]
  139.        if {$status == 1} {
  140.            puts stdout "ERROR: $msg"
  141.        }
  142.        
  143.     } else {
  144.       puts stdout "You have asked to quit, so long"
  145.       exit
  146.     }
  147.   }
  148. set st [rpcprofile show "$profilename"]
  149. puts stdout " "
  150. puts stdout "The current profile for $profilename is"
  151. puts stdout "$st"
  152. exit
  153.