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):
<Location "/cam1"> ProxyPass "http://192.168.1.11:8080/" ProxyPassReverse "http://192.168.1.11:8080/" </Location>
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:
<VirtualHost *:80> <Location "/cam1"> ProxyPass "http://192.168.1.11:8080/" ProxyPassReverse "http://192.168.1.11:8080/" AuthType Basic AuthName "Acess to my first camera" AuthBasicProvider ldap AuthLDAPURL "ldap://localhost/dc=jaqb,dc=gda,dc=pl" NONE AuthLDAPBindDN "cn=administator,dc=jaqb,dc=gda,dc=pl" AuthLDAPBindPassword typeyourpasswordhere AuthLDAPGroupAttribute memberUid AuthLDAPGroupAttributeIsDN off Require ldap-user jakub </Location> </VirtualHost>
Now only user jakub (me ;-) can have access.
My ESP8266 devices are generating huge amount of logs so after some time LogAnalyzer database had over 5M records.
I've decided to delete old data, but before run purge script I want to backup these records.
The solution was quite simple:
mysqldump Syslog SystemEvents --where \ 'FromHost LIKE "ESP" AND DATE(ReceivedAt) < "2018-01-01"' \ > /data/Dokumenty/Syslog-ESP-2017.sql
where Syslog is database, and SystemEvents is table.
You can also export to CSV (TSV) format if You prefer:
mysql -e "SELECT * FROM SystemEvents \ WHERE FromHost LIKE 'ESP' AND DATE(ReceivedAt) < '2018-01-01' \ INTO OUTFILE '/data/Dokumenty/Syslog-ESP-2017.csv' \ FIELDS TERMINATED BY '\t' ENCLOSED BY '\"' \ LINES TERMINATED BY '\n'" Syslog
After this I could delete whole year, instead of using script:
mysql -e "DELETE FROM SystemEvents \ WHERE FromHost LIKE "ESP" AND DATE(ReceivedAt) < '2018-01-01'" \ Syslog
Now I've only about 600k records ;-)
To allow backuppc user to send emails I've to change permissions to /etc/msmtprc file:
chmod a+r /etc/msmtprc
Now I can send email as backuppc, but there is a problem with logging:
root@NAS:~# sudo -u backuppc /usr/sbin/sendmail jaqb@mydomain.com subject:test from:backuppc@nas this is a test sendmail: cannot log to /var/log/frontview/msmtp.log: \ cannot open: Permission denied sendmail: log info was: host=mail.mydomain.com tls=on auth=on \ user=jaqb from=jaqb@mydomain.com \ recipients=jaqb@mydomain.com mailsize=90 smtpstatus=250 \ smtpmsg='250 2.0.0 Ok: queued as E29FC1665F31' exitcode=EX_OK
(after "this is a test") you have to press Ctrl-D (end of file).
For identifying admin-permissions issues in desktop applications, ie. when everybody says to disable User Account Control (UAC), you can use LUA Buglight.
Add comment