Архив за месяц: Июнь 2013

Обработка входящих звонков/SMS Мегафон модем CentOS

Начало
Centos EMail to SMS мегафон модем E1550

[root@mng ~]# cat /etc/smsd.conf
devices = GSM1
incoming=/var/spool/sms/incoming
outgoing=/var/spool/sms/outgoing
checked=/var/spool/sms/checked
sent=/var/spool/sms/sent
logfile = /var/log/smsd/smsd.log
loglevel = 7 #debug = 7
smart_logging = yes

[GSM1]
device = /dev/ttyUSB1
baudrate = 115200
rtscts = no
init = at+cpms="sm","sm",""
incoming = yes
incoming = high
eventhandler = /usr/local/sbin/smshandler
eventhandler_ussd = /usr/local/sbin/smshandler
[root@mng ~]#

Читать далее

Centos EMail to SMS мегафон модем E1550

[root@mng ~]#wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
[root@mng ~]#rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
[root@mng ~]#rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
[root@mng ~]#yum install usb_modeswitch
[root@mng ~]#yum install minicom 
[root@mng ~]#yum install smstools usbtools
[root@mng ~]#minicom -s

Читать далее

Ubuntu монтирование Yandex disk

root@mail:~$ sudo apt-get install davfs2
root@mail:~$ sudo mkdir /mnt/yandex_disk

root@mail:~# sudo mount -t davfs https://webdav.yandex.ru /mnt/yandex_disk/
Please enter the username to authenticate with server
https://webdav.yandex.ru or hit enter for none.
  Username: user@yandex.ru
Please enter the password to authenticate user user@yandex.ru with server
https://webdav.yandex.ru or hit enter for none.
  Password:
root@mail:~#

root@mail:~# df -h /mnt/yandex_disk/
Файл.система             Размер Использовано  Дост Использовано% Cмонтировано в
https://webdav.yandex.ru   8,0G         4,6G  3,5G           58% /mnt/yandex_disk

root@mail:~$ sudo echo '/mnt/yandex_disk user@yandex.ru P\@SS' >> /etc/davfs2/secrets

root@mail:~$ sudo umount /mnt/yandex_disk

root@mail:~$ sudo mount -t davfs https://webdav.yandex.ru /mnt/yandex_disk/

root@mail:~# ls /mnt/yandex_disk/

Cisco EEM CPU мониторинг

vpn(config)#resource policy
vpn(config-erm)#policy HighCPU global
vpn(config-erm-policy)#system
vpn(config-policy-node)#cpu total
vpn(config-owner-cpu)#critical rising 90 interval 5
vpn(config-owner-cpu)#major rising 70 interval 10
vpn(config-owner-cpu)#user global HighCPU
vpn(config-erm)#event manager applet CPU
vpn(config-applet)# event resource policy "HighCPU"
vpn(config-applet)# action 1 cli command "enable"
vpn(config-applet)# action 2 cli command " show processes cpu sorted 5min | inc utilization|[1-9]\...%"
vpn(config-applet)# action 3 mail server $_email_server to $_email_to from $_email_from subject "Cisco High CPU" body "$_cli_result"
vpn(config-applet)#event manager environment _email_server 192.168.0.2
vpn(config)#event manager environment _email_from eem@iamroot.ru
vpn(config)#event manager environment _email_to eem@iamroot.ru
vpn(config)#

ssl vpn Cisco any connect

aaa new-model
aaa authentication login sslvpn local
!
username admin secret P@SSSW)RD
!
crypto key generate rsa label iamroot-rsa-keys modulus 1024
!
crypto vpn anyconnect flash:/webvpn/anyconnect-win-3.1.00495-k9.pkg sequence 1
!
ip local pool webvpn-pool 192.168.1.80 192.168.1.85
!
webvpn gateway Cisco-WebVPN-Gateway
ip address XXX.XXX.XXX.XXX port 443
ssl encryption rc4-md5
ssl trustpoint my-trustpoint
inservice
!
webvpn context Cisco-WebVPN
title " WebVPN Gateway"
!
acl "ssl-acl"
permit ip 192.168.1.0 255.255.255.0 192.168.1.0 255.255.255.0
login-message "Cisco Secure WebVPN"
!
policy group webvpnpolicy
functions svc-required
functions svc-enabled
filter tunnel ssl-acl
svc address-pool "webvpn-pool" netmask 255.255.255.0
svc rekey method new-tunnel
svc split include 192.168.1.0 255.255.255.0
default-group-policy webvpnpolicy
aaa authentication list sslvpn
gateway Cisco-WebVPN-Gateway
max-users 2
!
ssl authenticate verify all
!
url-list "rewrite"
inservice

Отключение wifi в в нерабочее время

Задача: Гасить wifi интерфейс на точке в нерабочее время
Решение:

sntp server 192.168.0.1
clock timezone MSK +4
event manager environment _disable_ifname dot11radio0
!
event manager applet DisableInterface
 event timer cron name DisableInterface cron-entry "0 22 * * *"
 action 1.0 cli command "enable"
 action 1.1 cli command "configure terminal"
 action 1.5 cli command "interface $_disable_ifname"
 action 1.6 cli command "shutdown"
!
event manager applet EnableInterface
 event timer cron name EnableInterface cron-entry "0 7 * * *"
 action 1.0 cli command "enable"
 action 1.1 cli command "configure terminal"
 action 1.5 cli command "interface $_disable_ifname"
 action 1.6 cli command "no shutdown"
!
event manager applet EnableAfterReload
 event timer countdown name EnableAfterReload time 10
 action 1.0 cli command "enable"
 action 1.1 cli command "configure terminal"
 action 1.5 cli command "interface $_disable_ifname"
 action 1.6 cli command "no shutdown"

Cisco EEM tech report e-mail

ip sla 333
icmp-echo 8.8.8.8
timeout 500
frequency 60
ip sla schedule 333 life forever start-time now

track 333 ip sla 333 reachability
 delay down 30 up 30

event manager environment _email_server 192.168.0.100
event manager environment _email_from eem@iamroot.ru
event manager environment _email_to eem@iamroot.ru

event manager applet host_is_down
event track 333 state down

action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show tech | append flash:show_tech"
action 1.4 cli command "show ip route | append flash:show_tech"
action 1.5 cli command "show ip interface brief | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "SEND..."
action 1.8 mail server $_email_server to $_email_to from $_email_from subject " Show Tech Output (Cisco_011) " body "$_cli_result"
action 1.9 syslog msg "Ok!"

event manager applet host_is_up
event track 333 state up
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show tech | append flash:show_tech"
action 1.4 cli command "show ip route | append flash:show_tech"
action 1.5 cli command "show ip interface brief | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending..."
action 1.8 mail server $_email_server to $_email_to from $_email_from subject " Show Tech Output (Cisco_011) " body "$_cli_result"
action 1.9 syslog msg "OK!"

Блокировка устаревших записей ПК AD

Powershell

PS C:\Users\lexit>  Import-Module ActiveDirectory
PS C:\Users\lexit> get-command -module ActiveDirectory
PS C:\Users\lexit> $OldDate = (Get-Date).AddDays(-45).ToFileTime()
PS C:\Users\lexit> $r=Get-ADComputer -Property Name,lastLogonDate -Filter {lastLogonDate -lt $OldDate} | Set-ADComputer -Enabled $false

Cisco pppoe client

Собственно не перевелись еще провайдеры раздающие интернет по pppoe !

Коллегам с Ростова-на-дону привет!

# LAN
interface Gi0/0
description -Lan-
ip address 172.16.111.1 255.255.255.0
ip nat inside

# WAN
interface Gi0/1
description -wan-
no ip address
pppoe enable group global
pppoe-client dial-pool-number 1

interface Dialer0
 description -provider-dialer-
 mtu 1400
 ip address negotiated
 ip pim dense-mode
 ip nat outside
 ip virtual-reassembly in
 encapsulation ppp
 ip tcp adjust-mss 1452
 dialer pool 1
 dialer idle-timeout 0
 dialer persistent
 ppp mtu adaptive
 ppp authentication chap pap callin
 ppp chap hostname MyLoginPPPOE
 ppp chap password 0 MyPasswordPPPOE
 ppp pap sent-username ts5wx6efwo password 0 MyPasswordPPPOE
 ppp ipcp route default

# ACL для NAT
access-list 1 permit 172.16.111.0 0.0.0.255

# маршрут по умолчанию
ip route 0.0.0.0 0.0.0.0 Dialer0
#
dialer-list 1 protocol ip permit

ip nat inside source list 1 interface Dialer0 overload

Проверяем

GW# sh pppoe session interface Gi 0/1