projects.samba.org

Tue, 02 Aug 2005

So far what I have come up with is a number of classes that are used to
deal with the "most common parameters" that Samba configuration
file deals with. Now for a server configuration I have distributed those
parameter bulk into approx 20 classes.

a) Basic class :
It covers the Basic parameters in the Server , Fileshare and Printshare
configurations
and includes parameters like

comment, path, netbiosname , workgroup , server string, etc

b) Tuning class:
it covers the methods to fine tune the Share and Server configurations .
includes parameters like


max smbd connections , keepalive, socket options, max open files,
maxconnections , write cache size, strict allocation ,
strict sync , minprint space

c) Browse class:

browseable , OS level , preferred master , local master, browse list , enhanced
browsing

d) Protocol Class:


Protocol , smb ports, max protocol, min protocol , nt pipe support , disable
netbios, time server, nt acl support, client signing , name resolve order
,

e) FilenameHandling Class :

case sensitive, preserve case, short preserve case, mangle case , hide
dot files,
delete veto, hide files, veto files, map system , map hidden , map archive,
mangled map

f) Locking class :

blocking locks , locking , oplocks , posix locking , strict locking ,
share modes , fake oplocks

g) printing class :

printing , cups options, lpq command, lppause command .....
printcap name , load printers , delete printed command , addprinter command
,
max reported print job , printable , printer name ....

h) Logon class :
add user script , delete user script , logon script , logon drive , logon
path , logon home
domain logons , shutdown script

i) WINS class :
dns proxy , wins proxy , wins server, wins support , wins hook

j) LogFile class :
includes parameters related to the log files LDAP class :

k) Security class :
includes parameters that handle the server and share security .

server security

security , auth methods, encrypt passwords , null passwords, password
server, smbpsswd file
username level , unix passwd sync, root dir , guest account , private dir
, username map

share security

force user , force group , inherit permissions , guest only , only user
, writable
username , invalid users, valid users, admin users , read list , security
mask , directory
mask , create mask ......

l) Miscellaneous class :

remaining but frequent parameters ..

follow symlinks , wide links , postexec , root preexec , root postexec
, delete readonly ,
dos file mode , fstyps , volume , dont descend ......


Now based upon these classes there would be three MAIN classes
a) ServerClass
b) FileShareClass
c) PrintShareClass

The Objects Distribution for classes ...

ServerClass (class)
Basic
Security
Tuning
Locking
Protocol
Printing
FilenameHandling
Logon Options
Browse
WINS LDAP
winbind
Miscellaneous

FileShareClass (class)
Basic
Security
Protocol
Tuning
FilenameHandling
Browse
Locking
Miscellaneous

PrintShareClass (class)
Basic
Security
Tuning
Browsing
Miscellaneous
Printing Options

UserAccountsClass (class)


At present I am dealing with the functions for Each of the Main Classes
designed so far ..
What would a test file look like ??

Functions For the Server class

def CommitChanges(self):
def AddShare(self, ShareObject):
def RefreshServer(self):
def ListOptionsInShare(self , shareName):
def PrintServerInfo(self):
def ListShares(self):
def RemoveShare(self, delShareName ):
def SetOptionValuePairInService(self, ServiceName, Option , Value):
def Version(self):
def PrintConfigFile(self):
def TestServerConfiguration(self):
def RevokeUserRight(self):
def AddUser(self):
def RemoveUser(self):
def CreatePath(self):
def CheckIfPathExist(self):
def CommentOptionValuePair(self):
def UncommentOptionValuePair(self):
def SetServerType(self, serverType):

test.py

import sys
from ServerClass import Server

from FileShareClass import FileShare

if _name_ == "_main_":
s = Server("/home/amit/test/smb.conf")
s.Basic.Workgroup(" workgroupnamE ")
s.Basic.NetBIOSname(" my computer ")
s.Security.EncryptPasswords("yes")

s.FilenameHandling.HideDotFiles("yes","comment here")

S.Browse.Browseable("yes")
s.CommitChanges()

s1 = FileShare("mama")
s1.Basic.Path("/home/amit")
s1.Basic.Comment(" comment for the share name")
s1.Security.ReadOnly("yes")
s1.Security.Writable("yes")

s.AddShare(s1)

print "done"

 

Amit Regmi 2nd August 2005

posted at: 03:40 | path: /samba3/pythong | permanent link to this entry

Thu, 28 Jul 2005

Classes and Methods implemented so far

filename:Server.py

(class) Server

commitChanges
ListShares,
AddShare,
RemoveShare,
setServerName,
setWorkgroupName,
setOptionValuePairInService,
setServerType,
ListOptionsInShare,
printServerInfo

filename: FileAndPrintService.py

(class) SetSharePermissions

addOptionValuePair,
setGuestOk,
setBrowseable,
setSearchPath

(class) FileService(SetSharePermissions)

setReadOnly,
setWritable,
setCreateMask,
setDirectoryMask

(class) PrintService(SetSharePermissions)

setPrintable,
allowGuestToPrint

filename: Accounts.py

(class) User
setUserPassword

(class) UnixUser(User)
(class WindowsUser(User)
(class) SambaUser(User)

(class) UserAccounts
listUnixUserAccounts
listSambaUserAccounts
checkAccountInSmbPasswd
addUnixAccount
addSambaAccount
delSambaAccount
changeSmbPasswd
enableSMBaccount
disableSMBaccount
addWindowsAccount

Amit Regmi 29th July 2005

posted at: 23:51 | path: /samba3/pythong | permanent link to this entry

Sun, 24 Jul 2005

Python framework for samba management:

So far what has been done is the design of several classes which include a smb.conf parser (by Jerry).
I have worked out 2 files
a) make_smb_conf.py
Here we have a Server class and we decide what server we are to implement. Depending on option we generate a smb.conf file from scratch.
b) smb_tools.py
Here we have methods that help us
- send message to machines on the network
- Check the available accounts in the samba database
- check the available unix user accounts
- add/modify/delete the user accounts (samba)
- refreshing the server
Observation is root acess is required to run many of the management tools.
So, I believe superusers are the people who would be most benifited in using the framework for the management of samba.

Amit Regmi

posted at: 06:11 | path: /samba3/pythong | permanent link to this entry