* Authentication One database, and one (or two) tables. One table holds the username and the encryped (or plain) password. The other table holds the username and the names of the group to which the user belongs. It is possible to have username, groupname and password in the same table. * Access Logging Every authentication access is logged in the same database of the authentication table, but in different table. User name and date of the request are logged. As option, it can log password, ip address, request line. |
* 認証DB このデータベースは1つ(または2つ)のテーブルを含みます。(訳注:2つにする場合)片方には username と 平文またはハッシュ化されたパスワード情報を格納します。もう1つには username と 所属するグループを格納します。username, グループ, パスワードは1つのテーブルにあってもかま いません。 * アクセスログDB 認証DBへのアクセスは別のテーブルに記録されます。基本的には username と日時が記録されます オプションとして、パスワードやIPアドレス、リクエスト行を記録することもできます。 |
%createuser www Shall the new user be allowed to create databases? (y/n) n Shall the new user be allowed to create more new users? (y/n) n CREATE USER |
%createdb mod_auth_pgsql CREATE DATABASE %psql mod_auth_pgsql Welcome to psql 7.4.6, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit mod_auth_pgsql=# create table users ( mod_auth_pgsql(# name varchar (32) primary key, mod_auth_pgsql(# uid integer, mod_auth_pgsql(# pass varchar (32), mod_auth_pgsql(# flag integer, mod_auth_pgsql(# rsv1 varchar (40) mod_auth_pgsql(# ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users" CREATE TABLE mod_auth_pgsql=# grant all on users to www; GRANT mod_auth_pgsql=# \q |
列名 | データ型 | データ長 | 備考 |
name | 可変長文字列型 | 32 | ユーザ名(主キー) |
uid | 整数型 | - | ユーザID番号(予備) |
pass | 可変長文字列型 | 32 | パスワード格納フィールド |
flag | 整数型 | - | ユーザの属性を示すフラグ類 |
rsv1 | 可変長文字列型 | 40 | 予約領域 |
%psql mod_auth_pgsql Welcome to psql 7.4.6, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit mod_auth_pgsql=# insert into users values('admin',0,'admin2004',1,''); INSERT 17147 1 mod_auth_pgsql=# \q |
mod_auth_pgsql=# update users set pass = 'admin2004' where name = 'admin'; |
AuthName "My PostgreSQL Authenticator" AuthType basic Auth_PG_host localhost Auth_PG_port 5432 Auth_PG_user pgsql Auth_PG_database mod_auth_pgsql Auth_PG_pwd_table users Auth_PG_uid_field name Auth_PG_pwd_field pass Auth_PG_encrypted off <LIMIT GET POST> require valid-user </LIMIT> |
[Wed Dec 22 14:16:20 2004] [alert] [client 192.168.5.1] /usr/local/apache/htdocs /manual/.htaccess: Invalid command 'Auth_PG_ebcrypted', perhaps mis-spelled or d efined by a module not included in the server configuration …なんかミスタイプしてるんちゃうの。…ってたしかに間違ってました。 [Wed Dec 22 14:23:41 2004] [error] (43)Protocol not supported: access to /usr/lo cal/apache/htdocs/manual/mod/core.html failed for 192.168.5.1, reason: PGSQL 3: ERROR: column "password" does not exist\n -- Query: select password from users where user='admin' …パスワードを格納するフィールド名は "password" じゃなくて "pass" でしょ。 [Wed Dec 22 16:23:45 2004] [error] (43)Protocol not supported: access to /usr/lo cal/apache/htdocs/manual/mod/core.html failed for 192.168.5.1, reason: mod_auth_ pgsql: Password for user www not found (PG-Authoritative) …最後まで悩んだ問題。ユーザ名を入れるフィールドは user ではなく name でしたね。 自分で名前を付けておいてこの始末。やはり直感的に分かるフィールド名が一番。 |
<Directory "/usr/local/apache/htdocs"> # # This may also be "None", "All", or any combination of "Indexes", # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews". # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # Options Indexes FollowSymLinks MultiViews AllowOverride AuthConfig # # This controls which options the .htaccess files in directories can # override. Can also be "All", or any combination of "Options", "FileInfo", # "AuthConfig", and "Limit" # AllowOverride None |