差分
このページの2つのバージョン間の差分を表示します。
mac:mac_os_x_v10.6でsubversionリポジトリのパスベース認証を行う [2011-05-29 23:57] Decomo [公開鍵の生成] |
mac:mac_os_x_v10.6でsubversionリポジトリのパスベース認証を行う [2015-01-06 11:51] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Mac OS X v10.6でSubversionリポジトリのパスベース認証を行う ====== | ||
- | Snow Leopardからmod_dav_svnが標準で入たようで、WebDAVを用いたSubversion環境を作りやすくなったっぽいので挑戦してみたメモ。 | ||
- | |||
- | ===== 前提条件 ===== | ||
- | * Mac OS X v10.6.6(試した環境) | ||
- | * Subversion 1.6.5(システム標準) | ||
- | * Apache 2.2.15(システム標準) | ||
- | * プロジェクトごとにリポジトリを作り、プロジェクトごとにアクセス制御出来るようにする。 | ||
- | * リポジトリ置き場:/ | ||
- | * SVNサーバアドレス: | ||
- | |||
- | ===== httpd.confの編集 ===== | ||
- | < | ||
- | < | ||
- | LoadModule dav_svn_module libexec/ | ||
- | LoadModule authz_svn_module libexec/ | ||
- | </ | ||
- | |||
- | ===== mod_dav_svnの設定 ===== | ||
- | < | ||
- | < | ||
- | < | ||
- | |||
- | < | ||
- | DAV svn | ||
- | SVNListParentPath on | ||
- | SVNParentPath / | ||
- | </ | ||
- | |||
- | </ | ||
- | </ | ||
- | |||
- | ===== リポジトリの所有者の変更 ===== | ||
- | < | ||
- | $ sudo chown -R _www:_www / | ||
- | </ | ||
- | |||
- | ==== 確認 ==== | ||
- | ここまでで問題なく設定出来ていれば、apacheを再起動後、チェックアウトやブラウザからリポジトリの表示が出来るようになっているはず。 | ||
- | |||
- | 現段階では、Subversionサーバにアクセス出来る人なら誰でも、無制限でリポジトリを操作出来るので要注意。 | ||
- | |||
- | ===== アクセス制御 ===== | ||
- | < | ||
- | |||
- | < | ||
- | < | ||
- | |||
- | < | ||
- | DAV svn | ||
- | SVNListParentPath on | ||
- | SVNParentPath / | ||
- | Satisfy Any # 匿名ユーザーを許可 | ||
- | Require valid-user | ||
- | AuthType Basic # ベーシック認証を使う | ||
- | AuthUserFile / | ||
- | AuthzSVNAccessFile / | ||
- | </ | ||
- | |||
- | </ | ||
- | </ | ||
- | |||
- | ==== 正規ユーザーの設定 ==== | ||
- | < | ||
- | < | ||
- | $ sudo htpasswd -c / | ||
- | New password: | ||
- | Re-type new password: | ||
- | Adding password for user Decomo | ||
- | </ | ||
- | |||
- | 2人目以降、つまりhtpasswdが既にある場合は-cオプションは付けない。さもないと上書きされる。 | ||
- | |||
- | ==== リポジトリのアクセス制御の設定 ==== | ||
- | < | ||
- | |||
- | < | ||
- | [groups] | ||
- | admins = Decomo | ||
- | |||
- | [/] | ||
- | * = r | ||
- | |||
- | [Project1:/ | ||
- | @admins = rw | ||
- | |||
- | [Project2:/ | ||
- | @admins = rw | ||
- | |||
- | [secret:/] | ||
- | Decomo = rw | ||
- | * = | ||
- | </ | ||
- | |||
- | ===== SSLの設定 ===== | ||
- | ここからSSLに関する設定。HTTPのままで良ければ以下は設定する必要はない。 | ||
- | |||
- | ==== 秘密鍵の生成 ==== | ||
- | sudoだと上手く行かなかったのでsuする。 | ||
- | < | ||
- | $ cd / | ||
- | $ su | ||
- | # openssl genrsa -aes256 2048 > server.key | ||
- | Generating RSA private key, 2048 bit long modulus | ||
- | ............................+++ | ||
- | ..................................+++ | ||
- | e is 65537 (0x10001) | ||
- | Enter pass phrase: | ||
- | Verifying - Enter pass phrase: | ||
- | </ | ||
- | |||
- | 上記方法で生成したキーだとApacheの起動時にパスワードの入力を求められるらしいが、Mac OS Xだと何それ美味しいの状態なのでパスワードを解除しておく。 | ||
- | < | ||
- | # mv server.key server.bak | ||
- | # openssl rsa -in server.key.bak > server.key | ||
- | Enter pass phrase for server.key.back: | ||
- | writing RSA key | ||
- | </ | ||
- | |||
- | ==== 公開鍵の生成 ==== | ||
- | < | ||
- | # openssl req -new -key server.key > server.csr | ||
- | 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 -out server.crt -req -signkey server.key | ||
- | Signature ok | ||
- | subject=/ | ||
- | Getting Private key | ||
- | </ | ||
- | |||
- | ==== mod_sslの設定 ==== | ||
- | / | ||
- | |||
- | また、先ほど作成したsubversion.confをsubversion.conf.incにリネームしておく。 | ||
- | |||
- | < | ||
- | $ 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:// |