Pārlūkot izejas kodu

Fix database recovery

Bob Mottram 10 gadus atpakaļ
vecāks
revīzija
b8627554d3
1 mainītis faili ar 135 papildinājumiem un 110 dzēšanām
  1. 135
    110
      beaglebone.txt

+ 135
- 110
beaglebone.txt Parādīt failu

@@ -3302,171 +3302,196 @@ Now visit your blog and follow the setup instructions, which are quite minimal.
3302 3302
 
3303 3303
 IRC is not an especially secure system.  For instance, even with the best encryption it's easily possible to imagine IRC-specific cribs which could be used by cryptanalytic systems.  However, we'll try to implement it in a manner which will at least give the surveillance aparatus something to ponder over.
3304 3304
 
3305
-First install some dependencies.
3305
+Because hybrid doesn't support OpenSSL by default, you have to do a manual patch to get it working.
3306 3306
 
3307 3307
 #+BEGIN_SRC: bash
3308
+cd ~/build
3309
+mkdir hybrid
3310
+cd hybrid
3308 3311
 apt-get update
3309 3312
 apt-get install build-essential openssl libssl-dev debhelper dpatch docbook-to-man flex bison libpcre3-dev screen
3313
+apt-get source ircd-hybrid
3310 3314
 #+END_SRC
3311 3315
 
3312
-Then get the source code for ircd-hybrid.
3316
+To enable SSL
3313 3317
 
3314 3318
 #+BEGIN_SRC: bash
3315
-mkdir ~/build
3316
-cd ~/build
3317
-wget http://freedombone.uk.to/ircd-hybrid-8.1.17.tgz
3319
+editor ircd-hybrid-*/debian/rules
3318 3320
 #+END_SRC
3319 3321
 
3320
-verify it.
3322
+At the top add:
3321 3323
 
3322 3324
 #+BEGIN_SRC: bash
3323
-sha256sum ircd-hybrid-8.1.17.tgz
3324
-440c9d86ba6bc930efef9cdaaec547b425c35cad3f08bed8df69e55788c1268a
3325
+USE_OPENSSL = 1
3325 3326
 #+END_SRC
3326 3327
 
3327
-Install it.
3328
+So the file should looks like:
3328 3329
 
3329 3330
 #+BEGIN_SRC: bash
3330
-tar -xzvf ircd-hybrid-8.1.17.tgz
3331
-cd ircd-hybrid-8.1.17
3332
-./configure --prefix=/usr/local/ircd --enable-openssl
3333
-make
3334
-make install
3331
+1# ...
3332
+2# Some useful stuff to edit here.
3333
+3# Beware: TOPICLEN may not exceed 390.
3334
+4NICKLEN = 15
3335
+5TOPICLEN = 350
3336
+6MAXCLIENTS = 200
3337
+7USE_OPENSSL = 1
3338
+8# ...
3335 3339
 #+END_SRC
3336 3340
 
3337
-Customise the configuration to your system, giving it a name and description.  In this example 192.168.1.60 is the static IP address on the BBB on the local network, so change that if necessary.
3341
+Save and exit, then rebuild the deb-file and install it:
3338 3342
 
3339 3343
 #+BEGIN_SRC: bash
3340
-chown -R irc:irc /usr/local/ircd
3341
-cp /usr/local/ircd/etc/reference.conf /usr/local/ircd/etc/ircd.conf
3342
-editor /usr/local/ircd/etc/ircd.conf
3344
+cd ircd-hybrid-*
3345
+dpkg-buildpackage -rfakeroot -uc -b
3346
+cd ..
3347
+dpkg -i ircd-hybrid_*.deb
3343 3348
 #+END_SRC
3344 3349
 
3345
-Set *name* to the domain name of your server, and set a description.
3346
-
3347
-Set a *network_name* and *network_desc*.  The network name should not contain any spaces.
3350
+Edit connect, listen and operator settings:
3348 3351
 
3349
-Set max_clients to 20, or however many you expect that you'll typically need.
3350
-
3351
-Within the admin section set your *name* and *email*.
3352
-
3353
-Within the *listen* section set host to your fixed IP address (in the earlier
3354
-sections it was 192.168.1.60).
3352
+#+BEGIN_SRC: bash
3353
+editor /etc/ircd-hybrid/ircd.conf
3354
+#+END_SRC
3355 3355
 
3356
-Within the *auth* section set user = "*@192.168.1.60" - or whatever the fixed IP address of the BBB is on your network - and password to the desired password for the IRC server.  If you don't wish to use a password then remove need_password from the flags.
3356
+Edit the connect section.  Set *name* to the name of your server, and set a description.
3357 3357
 
3358
-Within the *connect* section set *host* and *vhost* to your fixed IP address (in the earlier
3359
-sections it was 192.168.1.60) and *name* to your domain name.  Also set the *send/accept passwords* to your IRC login password.
3358
+#+BEGIN_SRC: c
3359
+connect {
3360
+        /* name: the name of the server */
3361
+        name = "myircdomainname.com";
3362
+Set a *network_name* and *network_desc*.
3363
+        /* host: the host or IP to connect to.  If a hostname is used it
3364
+         * must match the reverse dns of the server.
3365
+         */
3366
+        host = "127.0.0.1";
3367
+#+END_SRC
3360 3368
 
3361
-Within the *operator* section change *name* to the username/nick which you will user to irc@192.168.1.60
3369
+Set max_clients to 20.
3362 3370
 
3363
-Change *ssl_connection_required* to *yes*.
3371
+#+BEGIN_SRC: c
3372
+        /* passwords: the passwords we send (OLD C:) and accept (OLD N:).
3373
+         * The remote server will have these passwords reversed.
3374
+         */
3375
+        send_password = "password";
3376
+        accept_password = "password";
3377
+#+END_SRC
3364 3378
 
3365
-Save and exit, then restart the IRC server.  Open port 6697 on your internet router and forward it to the BBB.  Note that although ports 6665 to 6669 are active within the configuration file in practice we will only use the encrypted port.
3379
+Within the admin section set your *name* and *email*.
3366 3380
 
3367
-Ensure that the configuration is only readable by the root user.
3381
+Enable compression.
3368 3382
 
3369
-#+BEGIN_SRC: bash
3370
-chmod 600 /usr/local/ircd/etc/ircd.conf
3383
+#+BEGIN_SRC: c
3384
+        /* compressed: controls whether traffic is compressed via ziplinks.
3385
+         * By default this is disabled
3386
+         */
3387
+        compressed = yes;
3388
+};
3371 3389
 #+END_SRC
3372 3390
 
3373
-Now create an init script.
3391
+Within the *listen* section set host to your fixed IP address (in the earlier sections it was 192.168.1.60).
3374 3392
 
3375
-#+BEGIN_SRC: bash
3376
-adduser irc
3377
-#+END_SRC
3393
+#+BEGIN_SRC: c
3394
+/* listen {}: contain information about the ports ircd listens on (OLD P:) */
3395
+listen {
3396
+/* port: the specific port to listen on. if no host is specified
3397
+ * before, it will listen on all available IPs.
3398
+ *
3399
+ * ports are seperated via a comma, a range may be specified using ".."
3400
+ */
3378 3401
 
3379
-Make the password some long random string.
3402
+/* port: listen on all available IPs, ports 6665 to 6669 */
3403
+host = "127.0.0.1";
3404
+port = 6665 .. 6669;
3380 3405
 
3381
-#+BEGIN_SRC: bash
3382
-editor /usr/bin/runircd
3406
+/* sslport: ports to accept ONLY ssl connections on */
3407
+flags = ssl;
3408
+port = 6697
3409
+};
3383 3410
 #+END_SRC
3384 3411
 
3385
-Add the following:
3412
+Generate a password for the IRC operator using mkpasswd tool.
3386 3413
 
3387 3414
 #+BEGIN_SRC: bash
3388
-#!/bin/sh
3389
-USERNAME=irc
3390
-COMMAND="cd /usr/local/ircd/bin; ircd > /usr/local/ircd/ircd.log"
3391
-su -l $USERNAME -c '$COMMAND'
3415
+mkpasswd -Hmd5
3392 3416
 #+END_SRC
3393 3417
 
3394
-Save and exit.
3395
-
3396
-#+BEGIN_SRC: bash
3397
-chmod +x /usr/bin/runircd
3398
-editor /etc/init.d/ircd-hybrid
3399
-#+END_SRC
3418
+Search for operator block and change it to look like this, including the password which you just generated:
3400 3419
 
3401
-Add the following:
3420
+#+BEGIN_SRC: c
3421
+# ...
3422
+operator {
3423
+/* name: the name of the oper */
3424
+name = "root";
3402 3425
 
3403
-#+BEGIN_SRC: bash
3404
-#!/bin/bash
3405
-# /etc/init.d/ircd-hybrid
3406
-
3407
-### BEGIN INIT INFO
3408
-# Provides:          ircd-hybrid
3409
-# Required-Start:    $remote_fs $syslog
3410
-# Required-Stop:     $remote_fs $syslog
3411
-# Default-Start:     2 3 4 5
3412
-# Default-Stop:      0 1 6
3413
-# Short-Description: starts irc server
3414
-# Description:       starts irc server
3415
-### END INIT INFO
3416
-
3417
-# Author: Bob Mottram <bob@robotics.uk.to>
3418
-
3419
-#Settings
3420
-SERVICE='ircd-hybrid'
3421
-COMMAND="runircd"
3422
-USER='irc'
3423
-NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources
3424
-HISTORY=1024
3425
-INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
3426
-PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/sbin:/usr/sbin:/bin'
3426
+/* user: the user@host required for this operator. CIDR is not
3427
+ * supported. multiple user="" lines are supported.
3428
+ */
3429
+user = "*@*";
3427 3430
 
3431
+/* password: the password required to oper. By default this will
3432
+ * need to be encrypted using '/usr/bin/mkpasswd'.
3433
+ * WARNING: Please do not mix up the 'mkpasswd' program from
3434
+ * /usr/sbin with this one. If you are root, typing 'mkpasswd'
3435
+ * will run that one instead and you will receive a strange error.
3436
+ *
3437
+ * MD5 is supported. If you want to use it, use mkpasswd -Hmd5.
3438
+ */
3439
+password = "#MD5 PASSWORD HERE#";
3440
+# ...
3441
+#+END_SRC
3428 3442
 
3443
+Within the *auth* section set user = "*@192.168.1.60" - or whatever the fixed IP address of the BBB is on your network.
3429 3444
 
3445
+Save and exit.
3430 3446
 
3431
-irc_start() {
3432
-echo "Starting $SERVICE..."
3433
-su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USER
3434
-}
3447
+#+BEGIN_SRC: c
3448
+service ircd-hybrid restart
3449
+#+END_SRC
3435 3450
 
3451
+Now open ports 6665 to 6669 on your internet router/firewall.
3436 3452
 
3437
-irc_stop() {
3438
-echo "Stopping $SERVICE"
3439
-pkill ${COMMAND}
3440
-}
3453
+After connecting to IRC server you should see something like this:
3441 3454
 
3455
+#+BEGIN_SRC: bash
3456
+23:50 -!- - hybrid7.debian.local Message of the Day -
3457
+23:50 -!- -         _,met$$$$$gg.       ircd-hybrid 7.2.2
3458
+23:50 -!- -      ,g$$$$$$$$$$$$$$$P.    -----------------
3459
+23:50 -!- -    ,g$$P""       """Y$$.".
3460
+23:50 -!- -   ,$$P'              `$$$.  If you are seeing this, you have
3461
+23:50 -!- - ',$$P       ,ggs.     `$$b: installed the ircd-hybrid package and
3462
+23:50 -!- - `d$$'     ,$P"'   .    $$$  you are now connected to your new IRC
3463
+23:50 -!- -  $$P      d$'     ,    $$P  server -- congratulations.
3464
+23:50 -!- -  $$:      $$.   -    ,d$$'
3465
+23:50 -!- -  $$;      Y$b._   _,d$P'    Since you have just installed the
3466
+23:50 -!- -  Y$$.    `.`"Y$$$$P"'       package, there are some things you
3467
+23:50 -!- -  `$$b      "-.__            should do before going any further:
3468
+23:50 -!- -   `Y$$b
3469
+23:50 -!- -    `Y$$.                    1. Edit /etc/ircd-hybrid/ircd.conf to
3470
+23:50 -!- -      `$$b.                  suit your needs. Beware some options have
3471
+23:50 -!- -        `Y$$b.               been removed or moved into other blocks in
3472
+23:50 -!- -          `"Y$b._            the configuration file since
3473
+23:50 -!- -             `""""           ircd-hybrid 7.0.3.
3474
+23:50 -!- -
3475
+23:50 -!- -                             2. Edit /etc/ircd-hybrid/ircd.motd (this
3476
+23:50 -!- -                             MOTD) to suit your needs. You are free
3477
+23:50 -!- -                             to use this Debian swirl under the
3478
+23:50 -!- -                             Debian Open Use Logo License. :)
3479
+23:50 -!- -
3480
+23:50 -!- -                             3. Restart the server using invoke-rc.d
3481
+23:50 -!- -                             ircd-hybrid restart.
3482
+23:50 -!- -
3483
+23:50 -!- End of /MOTD command.
3484
+#+END_SRC
3442 3485
 
3443
-#Start-Stop here
3444
-case "$1" in
3445
-  start)
3446
-    irc_start
3447
-    ;;
3448
-  stop)
3449
-    irc_stop
3450
-    ;;
3451
-  restart)
3452
-    irc_stop
3453
-    sleep 10s
3454
-    irc_start
3455
-    ;;
3456
-    *)
3457
-  echo "Usage: $0 {start|stop|restart}"
3458
-  exit 1
3459
-  ;;
3460
-esac
3486
+If necessary you can change the message of the day with:
3461 3487
 
3462
-exit 0
3488
+#+BEGIN_SRC: bash
3489
+editor /etc/ircd-hybrid/ircd.motd
3463 3490
 #+END_SRC
3464 3491
 
3465
-Save and exit, then start the daemon.
3492
+The restart the irc server.
3466 3493
 
3467 3494
 #+BEGIN_SRC: bash
3468
-chmod +x /etc/init.d/ircd-hybrid
3469
-update-rc.d ircd-hybrid defaults
3470 3495
 service ircd-hybrid start
3471 3496
 #+END_SRC
3472 3497
 
@@ -7169,7 +7194,7 @@ mysqlcheck -c -u root --password=$MYSQL_ROOT_PASSWORD $DATABASE > $TEMPFILE
7169 7194
 
7170 7195
 # If it still contains errors then restore from backup
7171 7196
 if grep -q "Error" "$TEMPFILE"; then
7172
-    mysql -u root --password=$MYSQL_ROOT_PASSWORD $DATABASE -o < /var/backups/$DATABASE_daily.sql
7197
+    mysql -u root --password=$MYSQL_ROOT_PASSWORD $DATABASE -o < /var/backups/${DATABASE}_daily.sql
7173 7198
 
7174 7199
     # Send a warning email
7175 7200
     echo "$DATABASE database corruption could not be repaired. Restored from backup." | mail -s "Freedombone database maintenance" $EMAIL