Skip to content

Commit b0b7a94

Browse files
committed
docs: compile and setup squid from source in SPO guide
1 parent 936ffe2 commit b0b7a94

File tree

1 file changed

+113
-15
lines changed

1 file changed

+113
-15
lines changed

docs/website/root/manual/getting-started/run-signer-node.md

Lines changed: 113 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ systemctl status mithril-signer.service
429429
Finally, monitor the logs of the service:
430430

431431
```bash
432-
tail /var/log/syslog
432+
tail -f /var/log/syslog | grep mithril-signer
433433
```
434434

435435
### Activate Prometheus endpoint
@@ -507,20 +507,73 @@ sudo systemctl restart mithril-signer
507507
508508
:::
509509
510-
### Configuring the Squid service
510+
### Building Squid from source
511511
512512
:::info
513513
514-
The **Mithril relay** node serves as a forward proxy, relaying traffic between the **Mithril signer** and the **Mithril aggregator**. When appropriately configured, it facilitates the security of the **block-producing** node. You can use `squid` to operate this forward proxy, and this section presents a recommended configuration.
514+
- If you have already installed `Squid` via `apt` package manager, we recommend that you delete it before manually building it from source by running the commands: `sudo apt remove squid` and `sudo apt autoremove`.
515+
516+
- The FAQ for compiling `Squid` is available [here](https://wiki.squid-cache.org/SquidFaq/CompilingSquid).
517+
518+
- You will need a C++ compiler that can be installed with `sudo apt install build-essential` command.
515519
516520
:::
517521
518-
Verify that the service was correctly configured at installation:
522+
On the [Squid page listing released versions](https://www.squid-cache.org/Versions/) identify the latest stable released version (currently `6.8`) and download it:
523+
524+
```bash
525+
wget https://www.squid-cache.org/Versions/v6/squid-6.8.tar.gz
526+
```
527+
528+
Uncompress the downloaded archive, and change directory:
529+
```bash
530+
tar xzf squid-6.8.tar.gz
531+
cd squid-6.8
532+
```
533+
534+
Then, configure the compilation:
535+
```bash
536+
./configure \
537+
--prefix=/opt/squid \
538+
--localstatedir=/opt/squid/var \
539+
--libexecdir=/opt/squid/lib/squid \
540+
--datadir=/opt/squid/share/squid \
541+
--sysconfdir=/etc/squid \
542+
--with-default-user=squid \
543+
--with-logdir=/opt/squid/var/log/squid \
544+
--with-pidfile=/opt/squid/var/run/squid.pid
545+
```
546+
547+
Compile the sources:
548+
```bash
549+
make
550+
```
551+
552+
And install `squid` binary:
553+
```bash
554+
sudo make install
555+
```
556+
557+
Optionally, verify that the version is correct:
558+
```bash
559+
/opt/squid/sbin/squid -v
560+
```
519561
562+
You should see a result like this:
520563
```bash
521-
sudo systemctl status squid
564+
Squid Cache: Version 6.8
565+
Service Name: squid
566+
configure options: '--prefix=/opt/squid' '--localstatedir=/opt/squid/var' '--libexecdir=/opt/squid/lib/squid' '--datadir=/opt/squid/share/squid' '--sysconfdir=/etc/squid' '--with-default-user=squid' '--with-logdir=/opt/squid/var/log/squid' '--with-pidfile=/opt/squid/var/run/squid.pid'
522567
```
523568
569+
### Configuring the Squid proxy
570+
571+
:::info
572+
573+
The **Mithril relay** node serves as a forward proxy, relaying traffic between the **Mithril signer** and the **Mithril aggregator**. When appropriately configured, it facilitates the security of the **block-producing** node. You can use `squid` to operate this forward proxy, and this section presents a recommended configuration.
574+
575+
:::
576+
524577
Make a copy of the original configuration:
525578
526579
```bash
@@ -657,33 +710,78 @@ With this configuration, the proxy will:
657710
- anonymize completely the traffic and avoid disclosing any information about the block-producing machine
658711
- deny all other traffic
659712
660-
Restart the service:
713+
:::info
714+
715+
:::
716+
717+
### Installing the service
718+
719+
Create (or re-use) an unpriviledged system user on the machine:
720+
```bash
721+
sudo adduser --system --no-create-home --group squid
722+
```
723+
724+
Change ownership of `/opt/squid/var` directory:
725+
```bash
726+
sudo chown squid -R /opt/squid/var/
727+
sudo chgrp squid -R /opt/squid/var/
728+
```
729+
730+
Create a `/etc/systemd/system/squid.service` description file for the service:
731+
```bash
732+
sudo bash -c 'cat > /etc/systemd/system/squid.service << EOF
733+
[Unit]
734+
Description=Squid service
735+
StartLimitIntervalSec=0
736+
737+
[Service]
738+
Type=simple
739+
Restart=always
740+
RestartSec=60
741+
User=squid
742+
Group=squid
743+
ExecStart=/opt/squid/sbin/squid -f /etc/squid/squid.conf
744+
745+
[Install]
746+
WantedBy=multi-user.target
747+
EOF'
748+
```
749+
750+
Reload the service configuration (optional):
661751
662752
```bash
663-
sudo systemctl restart squid
753+
sudo systemctl daemon-reload
664754
```
665755
666-
Ensure it runs properly:
756+
Then, start the service:
667757
668758
```bash
669-
sudo systemctl status squid
759+
sudo systemctl start squid
670760
```
671761
672-
Finally, monitor service logs:
762+
Register the service to start on boot:
673763
674764
```bash
675-
tail /var/log/syslog
765+
sudo systemctl enable squid
676766
```
677767
678-
:::info
768+
Monitor the status of the service:
679769
680-
Here is the command to see squid access logs:
770+
```bash
771+
systemctl status squid
772+
```
773+
774+
Finally, monitor the logs of the service:
681775
682776
```bash
683-
tail /var/log/squid/access.log
777+
tail -f /var/log/syslog | grep squid
684778
```
685779
686-
:::
780+
And monitor squid access logs:
781+
782+
```bash
783+
tail -f /opt/squid/var/log/squid/access.log
784+
```
687785
688786
### Firewall configuration
689787

0 commit comments

Comments
 (0)