誰ãã
Google Appsã«ã€ããŠç¥ã£ãŠãããšæããŸãã ããã¯ã瀟å
ã§ã¡ãŒã«ãããŒã ã¯ãŒã¯ãæŽçããã®ã«æé©ãªãµãŒãã¹ã§ãã ãã ããããã€ãã®å°ããªæ¬ ç¹ããããŸããæåã®ç¶æ
ã§æäŸãããGoogle Appsã䜿çšããéã®ãã¹ãŠã®äŒæ¥ææžãã¡ãŒã«ãéä¿¡ã¯GoogleãµãŒããŒã«ä¿åãããŸãã
ãã®çµæãå€ãã®å Žåãæ·±å»ãªäŒæ¥ã¯å°é£ãªéãéžæããŸã-èªåã®ãµãŒããŒã§å¿
èŠãªãã¹ãŠã®ãµãŒãã¹ããµããŒãããããã«ã ãã¡ããããã®æ¹æ³ã«ã¯å€ãã®å©ç¹ããããŸãã äŒç€Ÿã®ã·ã¹ãã 管çè
ã¯ãããããæ¹æ³ã§æ§æã§ããŸãã ãã ããé倧ãªæ¬ ç¹ã1ã€ãããŸããGoogleããã¹ãŠãæ§æããŠæ¥ç¶ããŠããå Žåããã¹ãŠãæåã§æ§æããå¿
èŠããããŸãã ãŸããã·ã¹ãã ã«åãçŸãã䟿å©ãªWebã€ã³ã¿ãŒãã§ã€ã¹ãæäŸããããšã¯ã§ããŸããã
ãã ããå®è·µã瀺ãããã«ãGoogleã®æ¯æŽããªããŠããäŒæ¥ã«æè»ã§åŒ·åãªã€ã³ãã©ã¹ãã©ã¯ãã£ãç°¡åã«å±éã§ããŸãã ç«ã®äžã§ãXMPPãµãŒããŒãã¡ãŒã«ã·ã¹ãã ã«çµ±åããæ¹æ³ã説æããŸããããã«ãããæçµçã«ã¯Googleãããã¯ããã«åªããçµæãåŸãããŸãã
ã¡ãŒã«ãµãŒããŒ
ãŸããã¡ãŒã«ãµãŒããŒãå¿
èŠã§ãã MTAã®è³¢æãªéžæã¯ãæãã¢ãžã¥ãŒã«æ§ããããæè»æ§ãããããããä¿¡é Œæ§ã®é«ã
Postfixã§ãã ãªãã·ã§ã³ãªãã§ãšã³ãåä¿¡è
ã«ã¡ãŒã«ãé
ä¿¡ããã«ã¯ãIMAPãµãŒããŒãå¿
èŠ
ã§ã ãããã«ã¯
Dovecotã䜿çš
ããŸãã
Dovecotã䜿çšãããšãã»ãŒãã¹ãŠã®æšæºã¹ãã¬ãŒãžããŠãŒã¶ãŒããŒã¹ãšããŠç°¡åã«äœ¿çšã§ããŸãã ããšãã°ãADã䜿çšããŸãã ããã«ãDovecotã¯ãµãŒãããŒãã£ã®ã¢ããªã±ãŒã·ã§ã³ã«èªèº«ãä»ããŠãã°ã€ã³ããæ©èœãæäŸããŸããç¹ã«ãPostfixã¯ãããå®è¡ã§ããŸãã ãããã£ãŠãéåžžã«äŸ¿å©ãªã¹ããŒã ãåŸãããŸããDovecotã¯ãŠãŒã¶ãŒããŒã¿ããŒã¹ãšã®éä¿¡ãæ
åœããã·ã¹ãã ã®ä»ã®ãã¹ãŠã®ã³ã³ããŒãã³ãã¯ãåçŽã«èªèšŒã確èªããããã«ããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ããŸãã å©ç¹ã¯æããã§ããããŒã¿ããŒã¹ãå€æŽãããïŒããšãã°ãADãæŸæ£ããŠOpenLDAPã䜿çšãããïŒ-äœãåæ§æããå¿
èŠã¯ãªããDovecotãæ°ããã¹ãã¬ãŒãžã«éä¿¡ããã ãã§ãã
Dovecot + Postfixã®æãæ§æããæ¹æ³ã¯ããããã®ããã°ã©ã ã®ããã¥ã¡ã³ãã«æžãããŠããŸãã ã»ããã¢ããã®çµæãSMTPããã³IMAPãµãŒããŒãå人çã«ååŸããŸããããããã®ãµãŒããŒã¯ããã¡ã€ã³ãã°ã€ã³/ãã¹ã¯ãŒãã«ãã£ãŠã©ã®ãŠãŒã¶ãŒã«èš±å¯ãããŠããŸãã ãšããã§ãDovecotãšPostfixã«ã¯éåžžã«åªããããã¥ã¡ã³ãããããŸããããã¯ããããã®è£œåã®éèŠãªå©ç¹ã§ããããŸãã ãããã£ãŠããã®ãã³ãã«ã®èšå®ã«åé¡ã¯ãªãã¯ãã§ãã
JabberãµãŒããŒ
ããšã¯ããµãŒããŒãæ¢åã®Jabberã¡ãŒã«ã·ã¹ãã ã«åºå®ããã ãã§ãã ãããè¡ãããšã¯éæ¹ããªãåæ©çã§ãã æåã«
ejabberdãã€ã³ã¹ããŒã«ããå¿
èŠããããŸãã ãªã圌ãªã®ïŒ ãããæãæè»ã ãããšããçç±ã ãã§ã ãã®è£œåã®è±å¯ãªæ©èœã«ã€ããŠå€ãã®èšäºãæžãããŠããã®ã§ãDovecotãä»ããŠejabberdèªèšŒã®æŽçã«ãŸã£ããé²ã¿ãŸãã 幞ããªããšã«ãejabberdã¯
å€éšèªèšŒããµããŒãããŠããŸããå¿
èŠãªã®ã¯ãDovecotãä»ããŠãŠãŒã¶ãŒããŒã¿ãæ€èšŒããã¹ã¯ãªãããäœæããããšã ãã§ãã
å°ããªäœè«ïŒDovecotãä»ããå€éšèªèšŒã¡ã«ããºã ã¯ãDovecotãäœæãã2ã€ã®UNIXãœã±ãããä»ããŠæ©èœããŸãã ãããã®ãœã±ããã®ãã©ã¡ãŒã¿ãŒã¯ãDovecotã®èšå®ã§æå®ãããŠããŸã ããããã®è©³çŽ°ã«ã€ããŠã¯ã å
¬åŒwikiãã芧ãã ãããã€ã³ã¿ãŒãããã§å°ãéšãç«ãŠãŠãç§ã¯ãã®ãããªæç©ãããã§èŠã€ããŸããïŒ
http ://search.cpan.org/~sasha/Authen-SASL-Authd-0.04/lib/Authen/SASL/Authd.pm
ãããã倧èã«ã³ãŒããçªããŠãejabberdã«å¿
èŠãªåäœãè¿œå ããŠãæçµããŒãžã§ã³ãå
¥æããŸããã
#!/usr/bin/perl
use 5.010 ;
use IO :: Socket :: UNIX ;
use IO :: Select ;
use MIME :: Base64 qw ( encode_base64 ) ;
# Dovecot
$dovecot_auth_master = '/var/run/dovecot/auth-master' ;
$dovecot_auth_client = '/var/spool/postfix/private/auth-client' ;
sub read_until {
my ( $sock , $re , $timeout ) = @_ ;
my $sel = new IO :: Select ( $sock ) ;
my $result = '' ;
while ( $result !~ /$re/m ) {
$sel -> can_read ( $timeout ) or die "Timed out while waiting for response" ;
defined recv ( $sock , my $buf , 256 , 0 ) or die 'Error while reading response' ;
$result . = $buf ;
}
return $result ;
}
sub dovecot_auth {
my ( $login , $passwd ) = @_ ;
utf8 :: encode ( $login ) ;
utf8 :: encode ( $passwd ) ;
my $base64 = encode_base64 ( " \0 $login \0 $passwd" , '' ) ;
my $service = "ejabberd" ;
my $timeout = 3 ;
my $sock = new IO :: Socket :: UNIX ( Type => SOCK_STREAM , Peer => $dovecot_auth_client ) or die ;
my $resp = read_until ( $sock , 'DONE' , $timeout ) ;
die unless $resp =~ /^VERSION\t1\t\d+$/m ;
die unless $resp =~ /^MECH\tPLAIN/m ;
$sock -> send ( "VERSION \t 1 \t 0 \n CPID \t $$ \n AUTH \t 1 \t PLAIN \t service=$service \t secured \t resp=$base64 \n " ) or die ;
$resp = read_until ( $sock , '\n' , $timeout ) ;
$sock -> close ;
return $resp =~ /OK/ ;
}
sub dovecot_user {
my $login = shift @_ ;
utf8 :: encode ( $login ) ;
my $service = "ejabberd" ;
my $timeout = 3 ;
my $sock = new IO :: Socket :: UNIX ( Type => SOCK_STREAM , Peer => $dovecot_auth_master ) or die ;
my $resp = read_until ( $sock , 'VERSION' , $timeout ) ;
die unless $resp =~ /^VERSION\t1\t\d+$/m ;
$sock -> send ( "VERSION \t 1 \t 0 \n USER \t 1 \t $login \t service=$service \t secured \n " ) or die ;
$resp = read_until ( $sock , '\n' , $timeout ) ;
$sock -> close ;
return $resp =~ /USER/ ;
}
# Reading information from ejabberd
while ( 1 ) {
my $nread = sysread STDIN , my $buf , 2 ;
unless ( $nread == 2 ) { exit }
my $len = unpack "n" , $buf ;
$nread = sysread STDIN , $buf , $len ;
my ( $op , $user , $domain , $passwd ) = split /:/ , $buf ;
# Filter dangerous characters
$user =~ s/[."\n\r'\$`]//g ;
$passwd =~ s/[."\n\r'\$`]//g ;
$domain =~ s/[."\n\r'\$`]//g ;
my $result = 0 ;
if ( $op =~ /auth/i ) {
$result = dovecot_auth ( $user , $passwd ) ? 1 : 0 ;
} elsif ( $op =~ /isuser/i ) {
$result = dovecot_user ( $user ) ? 1 : 0 ;
}
my $out = pack "nn" , 2 , $result ;
syswrite STDOUT , $out ;
}
çãã¡ã¢ïŒCPANããã®ãœãŒã¹ã¢ãžã¥ãŒã«ã¯çŸåšåäœããå¯èœæ§ãäœãã§ãã Dovecotãšã®æ£ãã察話ã®ããã«ãé¢æ°encode_base64ãåŒã³åºããšãã2çªç®ã®åŒæ°ãšããŠç©ºã®æååãæå®ããå¿
èŠããããŸãã äžèšã®ã¹ã¯ãªããã§ã¯ãããã¯ãã¡ããèæ
®ãããŠããŸããDovecotãä»ããèªèšŒã®å Žåãejabberdããã»ã¹ã«ã¯DovecotèªèšŒãœã±ãããžã®èªã¿åãããã³æžã蟌ã¿æš©éãå¿
èŠã§ããããšã«æ³šæããŠãã ããã Ejabberdã¯ããŠãŒã¶ãŒejabberdã«ä»£ãã£ãŠåäœããŸããããã¯ãå¥åŠãªå¶ç¶ã®äžèŽã«ãããejabberdã°ã«ãŒãã®ã¡ã³ããŒã§ãã ãããã£ãŠããã®ãŠãŒã¶ãŒïŒãŸãã¯ã°ã«ãŒãïŒã«ãDovecotãœã±ãããšããããé
眮ãããŠãã
ãã£ã¬ã¯ããªã®äž¡æ¹ã«rwæš©éãäžããããšãå¿ããªãã§ãã ããïŒäœããã®çç±ã§ãæåŸã®é
ç®ãå¿ããå ŽåããããŸãïŒã
ã¹ã¯ãªãããejabberdæ§æã«è¿œå ããããšã¯æ®ã£ãŠããŸãã
{auth_method, external} .
{extauth_program, "/etc/ejabberd/auth.pl"} .
å®éãããã¯å®è³ªçãªéšåã®çµããã§ãã ããã§ãã¡ãŒã«ã«å ããŠããŠãŒã¶ãŒã¯Jabberã§ããã¡ã€ã³ãã°ã€ã³ã§ãã°ã€ã³ã§ããããã«ãªããŸãã ãŸããã¡ãŒã«ã·ã¹ãã ã®èšå®æã«ããŸãããããªãã£ãå ŽåãåãŠãŒã¶ãŒã®JIDãšã¡ãŒã«ã¯äžèŽããusername @ domain.comã®ããã«ãªããŸãã
ãã ããGoogleã«è¿œãã€ããŠè¿œãè¶ãããšã¯æ®ã£ãŠããŸãã ãŸããããã¯éåžžã«ç°¡åã§ãã ããã¯ãejabberdã§å¿
èŠãªæ©èœãæå¹ã«ããå®å
šã«æšæºçãªæ¹æ³ã§ãã ç§ã®èŠ³ç¹ããæãèå³æ·±ãæ©èœã¯æ¬¡ã®ãšããã§ãã
- äŒè° ã圌ãã¯ãŸãMUCã§ãã æšæºã¢ãžã¥ãŒã«mod_mucããããã®ãµããŒããæ
åœããŸããå¿
èŠãªããã©ã«ããã©ã¡ãŒã¿ãèšå®ããã ãã§ãã
- äŒè°ã®ãã®ã³ã° ã mod_muc_logã¢ãžã¥ãŒã«ããããæ
åœããŸãã 圌ã¯ãã¹ãŠã®äŒè°ãã°ãHTMLãã¡ã€ã«ã®åœ¢åŒã§1ã€ã®ãã©ã«ããŒã«å
¥ããŸããæ®ãã¯ããã®ãã©ã«ããŒã«Apacheãèšå®ããããŒã«ã«ãããã¯ãŒã¯ããã®ã¿åä¿¡ãããªãœãŒã¹ãžã®ã¢ã¯ã»ã¹ãèš±å¯ããããšã§ãã
- å人çãªéä¿¡ã®èšé² ã ãã®æ©èœãæå¹ã«ããã«ã¯ãmod_log_chatã¢ãžã¥ãŒã«ãåã€ã³ã¹ããŒã«ããå¿
èŠããããŸããããã«ããããã¹ãŠã®ãã°ãHTMLãã¡ã€ã«ã®åœ¢åŒã§1ã€ã®ãã©ã«ããŒã«åã³é
眮ãããŸãã 次ã«ããã®ãã©ã«ããå®æçã«ã¹ãã£ã³ããŠå¿
èŠãªãã¡ã€ã«ãæ£ããé»åã¡ãŒã«ã¢ãã¬ã¹ã«éä¿¡ããç°¡åãªã¹ã¯ãªãããäœæã§ããŸãã ãããã£ãŠãGoogleãšåæ§ã®æ©èœãåŸãããŸãã
- äžè¬çãªããŒã¹ã¿ãŒ ã 瀟å
ã§éåžžã«åœ¹ç«ã€æ©äŒã§ãã Mod_shared_rostersããããæ
åœããŸãã ãŠãŒã¶ãŒåç°¿ãæè»ã«ç®¡çããã°ã«ãŒãå
šäœãè¿œå ã§ããŸãã
- ãªãã©ã€ã³ã¡ãã»ãŒãžã®ãµããŒã ã ãªãã«ããªãã§ãã ããïŒ ãã®å Žåã¯mod_offline ïŒ
- 茞é ãã®ã¢ã€ãã ã«ã¯ã³ã¡ã³ãã¯å¿
èŠãªããšæããŸãã æ¢åã®IMãããã¯ãŒã¯ãä»ããŠç°¡åã«éä¿¡ããæ¹æ³ãåŸæ¥å¡ã«æäŸã§ããŸãã
念ã®ããã次ã®ããšã«æ³šæããŠãã ããã ã¡ãŒã«ïŒããã³ç§ã®å Žåã¯ADïŒãçµã¿åãããèªèšŒã·ã¹ãã ãèšå®ããŠãããããJabberãµãŒããŒã§ã®ç»é²ã«é¢é£ãããã¹ãŠããªãã«ããå¿
èŠããããŸãã ããšãã°ãåãmod_registerã ç®ãã«ã«ã¹ã«ãªããªãããã«ã
ãŸãšã
ãã®ãããåçŽãªã¹ã¯ãªããã䜿çšããŠãã¡ãŒã«ãšJabberãçžäºã«æ¥ç¶ããªããã䜿çšãã補åã®ãã¬ãŒã ã¯ãŒã¯å
ã§ãã¹ãŠãèªç±ã«èšå®ããããšãã§ããŸãã ãããŠãæãæ©èœçã§ãæè»æ§ããããä¿¡é Œæ§ã®é«ãããŒã«ã®ããã€ããããããã®åéã§äœ¿çšãããŠãããããå®éãã¿ã¹ã¯ã®ãã¬ãŒã ã¯ãŒã¯å
ã§å¯èœãªéãæã匷åãªã·ã¹ãã ã§ããããšãå€æããŸããïŒäŒæ¥éä¿¡çšã®ã¡ãŒã«+ IMïŒã Exchangeã®ãããªçµ±åããããœãªã¥ãŒã·ã§ã³ã¯ãªããGoogle Appsããã¡ãããcloseããã®ãããªæ©èœãæäŸã§ããŸããã åæã«ããŠãŒã¶ãŒã®èŠ³ç¹ããã¯ãçµæãšããŠåŸãããã·ã¹ãã ã¯å®å
šã«ééçã§ãããå¯èœãªéãã·ã³ãã«ã«äœ¿çšã§ããŸãããŸãã管çè
ã®èŠ³ç¹ãããåæ§ã§ãã 管çè
ãæ§æäžã«ãã¹ãŠãç解ããå¿
èŠããªãéãïŒããã³ãã¹ãŠãæ£ããæ§æããå¿
èŠããããŸãïŒïŒãããã«ãµããŒãã¯åºæ¬ããããããã«å°ãªããªããŸãã
PS誰ããèå³ãæã£ãŠãããªããDovecot + Postfixãã³ãã«ïŒIMAP ACLã管çè
ããã®ã¡ãŒã«ããã¯ã¹ãžã®çŽæ¥ã¢ã¯ã»ã¹ãã¯ã©ã€ã¢ã³ããã¡ãŒãªã³ã°ãªã¹ãããããªãã¯ãã©ã«ããŒããµãã¹ã¯ãªãã·ã§ã³ããŠãŒã¶ãŒã«ããæš©å©ã®å§ä»»ãªã©ïŒããå€ãã®èå³æ·±ããã®ãçµãåºãæ¹æ³ãšæ¹æ³ã説æã§ããŸããµãŒããŒãä»ããŠThunderbirdã¡ãŒã«ã¯ã©ã€ã¢ã³ãã®ãã©ã¡ãŒã¿ãŒã®æè»ãªæ§æãæŽçãããŠãŒã¶ãŒãã¯ã©ã€ã¢ã³ãã§äœããå€æŽããå¿
èŠæ§ïŒããã³å¿
èŠã«å¿ããŠæ©èœïŒãç¯çŽããŸãã