Ngircd.Link 8.8 KB

12345678910111213141516171819
  1. version=pmwiki-2.2.130 ordered=1 urlencoded=1
  2. agent=Mozilla/5.0 (X11; OpenBSD amd64; rv:82.0) Gecko/20100101 Firefox/82.0
  3. author=jrmu
  4. charset=UTF-8
  5. csum=
  6. ctime=1612973229
  7. host=198.251.81.119
  8. name=Ngircd.Link
  9. rev=2
  10. targets=Openbsd.Dns,Openbsd.Hopm,Openbsd.Passwords
  11. text=In the server block, for Host, it is better to use a [[openbsd/dns|symbolic hostname]] (don't use an IP address).%0a%0a[@%0a[Server]%0a Name = irc.example.ircnow.org%0a Host = irc.example.ircnow.org%0a Port = 6667%0a MyPassword = password12345%0a PeerPassword = password12345%0a@]%0a%0aNotice that Host = irc.example.ircnow.org and not an IP address like 1.2.3.4. This makes it less work to configure when the other server changes its IP address.%0a%0a!! Autostart%0a%0aTo automatically restart ngIRCd if it was terminated unexpectedly, create a script in /usr/local/libexec/project/ngircd.sh:%0a%0a[@%0adoas touch /usr/local/libexec/project/ngircd.sh%0adoas chmod +x /usr/local/libexec/project/ngircd.sh%0a@]%0a%0aInside /usr/local/libexec/project/ngircd.sh:%0a%0a[@%0a#!/bin/sh%0a%0aSERVICE_NAME="ngircd"%0aSERVICE_USER="_ngircd"%0aSERVICE_PID="/var/ngircd/var/run/ngircd/ngircd.pid"%0a%0aif ! pgrep -u $SERVICE_USER -x "$SERVICE_NAME" > /dev/null%0athen%0a if [ -f $SERVICE_PID ]; then%0a rm -f $SERVICE_PID%0a rcctl -d start $SERVICE_NAME%0a fi%0afi%0a@]%0a%0aAdd this as a cronjob:%0a%0a[@%0a$ doas crontab -e%0a%0a* * * * * /usr/local/libexec/project/checker_ngircd.sh > /dev/null 2>&1%0a@]%0a%0aFor the solution to work, you need to enable the use of pid files in /etc/ngircd/ngircd.conf:%0a[@%0aPidFile = /var/run/ngircd/ngircd.pid%0a@]%0a%0aMake sure to configure [[openbsd/hopm|hopm]].%0a%0a%0a%0a%0a%0a=== Example ngIRCd server configurations ===%0aTo illustrate what I mean is, say for example, you have two ''ngircd'' servers that you want to connect to each other. Let's say that the server "foo" has this configuration,%0a[@%0a[Global]%0a Name = irc.foo.org%0a Ports = 6667%0a...%0a[Server]%0a MyPassword = Jp5meaikMiRAKsbBy6G6%0a@]%0a%0aServer "bar" has the following configuration,%0a[@%0a[Global]%0a Name = irc.bar.org%0a Ports = 6667%0a...%0a[Server]%0a MyPassword = HpNSbcDbrTVQ3lkkqSfq%0a@]%0a%0a[@%0a[Server]%0a Name = irc.bar.org%0a Host = irc.bar.org%0a Port = 6667%0a MyPassword = Jp5meaikMiRAKsbBy6G6%0a PeerPassword = HpNSbcDbrTVQ3lkkqSfq%0a@]%0a%0aLikewise under server "bar",%0a[@%0a[Server]%0a Name = irc.foo.org%0a Host = irc.foo.org%0a Port = 6667%0a MyPassword = HpNSbcDbrTVQ3lkkqSfq%0a PeerPassword = Jp5meaikMiRAKsbBy6G6%0a@]%0a%0aSysadmins should have proper [[openbsd/passwords|password management]].%0a%0aKeep in mind that ''MyPassword'' is used for linking with other servers. **It is stored in plaintext and has nothing to do with the server password specified under [Global] section, nor is it related to your [Operator] password!**. When other servers connects to you, they **need** to know **your** ''MyPassword'', in which they will then set it as their ''PeerPassword'' on their end. The same thing likewise when you need to peer with them, you **need** to know their ''MyPassword'' so that you can set it as **your** ''PeerPassword''.%0a%0aSee how in the example above how ''irc.foo.org'' ''MyPassword'' is set as ''Jp5meaikMiRAKsbBy6G6'' but when linking with ''irc.bar.org'', whose ''MyPassword'' is set as ''HpNSbcDbrTVQ3lkkqSfq'', that ''irc.foo.org'' ''PeerPassword'' is therefore ''HpNSbcDbrTVQ3lkkqSfq'' for linking to ''irc.bar.org''? The same logic also applies in reverse for when ''irc.bar.org'' is to link up with ''irc.foo.org''.%0a%0a=== Summing it up ===%0aTo sum it up in the prior example,%0aServer ''irc.foo.org'' has the following for ''irc.bar.org'',%0a[@%0a[Server]%0a Name = irc.bar.org%0a Host = irc.bar.org%0a Port = 6667%0a MyPassword = Password_To_Be_Set_On_IRCBARORG's_PeerPassword%0a PeerPassword = Password_That_Is_To_Be_received_from_owner_of_IRCBARORG's_MyPassword%0a@]%0aand the same likewise, for ''irc.bar.org'' when linking to ''irc.foo.org'',%0a[@%0a[Server]%0a Name = irc.foo.org%0a Host = irc.foo.org%0a Port = 6667%0a MyPassword = Password_To_Be_Set_On_IRCFOOORG's_PeerPassword%0a PeerPassword = Password_That_Is_To_Be_received_from_owner_of_IRCFOOORG's_MyPassword%0a@]%0a
  12. time=1612973765
  13. author:1612973765=jrmu
  14. diff:1612973765:1612973229:=0a1%0a> %0a55,125d55%0a%3c %0a%3c %0a%3c %0a%3c %0a%3c %0a%3c === Example ngIRCd server configurations ===%0a%3c To illustrate what I mean is, say for example, you have two ''ngircd'' servers that you want to connect to each other. Let's say that the server "foo" has this configuration,%0a%3c [@%0a%3c [Global]%0a%3c Name = irc.foo.org%0a%3c Ports = 6667%0a%3c ...%0a%3c [Server]%0a%3c MyPassword = Jp5meaikMiRAKsbBy6G6%0a%3c @]%0a%3c %0a%3c Server "bar" has the following configuration,%0a%3c [@%0a%3c [Global]%0a%3c Name = irc.bar.org%0a%3c Ports = 6667%0a%3c ...%0a%3c [Server]%0a%3c MyPassword = HpNSbcDbrTVQ3lkkqSfq%0a%3c @]%0a%3c %0a%3c [@%0a%3c [Server]%0a%3c Name = irc.bar.org%0a%3c Host = irc.bar.org%0a%3c Port = 6667%0a%3c MyPassword = Jp5meaikMiRAKsbBy6G6%0a%3c PeerPassword = HpNSbcDbrTVQ3lkkqSfq%0a%3c @]%0a%3c %0a%3c Likewise under server "bar",%0a%3c [@%0a%3c [Server]%0a%3c Name = irc.foo.org%0a%3c Host = irc.foo.org%0a%3c Port = 6667%0a%3c MyPassword = HpNSbcDbrTVQ3lkkqSfq%0a%3c PeerPassword = Jp5meaikMiRAKsbBy6G6%0a%3c @]%0a%3c %0a%3c Sysadmins should have proper [[openbsd/passwords|password management]].%0a%3c %0a%3c Keep in mind that ''MyPassword'' is used for linking with other servers. **It is stored in plaintext and has nothing to do with the server password specified under [Global] section, nor is it related to your [Operator] password!**. When other servers connects to you, they **need** to know **your** ''MyPassword'', in which they will then set it as their ''PeerPassword'' on their end. The same thing likewise when you need to peer with them, you **need** to know their ''MyPassword'' so that you can set it as **your** ''PeerPassword''.%0a%3c %0a%3c See how in the example above how ''irc.foo.org'' ''MyPassword'' is set as ''Jp5meaikMiRAKsbBy6G6'' but when linking with ''irc.bar.org'', whose ''MyPassword'' is set as ''HpNSbcDbrTVQ3lkkqSfq'', that ''irc.foo.org'' ''PeerPassword'' is therefore ''HpNSbcDbrTVQ3lkkqSfq'' for linking to ''irc.bar.org''? The same logic also applies in reverse for when ''irc.bar.org'' is to link up with ''irc.foo.org''.%0a%3c %0a%3c === Summing it up ===%0a%3c To sum it up in the prior example,%0a%3c Server ''irc.foo.org'' has the following for ''irc.bar.org'',%0a%3c [@%0a%3c [Server]%0a%3c Name = irc.bar.org%0a%3c Host = irc.bar.org%0a%3c Port = 6667%0a%3c MyPassword = Password_To_Be_Set_On_IRCBARORG's_PeerPassword%0a%3c PeerPassword = Password_That_Is_To_Be_received_from_owner_of_IRCBARORG's_MyPassword%0a%3c @]%0a%3c and the same likewise, for ''irc.bar.org'' when linking to ''irc.foo.org'',%0a%3c [@%0a%3c [Server]%0a%3c Name = irc.foo.org%0a%3c Host = irc.foo.org%0a%3c Port = 6667%0a%3c MyPassword = Password_To_Be_Set_On_IRCFOOORG's_PeerPassword%0a%3c PeerPassword = Password_That_Is_To_Be_received_from_owner_of_IRCFOOORG's_MyPassword%0a%3c @]%0a
  15. host:1612973765=198.251.81.119
  16. author:1612973229=jrmu
  17. diff:1612973229:1612973229:=1,55d0%0a%3c %0a%3c In the server block, for Host, it is better to use a [[openbsd/dns|symbolic hostname]] (don't use an IP address).%0a%3c %0a%3c [@%0a%3c [Server]%0a%3c Name = irc.example.ircnow.org%0a%3c Host = irc.example.ircnow.org%0a%3c Port = 6667%0a%3c MyPassword = password12345%0a%3c PeerPassword = password12345%0a%3c @]%0a%3c %0a%3c Notice that Host = irc.example.ircnow.org and not an IP address like 1.2.3.4. This makes it less work to configure when the other server changes its IP address.%0a%3c %0a%3c !! Autostart%0a%3c %0a%3c To automatically restart ngIRCd if it was terminated unexpectedly, create a script in /usr/local/libexec/project/ngircd.sh:%0a%3c %0a%3c [@%0a%3c doas touch /usr/local/libexec/project/ngircd.sh%0a%3c doas chmod +x /usr/local/libexec/project/ngircd.sh%0a%3c @]%0a%3c %0a%3c Inside /usr/local/libexec/project/ngircd.sh:%0a%3c %0a%3c [@%0a%3c #!/bin/sh%0a%3c %0a%3c SERVICE_NAME="ngircd"%0a%3c SERVICE_USER="_ngircd"%0a%3c SERVICE_PID="/var/ngircd/var/run/ngircd/ngircd.pid"%0a%3c %0a%3c if ! pgrep -u $SERVICE_USER -x "$SERVICE_NAME" > /dev/null%0a%3c then%0a%3c if [ -f $SERVICE_PID ]; then%0a%3c rm -f $SERVICE_PID%0a%3c rcctl -d start $SERVICE_NAME%0a%3c fi%0a%3c fi%0a%3c @]%0a%3c %0a%3c Add this as a cronjob:%0a%3c %0a%3c [@%0a%3c $ doas crontab -e%0a%3c %0a%3c * * * * * /usr/local/libexec/project/checker_ngircd.sh > /dev/null 2>&1%0a%3c @]%0a%3c %0a%3c For the solution to work, you need to enable the use of pid files in /etc/ngircd/ngircd.conf:%0a%3c [@%0a%3c PidFile = /var/run/ngircd/ngircd.pid%0a%3c @]%0a%3c %0a%3c Make sure to configure [[openbsd/hopm|hopm]].%0a
  18. host:1612973229=198.251.81.119