差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
mac:mac_os_x_v10.6でsubversionリポジトリのパスベース認証を行う [2011-02-19 15:47] Decomo mac_os_x_v10.6でsubversionリポジトリのパスベース認証を行う renamed to mac:mac_os_x_v10.6でsubversionリポジトリのパスベース認証を行う |
mac:mac_os_x_v10.6でsubversionリポジトリのパスベース認証を行う [2015-01-06 11:51] (現在) |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Mac OS X v10.6でSubversion+Apache+mod_dav_svn+mod_authz_svn環境 | + | ====== Mac OS X v10.6でSubversionリポジトリのパスベース認証を行う |
- | Snow Leopardからmod_dav_svnが標準で入っているようで、WebDAVを用いたSubversion環境を作りやすくなったっぽいので挑戦してみたメモ。 | + | Snow Leopardからmod_dav_svnが標準で入たようで、WebDAVを用いたSubversion環境を作りやすくなったっぽいので挑戦してみたメモ。 |
===== 前提条件 ===== | ===== 前提条件 ===== | ||
行 8: | 行 8: | ||
* Apache 2.2.15(システム標準) | * Apache 2.2.15(システム標準) | ||
* プロジェクトごとにリポジトリを作り、プロジェクトごとにアクセス制御出来るようにする。 | * プロジェクトごとにリポジトリを作り、プロジェクトごとにアクセス制御出来るようにする。 | ||
- | * リポジトリ置き場:/ | + | * リポジトリ置き場:/ |
+ | * SVNサーバアドレス: | ||
===== httpd.confの編集 ===== | ===== httpd.confの編集 ===== | ||
- | / | + | '' |
- | <code> | + | <file> |
- | $ sudo emacs / | + | |
LoadModule dav_svn_module libexec/ | LoadModule dav_svn_module libexec/ | ||
LoadModule authz_svn_module libexec/ | LoadModule authz_svn_module libexec/ | ||
- | </code> | + | </file> |
- | viを使えないヘタレ野郎です。すいません。 | + | |
===== mod_dav_svnの設定 ===== | ===== mod_dav_svnの設定 ===== | ||
- | / | + | '' |
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | DAV svn | ||
+ | SVNListParentPath on | ||
+ | SVNParentPath / | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== リポジトリの所有者の変更 ===== | ||
< | < | ||
+ | $ sudo chown -R _www:_www / | ||
+ | </ | ||
+ | |||
+ | ==== 確認 ==== | ||
+ | ここまでで問題なく設定出来ていれば、apacheを再起動後、チェックアウトやブラウザからリポジトリの表示が出来るようになっているはず。 | ||
+ | |||
+ | 現段階では、Subversionサーバにアクセス出来る人なら誰でも、無制限でリポジトリを操作出来るので要注意。 | ||
+ | |||
+ | ===== アクセス制御 ===== | ||
+ | '' | ||
+ | |||
+ | < | ||
< | < | ||
行 27: | 行 51: | ||
DAV svn | DAV svn | ||
SVNListParentPath on | SVNListParentPath on | ||
- | SVNParentPath /Volumes/Home/svn-repos | + | SVNParentPath /doko/soko/svn/repos |
+ | Satisfy Any # 匿名ユーザーを許可 | ||
+ | Require valid-user | ||
+ | AuthType Basic # ベーシック認証を使う | ||
+ | AuthName " | ||
+ | AuthUserFile / | ||
+ | AuthzSVNAccessFile / | ||
</ | </ | ||
</ | </ | ||
+ | </ | ||
+ | |||
+ | ==== 正規ユーザーの設定 ==== | ||
+ | '' | ||
+ | < | ||
+ | $ sudo htpasswd -c / | ||
+ | New password: | ||
+ | Re-type new password: | ||
+ | Adding password for user Decomo | ||
</ | </ | ||
- | ===== リポジトリの所有者の変更 | + | 2人目以降、つまりhtpasswdが既にある場合は-cオプションは付けない。さもないと上書きされる。 |
+ | |||
+ | ==== リポジトリのアクセス制御の設定 | ||
+ | '' | ||
+ | |||
+ | < | ||
+ | [groups] | ||
+ | admins | ||
+ | |||
+ | [/] | ||
+ | * = r | ||
+ | |||
+ | [Project1:/ | ||
+ | @admins = rw | ||
+ | |||
+ | [Project2:/ | ||
+ | @admins = rw | ||
+ | |||
+ | [secret:/ | ||
+ | Decomo = rw | ||
+ | * = | ||
+ | </ | ||
+ | |||
+ | ===== SSLの設定 ===== | ||
+ | ここからSSLに関する設定。HTTPのままで良ければ以下は設定する必要はない。 | ||
+ | |||
+ | ==== 秘密鍵の生成 ==== | ||
+ | sudoだと上手く行かなかったのでsuする。 | ||
< | < | ||
- | $ sudo chown -R _www: | + | $ cd /etc/apache2/other |
+ | $ su | ||
+ | # openssl genrsa | ||
+ | Generating RSA private key, 2048 bit long modulus | ||
+ | ..................................................................................................+++ | ||
+ | ..............+++ | ||
+ | e is 65537 (0x10001) | ||
+ | Enter pass phrase: | ||
+ | Verifying - Enter pass phrase: | ||
</ | </ | ||
- | 敢えて変な設定をしてなければ、パーミッションは特に弄る必要なし。設定するなら755とかその辺で。 | ||
- | ==== 確認 | + | ==== 公開鍵の生成 |
- | ここまでで問題なく設定出来ていれば、apacheを再起動後、ブラウザからリポジトリにひとまずアクセス出来るようになっているハズ。 | + | |
< | < | ||
- | $ sudo httpd -k restart | + | # openssl req -new -key server.key > |
- | ブラウザで「http://(svnサーバのアドレス)/ | + | Enter pass phrase for server.key: |
+ | You are about to be asked to enter information that will be incorporated | ||
+ | into your certificate request. | ||
+ | What you are about to enter is what is called a Distinguished Name or a DN. | ||
+ | There are quite a few fields but you can leave some blank | ||
+ | For some fields there will be a default value, | ||
+ | If you enter ' | ||
+ | ----- | ||
+ | Country Name (2 letter code) [AU]:JP | ||
+ | State or Province Name (full name) [Some-State]: | ||
+ | Locality Name (eg, city) []: | ||
+ | Organization Name (eg, company) [Internet Widgits Pty Ltd]: | ||
+ | Organizational Unit Name (eg, section) []:CA | ||
+ | Common Name (eg, YOUR name) []: | ||
+ | Email Address []:メールアドレス | ||
+ | |||
+ | Please enter the following ' | ||
+ | to be sent with your certificate request | ||
+ | A challenge password []: 空白 | ||
+ | An optional company name []: 空白 | ||
</ | </ | ||
+ | |||
+ | ==== 自己証明書の生成 ==== | ||
+ | < | ||
+ | # # openssl x509 -in server.csr -days 3650 -req -signkey server.key > server.crt | ||
+ | Signature ok | ||
+ | subject=/ | ||
+ | Getting Private key | ||
+ | Enter pass phrase for server.key: | ||
+ | </ | ||
+ | |||
+ | ==== 秘密鍵のパスワードの解除 ==== | ||
+ | 上記方法で生成したキーだとApacheの起動時にパスワードの入力を求められるらしいが、Mac OS Xだと何それ美味しいの状態なのでパスワードを解除しておく。 | ||
+ | < | ||
+ | # mv server.key server.key.bak | ||
+ | # openssl rsa -in server.key.bak -out server.key | ||
+ | Enter pass phrase for server.key.bak: | ||
+ | writing RSA key | ||
+ | </ | ||
+ | |||
+ | ==== subversion.confの編集==== | ||
+ | subversion.conf.incにリネームし、'' | ||
+ | < | ||
+ | # mv subversion.conf subversion.conf.inc | ||
+ | # emacs subversion.conf.inc | ||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | DAV svn | ||
+ | SVNListParentPath on | ||
+ | SVNParentPath / | ||
+ | SSLRequireSSL | ||
+ | Satisfy Any # 匿名ユーザーを許可 | ||
+ | Require valid-user | ||
+ | AuthType Basic # ベーシック認証を使う | ||
+ | AuthName " | ||
+ | AuthUserFile / | ||
+ | AuthzSVNAccessFile / | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== mod_sslの設定 ==== | ||
+ | / | ||
+ | |||
+ | < | ||
+ | $ cd / | ||
+ | $ sudo cp ../ | ||
+ | $ sudo mv subversion.conf subversion.conf.inc | ||
+ | </ | ||
+ | |||
+ | ssl.confで必要な箇所だけ抜粋。 | ||
+ | |||
+ | < | ||
+ | SSLRandomSeed startup file:/ | ||
+ | SSLRandomSeed connect file:/ | ||
+ | |||
+ | Listen 443 | ||
+ | |||
+ | AddType application/ | ||
+ | AddType application/ | ||
+ | SSLPassPhraseDialog | ||
+ | SSLSessionCache | ||
+ | SSLSessionCacheTimeout | ||
+ | SSLMutex | ||
+ | |||
+ | < | ||
+ | DocumentRoot "/ | ||
+ | ServerName mysvn.info: | ||
+ | ServerAdmin メールアドレス | ||
+ | ErrorLog "/ | ||
+ | TransferLog "/ | ||
+ | |||
+ | SSLEngine on | ||
+ | SSLCipherSuite ALL: | ||
+ | SSLCertificateFile "/ | ||
+ | SSLCertificateKeyFile "/ | ||
+ | |||
+ | < | ||
+ | SSLOptions +StdEnvVars | ||
+ | </ | ||
+ | < | ||
+ | SSLOptions +StdEnvVars | ||
+ | </ | ||
+ | |||
+ | BrowserMatch " | ||
+ | | ||
+ | | ||
+ | |||
+ | CustomLog "/ | ||
+ | "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \" | ||
+ | |||
+ | Include / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ''& | ||
+ | |||
+ | ===== 参考サイト ===== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | ~~DISCUSSION~~ | ||
+ |