Friday, August 6, 2010

Intel processors


What's i386? I started to think about this question when I was downloading the Ubuntu of i386 version. I think that i386 is a category of CPU. Well, this is not totally unreaonable.

i386 is short for the Intel 80386, which is produced since 1985 until 2008. So far the 80386 instruction set, programming model, and binary encodings are still the common denominator for all 32-bit x86 processors. However this is termed x86, IA-32, or the i386-architecture, depending on context.

The CPU of my workstation is Intel Celeron (R) , belongs to x86 family.

I catched the list blow from Wikipedia.com, just for fun to know.

More ...

Recover Deleted Folder in MS Outlook

Have you ever deleted a folder but want it back later while using MS Outlook? A colleague asked my help to recover her accidentally deleted "Unread" folder. The recovery strategy is straight forward, but extremely helpful for some other case like filtering and trashing.

I will take the "Unread" folder as an example to show how to recover/create folders in MS Outlook.

1. Right click "Inbox" folder (aka the parent folder that your new folder will belong to)
2. Go to Advanced Find..
3. Go to More Choice tab
4. Select Only items that are: then Unread in the menu to its right side.
5. Point to File | Save Search As Search Folder...
6. Name the new folder and click OK to finish



Congratulations! The unread folder just been recreated! It will be shown on the folder list.

You may also find this method useful for other tasks, like filtering letters with specific words, date or something else. Try it yourself!


More ...

Thursday, August 5, 2010

VWare Player

I am still waiting for VWare Player installer to finish its downloading.

VWare is so funny that it created a so call installer using java, just for downloading and launching the setup file. I suppose that the only thing it may show is how slow could java be.



BTW, I add a picture because Jolin, one of my colleagues, complained that this work blog was too boring and dull. Actually, she also cited a famous saying which is something like "NO PICTURE NO TRUTH". Well, I cannot find more attractive pictures since I always work with cmd, script and terminal. However, GUI is great and will always be great to show.

More ...

Google Analytics

Google Analytics is a great tool for web masters. However the configuration is a little wierd. I am not sure about whether it is caused by my location (Hong Kong) or other reasons. The problem is: I cannot get my website (actually this blogger website) configured after I added the tracking code into the template of all pages and waited for a long time. Instead, the dear Analytics always gave me a "!".

I figured this problem out by the following steps:

1. Make sure the Tracking code with correct Web Property ID is added to your website
2. Log in with Google account and go to Analytics Settings of Google Analytics
3. Focus on the aimed website and hit Edit to the right of it
4. Click Check Status which appears at the right top corner.

After doing so, the icon of "!" should be turned into "wait for data". And the reports will show soon.

More ...

Tuesday, August 3, 2010

Project - Samba: Domain security

Administrators of Microsoft networks often refer to three different types of servers:

Domain Controller
        – Primary Domain Controller (PDC)
        – Backup Domain Controller (BDC)
        – ADS Domain Controller

Domain Member Server
        – Active Directory Domain Server
        – NT4 Style Domain Domain Server

Standalone Server


Contents


1 Samba Security Modes

MicrosoftWindows networking uses a protocol that was originally called the Server Message Block (SMB) protocol, and then it has been better known as the Common Internet Filesystem (CIFS) protocol.

In the SMB/CIFS networking, there are only two types of security: user-level and share level. We refer to these collectively as security levels.

In implementing these two security levels, Samba provides flexibilities that are not available with MSWindows NT4/200x servers. In fact, Samba implements share-level security only one way, but has four ways of implementing user-level security. Collectively, the Samba implementations of the security levels are called security modes. They are:

– share mode
– user mode
– domain mode
– ADS mode
– server mode

An SMB server informs the client, at the time of a session setup, the security level the server is running. There are two options: share-level and user-level.


1.1 User Level Security

The client sends a session setup request directly following protocol negotiation. This request provides a username and password. The server can either accept or reject that username/password combination.

If the server accepts the username/password credentials, the client expects to be able to mount shares (using a tree connection) without further specifying a password. It expects that all access rights will be as the username/password credentials set that was specified in the initial session setup.

It is also possible for a client to send multiple session setup requests. When the server responds, it gives the client a uid to use as an authentication tag for that username/password. The client can maintain multiple authentication contexts in this way (WinDD is an example of an application that does this).

NOTE: Windows networking user account names are case-insensitive, meaning that upper-case and lower-case characters in the account name are considered equivalent. They are said to be case-preserving, but not case significant. Windows and LanManager systems previous to Windows NT version 3.10 have case-insensitive passwords that were not necessarily case-preserving. All Windows NT family systems treat passwords as case-preserving and case-sensitive.

The smb.conf parameter that sets user-level security is:
security = user


1.2 Share-Level Security

the client authenticates itself separately for each share. It sends a password along with each tree connection request (share mount)

security = share


1.3 Domain Security Mode (User-Level Security)

Domain security provides a mechanism for storing all user and group accounts in a central, shared, account repository. The centralized account repository is shared between domain (security) controllers. Servers that act as domain controllers provide authentication and validation services to all machines that participate in the security context for the domain. A primary domain controller (PDC) is a server that is responsible for maintaining the integrity of the security account database. Backup domain controllers (BDCs) provide only domain logon and authentication services. Usually, BDCs will answer network logon requests more responsively than will a PDC.

When Samba is operating in security = domain mode, the Samba server has a domain security trust account (a machine account) and causes all authentication requests to be passed through to the domain controllers. In other words, this configuration makes the Samba server a domain member server, even when it is in fact acting as a domain controller. All machines that participate in domain security must have a machine account in the security database.

Within the domain security environment, the underlying security architecture uses user-level security. Even machines that are domain members must authenticate on startup. The machine account consists of an account entry in the accounts database, the name of which is the NetBIOS name of the machine and of which the password is randomly generated and known to both the domain controllers and the member machine. If the machine account cannot be validated during startup, users will not be able to log on to the domain using this machine because it cannot be trusted. The machine account is referred to as a machine trust account.

There are three possible domain member configurations:

1. Primary domain controller (PDC) - of which there is one per domain.
2. Backup domain controller (BDC) - of which there can be any number per domain.
3. Domain member server (DMS) - of which there can be any number per domain.
To use Samba as a Domain Member Server by editing parameters in the smb.conf:
security = domain
workgroup = MFCHINA

In order for this method to work, the Samba server needs to join the MS Windows NT security domain. This is done as follows:

1. On the MS Windows NT domain controller, using the Server Manager, add a machine account for the Samba server.
2. On the UNIX/Linux system execute:
root# net rpc join -U administrator%password

I will not discuss this topic in details here since it is not included as one task in this project.


1.4 ADS Security Mode (User-Level Security)

Both Samba-2.2, and Samba-3 can join an Active Directory domain using NT4 style RPC based security. This is possible if the domain is run in native mode. Active Directory in native mode perfectly allows NT4-style domain members. This is contrary to popular belief.

If you are using Active Directory, starting with Samba-3 you can join as a native AD member. Why would you want to do that? Your security policy might prohibit the use of NT-compatible authentication protocols. All your machines are running Windows 2000 and above and all use Kerberos. In this case, Samba, as an NT4-style domain, would still require NT-compatible authentication data. Samba in AD-member mode can accept Kerberos tickets. Sites that use Microsoft Windows active directory services (ADS) should be aware of the significance of the terms: native mode and mixed mode ADS operation. The term realm is used to describe a Kerberos-based security architecture (such as is used by Microsoft ADS).

P30


1.5 Server Security (User Level Security)

I will not discuss this topic in details here since it is not included as one task in this project.



2 Password Checking

MS Windows clients may use encrypted passwords as part of a challenge/response authentication model (a.k.a. NTLMv1 and NTLMv2) or alone, or clear-text strings for simple password-based authentication. It should be realized that with the SMB protocol, the password is passed over the network either in plaintext or encrypted, but not both in the same authentication request.

When encrypted passwords are used, a password that has been entered by the user is encrypted in two ways:

– An MD4 hash of the unicode of the password string. This is known as the NT hash.
– The password is converted to uppercase, and then padded or truncated to 14 bytes. This string is then appended with 5 bytes of NULL characters and split to form two 56-bit DES keys to encrypt a "magic" 8-byte value. The resulting 16 bytes form the LanMan hash.

MS Windows 95 pre-service pack 1 and MS Windows NT versions 3.x and version 4.0 pre-service pack 3 will use either mode of password authentication. All versions of MS Windows that follow these versions no longer support plain-text passwords by default.

MS Windows clients have a habit of dropping network mappings that have been idle for 10 minutes or longer. When the user attempts to use the mapped drive connection that has been dropped, the client re-establishes the connection using a cached copy of the password.

When Microsoft changed the default password mode, support was dropped for caching of the plaintext password. This means that when the registry parameter is changed to re-enable use of plaintext passwords, it appears to work, but when a dropped service connection mapping attempts to revalidate, this will fail if the remote authentication server does not support encrypted passwords. It is definitely not a good idea to re-enable plaintext password support in such clients. The following parameters can be used to work around the issue ofWindows 9x/Me clients uppercasing usernames and passwords before transmitting them to the SMB server when using clear-text authentication:

password level
username level

By default Samba will convert to lowercase the username before attempting to lookup the user in the database of local system accounts. Because UNIX usernames conventionally only contain lowercase characters, the username-level parameter is rarely needed.

However, passwords on UNIX systems often make use of mixed-case characters. This means that in order for a user on aWindows 9x/Me client to connect to a Samba server using clear-text authentication, the password level must be set to the maximum number of uppercase letters that could appear in a password. Note that if the Server OS uses the traditional DES version of crypt(), a password level of 8 will result in case-insensitive passwords as seen from Windows users. This will also result in longer login times because Samba has to compute the permutations of the password string and try them one by one until a match is located (or all combinations fail).

The best option to adopt is to enable support for encrypted passwords wherever Samba is used. Most attempts to apply the registry change to re-enable plaintext passwords will eventually lead to user complaints and unhappiness.


More ...

Project - Samba: Background

The aim of this project is to establish a secured file sever for a branch office of the company. Samba is chosen to implement this task.

My job is to test, evaluate and document the Samba server in testing environment. The goals are:

        1. To built the Samba server in a Ubuntu box;

        2. To let Windows get access to the Samba server;

        3. To achieve the best performance and security of sharing;

        4. To add the Samba server to Active Directory

   

1.0 Assumptions

I will use the following settings in this document:

        Samba server : Ubuntu box (version 10.04 LTS)

        Server CN : TEST-SAMBA

        Client computer : Windows box (XP Professional SP2)

        Client CN : MFHK-RIVERLIU

        User account : MFCHINA/riverliu

        User group : tester


1.1 Configuring Samba (smb.conf)

Samba's configuration file smb.conf usually resides in /etc/samba/smb.conf or /usr/local/samba/lib/smb.conf. It is a plaintext file.

Each file consists of various sections, which are started by putting the section name between brackets ([]) on a new line. Each contains zero or more key/value pairs separated by an equality sign (=).

Each section in the smb.conf file represents either a share or a meta-service on the Samba server. The section [global] is special, since it contains settings that apply to the whole Samba server. Samba supports a number of meta-services, each of which serves its own purpose. For example, the [homes] share is a meta-service that causes Samba to provide a personal home share for each user. The [printers] share is a meta-service that establishes print queue support and that specifies the location of the intermediate spool directory into which print jobs are received from Windows clients prior to being dispatched to the UNIX/Linux print spooler.


1.2 TDB Database File Information

The directory in which Samba stores the tdb files is determined by compile-time directives. Samba-3 stores tdb files in two locations. The best way to determine these locations is to execute the following command:

root# smbd -b | grep PRIVATE_DIR
        PRIVATE_DIR: /etc/samba/private

Samba-3 also uses a number of tdb files that contain more mundane data.

The location of these files can be found by executing:

root# smbd -b | grep LOCKDIR
        LOCKDIR: /var/lib/samba


1.3 Components

Samba essentially consists of two or three daemons. A daemon is a UNIX application that runs in the background and provides services. An example of a service is the Apache Web server for which the daemon is called httpd. In the case of Samba there are three daemons, two of which are needed as a minimum.

The Samba server is made up of the following daemons:

nmbd

This daemon handles all name registration and resolution requests. It is the primary vehicle involved in network browsing. It handles all UDP-based protocols. The nmbd daemon should be the first command started as part of the Samba startup process.

smbd

This daemon handles all TCP/IP-based connection services for file- and print-based operations. It also manages local authentication. It should be started immediately following the startup of nmbd.

winbindd

This daemon should be started when Samba is a member of a Windows NT4 or ADS domain. It is also needed when Samba has trust relationships with another domain. The winbindd daemon will check the smb.conf file for the presence of the idmap uid and idmap gid parameters. If they are are found, winbindd will use the values specified for for UID and GID allocation. If these parameters are not specified, winbindd will start but it will not be able to allocate UIDs or GIDs.


1.4 Configuration

The basic configuration process and example can be found in one of my Samba project documents: Project - Samba: Configuration.

To find the correct location of smb.conf by executing:

root# smbd -b | grep smb.conf

To test the calidation of the smb.conf by executing:

root# testparm /etc/samba/smb.conf

To generate a fully optimized smb.conf file from this master configuration and documentation file by executing:

root# testparm -s smb.conf.master > smb.conf


1.5 SWAT

SWAT is a Web-based interface that can be used to facilitate the configuration of Samba. SWAT might not be available in the Samba package that shipped with your platform, but in a separate package. If you need to build SWAT please read the SWAT man page regarding compilation, installation, and configuration of SWAT from the source code.

To launch SWAT, just run your favorite Web browser and point it to http://localhost:901/. Replace localhost with the name of the computer on which Samba is running if that is a different computer than your browser.

SWAT can be used from a browser on any IP-connected machine, but be aware that connecting from a remote machine leaves your connection open to password sniffing because passwords will be sent over the wire in the clear.

Please note that re-writing the configuration file using SWAT will remove all comments!


1.6 List Shares Available on the Server

To list shares that are available from the configured Samba server, execute the following command:

$smbclient -L test-samba

You should see a list of shares available on your server. If you do not, then something is incorrectly configured. This method can also be used to see what shares are available on other SMB servers, such as Windows 2000.

If you choose user-level security, you may find that Samba requests a password before it will list the shares. See the smbclient man page for details. You can force it to list the shares without a password by adding the option -N to the command line.


1.7 Connect with a UNIX Client

Enter the following command:

$smbclient //test-samba/aservice

The aservice is any service that has been defined in the smb.conf file. Try your username instead if you just have a [homes] section in the smb.conf file, like:

$ smbclient //test-samba/riverliu


1.8 Connect from a Remote SMB Client

you can try to access it from other clients. The Samba host should be listed in the Network Neighborhood on all Windows clients of its subnet. Try browsing the server from another client or "mounting" it.

You can view the services list on a specific Samba server by:
C:\> net view \\test-samba

Mounting disks from a DOS, Windows, or OS/2 client can be done by running a command like:

C:\> net use m: \\test-samba\service

Where the drive letter m: is any available drive letter. It is important to double-check that the service (share) name that you used does actually exist.

Try printing, for example,

C:\> net use lpt1: \\test-samba\spoolservice

The spoolservice is the name of the printer (actually the print queue) on the target server. This will permit all print jobs that are captured by the lpt1: port on the Windows client to be sent to the printer that owns the spoolservice that has been specified.

C:\> print filename

More ...

Monday, August 2, 2010

Weekly Report - Week 9

26 Jul 2010 – 30 Jul 2010

1. Actual work done

In this week, I began with re-design the Information Collector I started a few weeks ago. Then I was introduced to a new project to construct file server for Guangzhou Office with Samba. I studied the open source package for days, to get familiar with its features, functions and usages. Then I built a Samba server on Debian Linux system (Ubuntu 10.04 LTS) for testing and configured basic setting by the end of this week.

2. Technical involvement

Although I had been working on Linux system for years, it was the first time for me to know about Samba, and lots of relative terminologies, like NetBT, NetBIOS, SMB and CIFS. Of course the most attactive thing I learnt was the Samba.

More ...