Kerya techblog

Most Read Posts

  • Gentoo mail (postfix + postfixadmin + dovecot + amavisd-new + roundcube)
  • Zabbix - no such instance currently exists at this oid
  • LVM cant Boot - ALERT /dev/mapper/ubuntu--vg-root does not exist DROPPING to Shell -
  • liquidsoap-1.1.1 gentoo install
  • Laravel manual user register
  • Gentoo: php 5.6.0 + pecl-memcached 2.2.0 install script
  • Zabbix APC Smart UPS monitoring on FreeBSD with snmp
  • Squid 3.4 debian 7 install script
  • Подключение Foxgate S6224-S2 Ubuntu minicom
  • Abills
  • exim+dovecot+postfixadmin+clamav+spamassassin on FreeBSD
  • Openmeetings 2.1.1 Ubuntu 12.04.2 installation
  • libtool version mismatch pecl gentoo
  • Securing NTP
  • FreeBSD 9 ossec setup errors fix
  • fix for - corrupted record for package (pkgdep line without argument), ignoring
  • snmpd less verbose log FreeBSD (Connection from UDP messages)
  • Mikrotik no-ip ddns update script
  • Скопировать права mysql gentoo
  • mysql backup scripts
  1. Вы здесь:  
  2. Home
  • Home
  • Все статьи

Laravel manual user register

Подробности
Автор: Kirill

If you want to do this once-off, so there is no need for something fancy like creating an Artisan command etc. I would suggest to simply use php artisan tinker (great tool!) and add the following commands per user:

$user = new App\User();
$user->password = Hash::make('the-password-of-choice');
$user->email = Этот адрес электронной почты защищён от спам-ботов. У вас должен быть включен JavaScript для просмотра.';
$user->name = 'My Name';
$user->save();

https://stackoverflow.com/questions/35753951/manually-register-a-user-in-laravel

zabbix ssl monitoring

Подробности
Автор: Kirill

Tested on

FreeBSD 11

Zabbix 3.4

script /usr/local/etc/zabbix34/zabbix/externalscripts/sslinfo.sh :

#/bin/sh

expire_date=$(echo QUIT | timeout 3 openssl s_client -host "$NAME" -port "$PORT" -servername "$NAME" -showcerts /dev/null | sed -n '/BEGIN CERTIFICATE/,/END CERT/p' | openssl x509 -text 2>/dev/null | sed -n 's/ *Not After : *//p')

if [ -n "$expire_date" ]; then
expire_date_unix=$(date -j -f "%b %d %T %Y %Z" "$expire_date" '+%s')
else
expire_date_unix=0
fi

date_current=$(date "+%s")
secs_left=$(( $expire_date_unix-$date_current ))
days_left=$(date -j -f "%s" "$secs_left" '+%d' )

echo $days_left

Next go to zabbix, create new item:

name: "SSL cert example.com"

type: external check

key: sslinfo.sh[example.com]

 

 

 

Ubuntu vpn persistent connection

Подробности
Автор: Kirill

Чтобы впн переподключался после разрыва соединения:

nmcli connection modify <Your VPN connection name> vpn.persistent yes

Взято отсюда:

https://askubuntu.com/questions/679059/auto-reconnect-to-vpn-on-disconnect

Mikrotik stuff

Подробности
Автор: Kirill
  • mikrotik

Allow winbox from inet:

/ip firewall filter add chain=input protocol=tcp dst-port=8291 disabled=no action=accept place-before 0

move rule:

/ip firewall filter> move 14 destination=1

Port forwarding:

ip firewall nat add action=netmap chain=dstnat to-addresses=<server_dmz_address> to-ports=443 protocol=tcp in-interface=ether1 dst-port=443

NAT:

chain=srcnat action=masquerade src-address=192.168.1.0/24 log=no

 Terminal upgrade (ssh/telnet):

system package update check-for-updates
system package update print
system package update download
system reboot

 Backup/restore + script + scheduler

Based on https://www.technotrade.com.ua/Articles/beckup_config_mikrotik.php

 

 System - script - add

:log info "Starting Backup Script...";
:local sysname [/system identity get name];
:local sysver [/system package get system version];
:log info "Flushing DNS cache...";
/ip dns cache flush;
:delay 2;
:log info "Deleting last Backups...";
:foreach i in=[/file find] do={:if ([:typeof [:find [/file get $i name] "$sysname-backup-"]]!="nil") do={/file remove $i}};
:delay 2;
:local smtpserv [:resolve "supermailserver.com"];
:local smtpport "superport";
:local Eaccount "superЭтот адрес электронной почты защищён от спам-ботов. У вас должен быть включен JavaScript для просмотра.";
:local From "<deviceЭтот адрес электронной почты защищён от спам-ботов. У вас должен быть включен JavaScript для просмотра.>";
:local backupfile ("$sysname-backup-" . \
[:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . \
[:pick [/system clock get date] 4 6] . ".backup");
:log info "Creating new Full Backup file...";
/system backup save name=$backupfile;
:delay 2;
:log info "Sending Full Backup file via E-mail...";
/tool e-mail send from=$From to=$Eaccount server=$smtpserv \
port=$smtpport start-tls=no file=$backupfile \
subject=("$sysname Full Backup (" . [/system clock get date] . ")") \
body=("$sysname full Backup file see in attachment.\nRouterOS version: $sysver \
Time and Date stamp: " . [/system clock get time] . " " . \
[/system clock get date]);
:local exportfile ("$sysname-backup-" . \
[:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . \
[:pick [/system clock get date] 4 6] . ".rsc");
:log info "Creating new Setup Script file...";
/export verbose file=$exportfile;
:delay 2;
:log info "Sending Setup Script file via E-mail...";
/tool e-mail send from=$Form to=$Eaccount server=$smtpserv \
port=$smtpport start-tls=no file=$exportfile \
subject=("$sysname Setup Script Backup (" . [/system clock get date] . ")") \
body=("$sysname Setup Script file see in attachment.\nRouterOS version: $sysver\nTime and Date stamp: " . \
[/system clock get time] ." ". [/system clock get date]);
:delay 5;
:log info "All System Backups emailed successfully.Backup completed.";

 

/system scheduler add interval=1d name=backup_schedule on-event=backup_to_email start-date=apr/20/2019 start-time=03:12:50

 

https://wiki.mikrotik.com/wiki/Automated_Backups

 

 Vlan useful links:

https://lanmarket.ua/stats/bazovye-osnovy-nastroyki-vlan-v-routeros-na-oborudovanii-mikrotik-vlan-dlya-chaynikov-segmentatsiya

check-gateway=ping for dhcp default route:

1. set distance = 105

2. add a script in dhcp client config:

/ip route set [find where distance="105"] check-gateway=ping

 

 

  1. Gitlab + letsencrypt automated
  2. Virtualbox bridged networking on ubuntu host

Страница 7 из 17

  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

Search

Older Posts

  • Greenbone Vulnerability Manager (GVM) hacks (63)
  • elasticsearch cluster red status fix due to high watermark (61)
  • ubuntu arrow keys misbehaviour fix (72)
  • icinga IIS monitoring powershell error Get-WmiObject : Invalid namespace "root\WebAdministration" (84)
  • Make user superadmin in zabbix (81)
  • dnf Error: unknown option (111)
  • unpack pfx certificate (used for apache or nginx) (116)
  • mysql audit plugin build script (290)
  • mysql dump one row (95)
  • redmine 5 docker-compose (199)
  • gitlab runner dind docker-compose (143)
  • AWS S3 IAM policy to limit to single sub folder (146)
  • logrotate hints (197)
  • bash script to clean files to required percentage (322)
  • Ansible create LVM and mount (732)

Login Form

  • Забыли пароль?
  • Забыли логин?
  • Регистрация