Xmpp

在 ejabberd.ym 中授予新使用者管理權限時出現語法錯誤

  • July 12, 2016

在過去的幾個小時裡,我一直在嘗試設置ejabberd伺服器。我從原始碼建構了 ejabberd ,因為 ubuntu 儲存庫中的包有錯誤。無論如何,在從原始碼建構 ejabberd 之後,我將我的FQDN “s1.noureldin.local ”添加到我的 /etc/ejabberd/ejabberd.yml 文件中。

.
.
##   - "example.org"
##
hosts:
 - "localhost"
 - "s1.noureldin.local"
##
## route_subdomains: Delegate subdomains to other XMPP servers.
.
.

然後我創建了一個新使用者

ejabberdctl register admin1 s1.noureldin.local P@s5W0rd

然後我嘗試連接到我的 xmpp 伺服器,它成功

現在問題來了,當我嘗試授予新使用者管理員權限時,無法再啟動 ejabberd,並且我總是在日誌中收到語法錯誤

2016-07-12 12:00:10.733 [info] <0.7.0> Application lager started on node ejabberd@localhost
2016-07-12 12:00:10.977 [info] <0.7.0> Application crypto started on node ejabberd@localhost
2016-07-12 12:00:11.022 [info] <0.7.0> Application sasl started on node ejabberd@localhost
2016-07-12 12:00:11.084 [info] <0.7.0> Application asn1 started on node ejabberd@localhost
2016-07-12 12:00:11.084 [info] <0.7.0> Application public_key started on node ejabberd@localhost
2016-07-12 12:00:11.146 [info] <0.7.0> Application ssl started on node ejabberd@localhost
2016-07-12 12:00:11.171 [info] <0.7.0> Application fast_yaml started on node ejabberd@localhost
2016-07-12 12:00:11.198 [info] <0.7.0> Application fast_tls started on node ejabberd@localhost
2016-07-12 12:00:11.219 [info] <0.7.0> Application fast_xml started on node ejabberd@localhost
2016-07-12 12:00:11.231 [info] <0.7.0> Application stringprep started on node ejabberd@localhost
2016-07-12 12:00:11.245 [info] <0.7.0> Application cache_tab started on node ejabberd@localhost
2016-07-12 12:00:11.687 [info] <0.7.0> Application mnesia started on node ejabberd@localhost
2016-07-12 12:00:14.902 [info] <0.7.0> Application inets started on node ejabberd@localhost
2016-07-12 12:00:14.904 [error] <0.37.0>@ejabberd_config:get_plain_terms_file:257 Cannot load //etc/ejabberd/ejabberd.yml: Syntax error on line 423 at position 3: did not find expected key

這是我的 ejabberd.yml,你可以看到我嘗試過但沒有成功的所有語法:

.
.
.
max_fsm_queue: 1000

###.   ====================
###'   ACCESS CONTROL LISTS
acl:
 ##
 ## The 'admin' ACL grants administrative privileges to XMPP accounts.
 ## You can put here as many accounts as you want.
 ##
    admin:
      user:
      - "admin1@s1.noureldin.local"
 ######## I TRIED THESE AS WELL ########
 ##     - "admin1":"s1.noureldin.local"
 ##     - "admin1@s1.noureldin.local"
 ##
 ##   user: - "admin1@s1.noureldin.local"
 ##   - user: "admin1@s1.noureldin.local"

 ## Blocked users
 ##
 ## blocked:
 ##   user:
 ##     - "baduser@example.org"
 ##     - "test"

 ## Local users: don't modify this.
 ##
 local:
   user_regexp: ""

 ##
 ## More examples of ACLs
 ##
 ## jabberorg:
.
.
.

當我推薦這些行時,它再次起作用:

admin:
  user:
  - "admin1@s1.noureldin.local"

有人可以幫我解決這個問題嗎?我在網上和 ejabberd doc 中搜尋,所有人都使用我使用的相同語法,但對他們有效。

先感謝您。

好的,我發現了錯誤。ejabberd.yml文件是有意義的空格

並且每個子配置必須比其父配置多兩個空格,因此我的配置將變為:

acl:
 ##
 ## The 'admin' ACL grants administrative privileges to XMPP accounts.
 ## You can put here as many accounts as you want.
 ##
 admin:
   user:
     - "admin1@s1.noureldin.local"
 ##    - "aleksey@localhost"
 ##
 ## Blocked users

或者更清楚:

acl:   
 admin:
   user:
     - "admin1@s1.noureldin.local"

引用自:https://serverfault.com/questions/789329