Cài đặt Server Chat XMPP - Ejabberd - FAMILUG

Scrollup

Pages

  • Home
  • Gửi tặng tác giả 1 cốc cà phê
  • Forum
  • Python tutorial
  • Top Posts
  • PE Rank!
  • About Us!

New FAMILUG

Loading...

The PyMiers

Loading...

Monday, 24 June 2013

Cài đặt server chat XMPP - ejabberd

XMPP (Extensible Messaging and Presence Protocol): trước đây là Jabber, là giao thức mở dựa trên nền tảng XML dùng trong nhắn tin nhanh (instant messaging) và thông tin hiện diện trực tuyến (presence information). (http://vi.wikipedia.org/wiki/XMPP) Mạng XMPP có thể dùng đơn lẻ: các máy trong mạng chat với nhau, hoặc kết nối với các hệ thống nhắn tin (instant messaging systems) khác - thông qua các gateway: máy của mạng nay chat được với máy thuộc mạng kia . Các hệ thống nhắn tin này có thể là 1 mạng XMPP khác hay mạng ICQ, google talk... Mỗi user của XMPP server được xác định bằng JID (jabberd id), gồm các thành phần: user_name@server_name/resource JID có phần giống 1 địa chỉ email: user_name@server_name resource để xác định tài khoản của bạn ở các client khác nhau (ở nhà/công ty/app điện thoại...) Ví dụ 1 jid của facebook: [email protected]/5864aa81_4DFDDEAC3F4A7 + d.tung.lam là username facebook + chat.facebook.com là server chat của facebook + 5864aa81_4DFDDEAC3F4A7 là resource giúp facebook nhận diện, quản lý được các client mình đang vào. Nếu user đăng nhập tài khoản này ở 1 máy khác thì resource sẽ thay đổi. message gửi đi ở dạng XML, có cấu trúc kiểu như:
<message from='[email protected]/3977137943137258301563176' to='[email protected]' type='chat' id='purpleb1ed9785'> <active xmlns='http://jabber.org/protocol/chatstates'/> <body>hello familug</body> </message>
trong đó chỉ ra người gửi, người nhận, nội dung message, id message ejabberd - là 1 XMPP server viết bằng Erlang Mình sẽ viết hướng dẫn cài đặt, cấu hình, khởi tạo user và xác thực bằng LDAP với ejabberd.

Cài đặt

mình cài trên: Ubuntu 12.04.2 LTS chọn domain: http://mysvr.com, nếu không để nguyên localhost cũng được thêm vào file hosts: 127.0.0.1 mysvr.com
sudo -s apt-get install ejabberd
vim /etc/ejabberd/ejabberd.cfg
Tìm dòng
{acl, admin, {user, "", "localhost"}}.
Thay bằng:
{acl, admin, {user, "lamdt", "mysvr.com"}}. lamdt - tên admin
Tìm
{hosts, ["localhost"]}.
Thêm vào
{hosts, ["localhost","mysvr.com"]}.
restart lại service
service ejabberd restart
Tạo tài khoản admin:
ejabberdctl register lamdt mysvr.com 123@456 lamdt - tên admin đã điền ở trên mysvr.com là domain 123@456 là password
Nếu báo User [email protected] successfully registered là bạn đã tạo thành công. Nếu chưa được kiểm tra lại hosts, username, đã restart service chưa?

Tạo user

Từ browser truy cập vào
http://mysvr.com:5280/admin username và password đã tạo ở trên lamdt - 123@456
Sau khi login, vào: Virtual Hosts > chọn host (mysvr.com) > User để tạo user chat. Ở đây mình tạo 2 user: [email protected] [email protected] Để test bạn đăng nhập cả 2 user test bằng 1 xmpp client - ở đây mình dùng pidgin, cấu hình như sau: Ctrl + m: Tạo 1 tin mới gửi đi. Kết quả:

Xác thực với LDAP

Giả sử bạn chạy server LDAP để xác thực cho các email mysvr.com tại ldap.domain.net Bạn có thể cấu hình như sau trong file ejabberd.cfg Cấu hình dưới này cho cây LDAP có cấu trúc: dc = mysvr, dc = com | |_ o=domains | |_ domainName=msvr.com | |_ ou=Users | | [email protected] | | [email protected] Phần Authentication, comment dòng
{auth_method, internal}.
%%{auth_method, internal}.
bỏ comment
%%{auth_method, ldap}. thành {auth_method, ldap}.
Để bỏ từ xác thực bình thường sang xác thực ldap. Bỏ comment và cấu hình như sau:
{ldap_servers, ["ldap.domain.net"]}. Kết nối bình thường thì để {ldap_encrypt, none}. Kết nối bảo mật thì để {ldap_encrypt, tls}. Cái này phụ thuộc vào server ldap của bạn dn quản trị ldap {ldap_rootdn, "cn=Manager,dc=mysvr,dc=com"}. mật khẩu quản trị {ldap_password, "****"}. Search base: {ldap_base, "o=domains,dc=mysvr,dc=com"}. Id của user trong LDAP, ở đây nhận diện = email {ldap_uids, [{"mail", "%[email protected]"}]}. Cái này để tạo lọc ra email của user khi search trong LDAP {ldap_filter, "(mail=*)"}.
Chú ý: Nếu bạn muốn dùng account LDAP để quản trị trang admin thì thêm vào
{acl, admin, {user, "a_user", "mysvr.com"}}.
Lưu lại và restart ejabberd. ======== Để tìm hiểu các modules của ejabberd thì vào đây: svn.process-one.net/ejabberd/tags/ejabberd-2.0.2/doc/guide.html#htoc35 Chi tiết hơn ở đây, sau khi đã cài: http://192.168.25.180:5280/admin/doc/guide.html#modoverview Các modules khuyên dùng: mod_muc: Tạo chat room mod_ping: giữ connection để không bị timeout khi inactive lâu

19 comments:

  1. H25 June 2013 at 18:20

    tut hay quá :xmỗi tội ứ hiểu anh cho tag LDAP làm gì =.=

    ReplyDeleteReplies
    1. Anonymous26 June 2013 at 08:11

      Mình sẽ viết hướng dẫn cài đặt, cấu hình, khởi tạo user và xác thực bằng LDAP với ejabberd.thím đọc title rồi comment à, (e chưa viết xong :3 )

      DeleteReplies
        Reply
    2. Reply
  2. Anonymous17 July 2013 at 11:08

    Hôm qua đọc về tạo contact list, mới chỉ biết tạo trên trang admin, chưa biết cho user tạo thế nào. lúc nào thành thạo sẽ bổ sung thêm @@

    ReplyDeleteReplies
      Reply
  3. Anonymous6 August 2013 at 10:06

    Update LDAP========Để tìm hiểu các modules của ejabberd thì vào đây:svn.process-one.net/ejabberd/tags/ejabberd-2.0.2/doc/guide.html#htoc35Chi tiết hơn ở đây, sau khi đã cài:http://192.168.25.180:5280/admin/doc/guide.html#modoverviewCác modules khuyên dùng:mod_muc: Tạo chat roommod_ping: giữ connection để không bị timeout khi inactive lâu

    ReplyDeleteReplies
    1. Anonymous6 August 2013 at 15:35

      EDIT: Chi tiết hơn ở doc này, chỉ đọc được sau khi đã cài ejabberd:http://localhost:5280/admin/doc/guide.html#modoverview

      DeleteReplies
        Reply
    2. Reply
  4. H6 August 2013 at 14:04

    http://192.168.25.180:5280/admin/doc/guide.html#modoverview ????link này sống bao lâu? nếu là 1 file text thì copy paste sang pastebin ấy

    ReplyDeleteReplies
    1. Anonymous6 August 2013 at 15:34

      `Sau khi đã cài`Ai quan tâm đến cái này -> cài, cài rồi thì vào url xem.Xem chơi thì link trên cũng được

      DeleteReplies
        Reply
    2. Reply
  5. H22 November 2013 at 23:19

    chuẩn bị viết bài cài XMPP server prosody, 5 phút là nhảy được :3

    ReplyDeleteReplies
      Reply
  6. mubeenfaisal3 October 2021 at 15:08

    It is included in my habit that I often visit blogs in my free time, so after landing on your blog. I have thoroughly impressed with it and decided to take out some precious time to visit it again and again. Thanks. what is a chatbot

    ReplyDeleteReplies
      Reply
  7. mubeen3 October 2021 at 19:10

    I am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. how to create a chatbot

    ReplyDeleteReplies
      Reply
  8. mubeen6 October 2021 at 13:08

    I exactly got what you mean, thanks for posting. And, I am too much happy to find this website on the world of Google. voice app company

    ReplyDeleteReplies
      Reply
  9. asad6 October 2021 at 17:19

    Attractive, post. I just stumbled upon your weblog and wanted to say that I have liked browsing your blog posts. After all, I will surely subscribe to your feed, and I hope you will write again soon! what is a chatbot

    ReplyDeleteReplies
      Reply
  10. Unknown10 November 2021 at 22:34

    My brother suggested I might like this website.He was entirely right. This post actually made my day.You cann’t imagine just how much time I had spent for thisinfo! Thanks!where can i buy counterfeit money online

    ReplyDeleteReplies
      Reply
  11. Unknown13 November 2021 at 20:19

    Attractive, post. buy fakemoney that looks real

    ReplyDeleteReplies
      Reply
  12. guns for sale near me16 November 2021 at 21:37

    My brother suggested I might like this website.He was entirely right. This post actually made my day.You cann’t imagine just how much time I had spent for thisinfo! Thanks! can you buy counterfeit money online

    ReplyDeleteReplies
      Reply
  13. Unknown17 November 2021 at 20:25

    interesting post. click my website for more..fake bills

    ReplyDeleteReplies
      Reply
  14. guns for sale near me1 December 2021 at 23:19

    amazing post alprostadil cream

    ReplyDeleteReplies
      Reply
  15. Unknown6 December 2021 at 17:09

    amazing check on my wesite for more like this tramadol online

    ReplyDeleteReplies
      Reply
  16. guns for sale near me13 December 2021 at 18:55

    Goodness, cool post. I might want to compose like this as well – setting aside time and genuine difficult work to make an extraordinary article… however I put things off something over the top and never appear to begin. check my website here for more where can i buy counterfeit money online

    ReplyDeleteReplies
      Reply
Add commentLoad more... Newer Post Older Post Home Subscribe to: Post Comments (Atom)

Gửi tặng tác giả 1 cốc cà phê/bia

Đăng ký học Python

Đăng ký học Python

Trích dẫn & Cảm ơn

Khi trích dẫn bài viết từ FAMILUG.org vui lòng ghi rõ nguồn FAMILUG.org (có .org).Đừng cảm ơn suông, hãy chia sẻ bài viết cho nhiều người hơn, đó là hành động!

Học cho vui - Vui thì học

  • Trở thành DevOps Engineer
  • Trở thành Linux sysadmin
  • Kubernetes
  • Hướng dẫn học Python
  • Serverless với Python
  • Học command line cơ bản
  • Nén và giải nén trên Linux
  • PyFML - lớp học python
  • Học lập trình Rust
  • Quản lý package trên Ubuntu
  • Lập trình viên ký (tâm hự)

Bài viết nóng - HOT!!!

  • Kiến trúc Docker, phỏng vấn, best practice
  • [SaltStack] Chào Muối, em là ai?
  • Nén, giải nén bằng command line trong Linux
  • Tài liệu và hướng dẫn học Python
  • Tặng mã giảm giá khóa học online "học AWS cloud thực hành với terraform"
  • LATEX-Chèn hình + mục lục
  • Tự viết 1 chương trình download nhạc từ nhaccuatui

Labels - Tem

Programing (133) Linux (118) Python (117) Command (99) sysadmin (85) Misc (75) CLI (61) Fun (56) Study (47) SomethingNew (44) Network (39) bash (38) Ubuntu (36) C (25) Tut (24) CCGU (22) vim (22) golang (19) Must-read (18) SmartUsing (16) yoyolove (16) Mạng (15) Ruby (13) PyFML (12) Book (11) Math (11) WeeklyVim (11) linux sysadmin (10) shell (10) Game (9) Firefox (8) học python (8) Announcement (7) Docker (7) Emotion (7) Eureka (7) Functional Programming (7) Latex (7) Matlab (7) Virtualization (7) go (7) scheme (7) system (7) tmux (7) virtualbox (7) BSD (6) C++ (6) Project (6) devops (6) hacking (6) kvm (6) nginx (6) python tutorial (6) Algorithm (5) DNS (5) JavaScript (5) Sticky (5) UNIX (5) apt-get (5) dpkg (5) email (5) find (5) git (5) guile (5) pandas (5) ps (5) terminal (5) Android (4) ArchLinux (4) CSS (4) DataScience (4) Django (4) K8s (4) Kubernetes (4) OOP (4) OS (4) OSX (4) ProjectEuler (4) base knowledge (4) debian (4) filesystem (4) grep (4) http server (4) monitoring (4) partition (4) pip (4) procps (4) programmer (4) pydemi (4) scipy (4) script (4) ssh (4) tcpdump (4) upstart (4) video (4) xargs (4) Apache (3) CLIC (3) Challenge (3) CodeGolf (3) Configuration management (3) DataAnalysis (3) Elixir (3) English (3) FMLB (3) FMLnews (3) HDD (3) HVN (3) MySQL (3) Problems (3) Programming (3) RAM (3) RaspberryPi (3) Rust (3) SSD (3) Windows (3) ag (3) apt (3) command lines (3) container (3) cron (3) crontab (3) curl (3) database (3) encode (3) hardware (3) init system (3) interview (3) ipython (3) kernel (3) list (3) lxc (3) memory (3) monitor (3) mutt (3) postfix (3) pulseaudio (3) regex (3) sudo (3) systemd (3) vagrant (3) vmware (3) web (3) Ansible (2) CI (2) Clip (2) CloudApp (2) Conclusion (2) Erlang (2) Exercise (2) FMLEXER (2) GPT (2) HTTP (2) Haskell (2) JSON (2) LDAP (2) MBR (2) ML (2) NodeJS (2) OpenBSD (2) PHP (2) Perl (2) Plan (2) PrC (2) Rails (2) SEO (2) SQL (2) Salt (2) SaltStack (2) UEFI (2) YAML (2) Youtube (2) alsa (2) awk (2) boolean (2) busybox (2) continuous integration (2) cp (2) cut (2) developer (2) dovecot (2) ebook (2) emacs (2) eminter25391 (2) exception (2) export (2) fdisk (2) fish (2) float (2) gitlab (2) gofml (2) gparted (2) iOS (2) imap (2) install (2) ip (2) kill (2) lambda (2) less (2) logging (2) lớp học python (2) machine learning (2) nameserver (2) netcat (2) nmap (2) npm (2) numpy (2) phongvan (2) pop3 (2) postgresql (2) printf (2) process (2) pyjobs (2) pymi (2) resolv.conf (2) security (2) service (2) sort (2) sound (2) sqlite (2) ss (2) swift (2) systemcall (2) tail (2) testing (2) top (2) tox (2) trello (2) tutorial (2) util-linux (2) vim-go (2) virtualenv (2) w3m (2) wifi (2) zsh (2) 1080p (1) 16.04 (1) 2 (1) 3G (1) 4G (1) 4k (1) 720p (1) API (1) AWS (1) ActionDispatch::Cookies::CookieOverflow (1) Active record (1) BIND (1) BIOS (1) Backup (1) Bitcoin (1) CGI (1) CTF (1) CVE (1) Counter (1) CyanogenMod (1) DE (1) DFBSD (1) DLNA (1) DP (1) DSN (1) DSUB (1) DVI-D (1) DragonFly BSD (1) ECMAScript (1) EFI (1) Editor (1) FAQ (1) FMLSummer (1) Famiwood (1) Foobar2000 (1) Founding (1) Fraction (1) FreeBSD (1) G01E01 (1) Gangnam Style (1) Gearman (1) Google (1) HDMI (1) HDTV (1) HH (1) HR (1) HTML (1) Introduction (1) JACK (1) JD (1) JS (1) JSON-RPC (1) JVM (1) Java (1) LISP (1) LRUcache (1) LTE (1) Lua (1) MIME (1) MUA (1) Mac (1) Mailing list (1) Man In The Middle (1) Mariadb (1) Microsoft Excel (1) Mozilla (1) NDS (1) Odoo (1) OpenERP (1) PaaS (1) Pokemon (1) Popen (1) Puppy Linux (1) PyFML07 (1) PyJS (1) Pyjamas (1) ROM (1) ROT13 (1) Radio (1) SASL (1) SLA (1) SMB (1) SMTP (1) SNI (1) SSL/TLS (1) SamSung (1) TWRP (1) UHD (1) UPnP (1) VBoxManage (1) VGA (1) VLC (1) WM (1) Wine (1) X (1) XMPP (1) adb (1) address (1) alsamixer (1) app (1) apt-cacher (1) apt-mirror (1) aptitude (1) argparse (1) automation (1) awesome (1) aws lambda (1) base64 (1) battery (1) bdb (1) binding (1) bit (1) bluelight (1) buy (1) byobu (1) byte (1) bzip (1) cabal (1) cache (1) caching (1) can chi (1) capability (1) cc1 (1) cc1plus (1) cdrom (1) cfdisk (1) changelog (1) chart (1) chat (1) check_output (1) check_procs (1) chiadoi (1) chmod (1) class (1) classmethod (1) clipboard (1) closure (1) cloudwatch (1) code (1) codec (1) codingstyle (1) collections (1) compiler (1) compress (1) computer science (1) computer vision (1) consul (1) copy (1) cpan (1) cpu (1) cpuinfo (1) crypto (1) ctags (1) cv (1) cổng kết nối (1) dash (1) datetime (1) dd (1) decode (1) default browser (1) desktop (1) development (1) device manager (1) dict (1) diff (1) dig (1) disown (1) dkim (1) dm (1) dm-crypt (1) dmarc (1) dmesg (1) docutils (1) dpkg-divert (1) dpkg-split (1) dpkg-statoverride (1) droidquest (1) du (1) dual boot (1) electric (1) elementary (1) encrypt (1) exit status (1) f.lux (1) fallocate (1) fd (1) fd-find (1) ffmpeg (1) file permission (1) finally (1) flashing (1) format (1) fractions (1) free (1) ftp (1) fucking-awesome-go (1) function (1) functools (1) g++ (1) gcc (1) gearman php (1) geeqie (1) gem (1) gitconfig (1) github (1) glob (1) globbing (1) gnu (1) go fonts (1) go get (1) go vet (1) gocode (1) graph (1) gtalk (1) guide (1) gvim (1) gwt (1) gzip (1) hash (1) hashicorp (1) hdb (1) health (1) hosting (1) htop (1) httpbin (1) httpd (1) i3 (1) i3wm (1) ibus (1) ifconfig (1) image (1) image viewer (1) imgur (1) inode (1) iostat (1) ipdb (1) iptables (1) itc (1) iterator (1) jar (1) jinja (1) jinja2 (1) job description (1) journalctl (1) joystick (1) jq (1) k3s (1) kodi (1) kyoto carbinet (1) language age (1) laptop (1) lda (1) ldd (1) library (1) listcomp (1) ln (1) locale (1) love (1) ls (1) lsblk (1) lvm (1) lxterminal (1) m17n (1) macvim (1) mail (1) mail spam (1) mailcap (1) mailinabox (1) man (1) manpage (1) map (1) max (1) md5 (1) mda (1) memcached (1) memoization (1) midi (1) midi controller (1) min (1) minidlna (1) mobile application (1) modulo (1) monospaced font (1) mount (1) mta (1) music (1) màn hình (1) nagios (1) namei (1) naming (1) nes (1) nestopia (1) netstat (1) nice (1) niceness (1) nohup (1) notebook (1) nproc (1) nrpe (1) number (1) opendkim (1) openldap (1) overthewire (1) package (1) package manager (1) parted (1) pastebinit (1) patch (1) pathogen (1) pavucontrol (1) pbcopy (1) pbpaste (1) pcm (1) pdb (1) pdf (1) pear (1) pep8 (1) pgrep (1) phg (1) photo manager (1) pidgin (1) ping (1) pmap (1) postgres (1) powershell (1) priority (1) privacy (1) privileged port (1) productivity (1) pty (1) pyjobs.vn (1) pylint (1) qjackctl (1) qsynth (1) quoting (1) rabbitmq (1) rational number (1) rbenv (1) recovery (1) recursion (1) redis (1) redshift (1) release (1) remote execution (1) reptyr (1) resolution (1) resolver (1) reverse proxy (1) rg (1) ripgrep (1) robotodyssey (1) robots.txt (1) rooting (1) rsync (1) runlevel (1) rust-lang (1) rxvt (1) s3 (1) samba (1) sambacry (1) screen (1) scryptsetup (1) search engine (1) seq (1) serverless (1) service discovery (1) setcap (1) setuptools (1) sha (1) sha256 (1) shared library (1) shellshock (1) shinken (1) signal (1) silversearcher (1) slack (1) sleep sort (1) snd (1) social media fingerprinting (1) sourcetree (1) spf (1) start-stop-daemon (1) startup (1) staticmethod (1) statsd (1) statvfs (1) string (1) strings (1) su (1) subprocess (1) super user (1) supervised learning (1) support (1) swap (1) symlink (1) sys (1) sysctl (1) syslog (1) sysstat (1) sysv (1) taglist (1) tail recursion (1) tar (1) tcl (1) tcp (1) temperature (1) terminology (1) terms (1) theme (1) thermal (1) thi (1) tig (1) tool (1) tr (1) tree (1) troi (1) try (1) twisted (1) udemy (1) unbound (1) unittest (1) unsupervised learning (1) update-alternatives (1) uptime (1) urxvt (1) usb (1) user (1) variable (1) vba (1) vbam (1) vietnamese tet (1) vim-pathogen (1) virtio (1) wannacry (1) watch (1) wc (1) web developer (1) web framework (1) wiki (1) xclip (1) xenial (1) xz (1) y2038 (1) youtube-dl (1) z.com (1) zip (1) zombie (1) điện (1) đề (1)

Blog Archive

  • ▼  2013 (156)
    • ▼  June (26)
      • [FMLEXER] tập thể dục với các bài lập trình đơn giản
      • Cài đặt server chat XMPP - ejabberd
      • YAML là gì?
      • suy nghĩ trong đêm
      • copy từ urxvt đến X clipboard
      • rsync - công cụ copy siêu đẳng
      • PLEAC - học các ngôn ngữ lập trình theo kiểu "perl...
      • git và tig là đôi bạn thân
      • Script hay làm bằng tay?
      • Những điều nhảm nhí khi học lập trình
      • [Editor] Sublime Text 2
      • [python] Tạo HTTP Server đơn giản bằng 1 dòng lệnh
      • [bash] Tắt máy tự động
      • Danh sách port và service tương ứng trên Linux
      • [CSS] Div layout
      • Xử lý text trên Linux
      • [LATEX] Đồ án tốt nghiệp đề tài "SỬ DỤNG SALTSTACK...
      • [vim] Hướng dẫn học dùng vim
      • WM và hành trình đi vào thế giới ArchLinux
      • [KVM] Tăng tốc máy ảo bằng virtio
      • [SmartUsing] Dùng github/bitbucket để lên kế hoạch...
      • Ý nghĩa của các câu lệnh Linux
      • [CSS] Dropdown menu
      • Thư viện trên Linux
      • CSS-Cách chèn code vào 1 trang web
      • Partitioning - Phân vùng ổ cứng

Total Pageviews

Từ khóa » Xmpp Tạo Ra Danh Tính