When you want to use both of them to have to decide to which the clients will be connecting to. In my case packets goes to Dansguardian and then to Squid and finally to internet.
In standard configuration only Dansguardian knows clients IPs.
To provide user's IPs to Squid change Dansguardian configuration to forward them - change in dansguardian.conf (or dansguardianf1.conf, or whatever you have):
Be careful - if you don't use Squid (or some other secure proxy) you can publish you private IP addresses to whole world.
Then change Squid configuration (squid.conf) to allow to find the original source:
Of course restart both services.
It's pretty simple, but I forgot about this.
On CentOS 7 you can log all commands to syslog an then to local file or even to remote server.
Send all commands to syslog
Create file /etc/sysconfig/bash-prompt-xterm:
and change, to be executable:
Configure syslog to send messages from local6 facility to separate file
Create file /etc/rsyslog.d/bash.conf:
finally:
Now you can monitor commands:
Log command using audit
Alternatively you can use audit - create /etc/audit/rules.d/bash_history.rules:
but logs are not very human friendly:
and you may also want to log execvp, execl, execveat etc.
Sources:
https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server
https://unix.stackexchange.com/questions/86000/how-can-you-log-every-command-typed
http://whmcr.com/2011/10/14/auditd-logging-all-commands/
I've upgraded Pi-hole do 4.0 version:
as you can see I use new name (pihole/pihole), set power policy and additional --dns option - it's necessary.
Last time I've to manually edit /etc/resolve.conf inside container - this is simple workaround.
To backup running QEMU/KVM machine I use script made by Daniel Berteaud. I've installed it in this way:
as you can see current version is 0.2.17-1
There is also a fork of virt-backup: github.com/vazhnov/virt-backup.pl - it's based on some earlier version.
Example command to backup centos-test machine (name shown by virsh list) to /mnt/backups directory.
If you use ReadyNAS OS 6 you can install Pi-hole in Docker container:
you don't have to run
it will be done automatic (or rather automagic).
As You can see I've set up several parameters:
- run is command to docker to run container
- --name my-new-pi-hole is name of container (optional)
- -e means Environment Variable - it is to pass some options to container
- ServerIP - it is IP that Pi-hole should use (mandatory)
- DNS1 - IP of your DNS server (optional) - if you not provide it will use google's DNS
- WEBPASSWORD (useful) - you will need it to login to administration portal
- -d - tells to docker that this container should work in background
- -p - is port redirection from your docker machine to port in container
- 8080:80 (useful) - is redirection of 8080 port of your docker machine to port 80 in container
- 53:53 (optional)- is redirection of 53 port of your docker machine to port 53 in container (not necessary in my case)
- 53:53/udp (very useful) - is the same for UDP port - this is what we need to work
- diginc/pi-hole - is of course name of image to run
Now you can use command
to get some information about your container
as you can see status is health: starting, after some time it will change to healthy.
Now you can login to (192.168.1.28 is address of may docker machine) http://192.168.1.28:8080/admin/ to check that no one has used your server (Total queries 0).
Let's check if it works:
Yes!
Now it's enough to change default DNS in your LAN to your docker machine (in my case 192.168.1.28).
If your proxy server (squid and/or dansguardian) is not on your gateway you can also set it up to be transparent.
In my examples gateway ha address 192.168.1.1, and squid server has address 192.168.1.28 and listen on 8080 port.
There is configuration using iptables directly:
and this is the same in Gargoyle /etc/config/firewall file (you can edit it or use uci add firewall commands):
after editing /etc/config/firewall file you have to restart firewall:
I tried to monitor my flat using old phone as web camera (should be replaced with IP camera). It's quite simple using one of many Android apps (IP Webcam by Pavel Khlebovich in my case).
Since I do not have public IP I had to use OpenVPN to my home network:
|
My phone/camera has address 192.168.1.11 (Home LAN network). To have access to it from Internet, I had to add this to cameras.conf file (in /etc/httpd/conf.d directory):
Now I can see what is happening typing http://cameras.jaqb.gda.pl/cam1 in web browser.
What is worse anyone can see. To protect my own privacy I've added authentication, so whole file looks like this:
Now only user jakub (me ;-) can have access.
For identifying admin-permissions issues in desktop applications, ie. when everybody says to disable User Account Control (UAC), you can use LUA Buglight.
If you want to create certificates for OpenVPN you have to set two additional options in section usr_cert in /etc/pki/tls/openssl.cnf file:
of course nsCertType have to be server when you generate certificate for OpenVPN server and client for client certificates.
This options are required when you OpenVPN options ns-cert-type and remote-cert-tls.
Sources:
Edit /etc/pki/tls/openssl.cnf file and change in CA_default section, of course You have to adopt it, ie. change name to yours ;-):
because, I've changed default directory I have to create some files and directories:
Generate self-signed CA certificate for 5 years (5*365=1825 days):
It's very important to remember password! You will need them for 5 years every time you will generate certificate.
Generate first certificate:
In most cases you have to provide only Common Name. Now you have new vpn.crs (certificate signing request) file.
Sign it:
Of course you have to enter CA password.
You have to revoke old certificate if you want to generate new certificate with same Common Name. To revoke certificate use command:
That's all.
To convert data to human readable data:
- Certificate Signing Request (CSR)
- Private key
- Certificate

Add comment