вторник, 1 ноября 2016 г.

Сравнения пар файлов Word, Excel

Для сравнения двух документов Word есть штатная функция внутри самого "Ворда":
раздел Рецензирование (Review), Сравнить (Compare) / Сравнение двух версий документа (есть еще Объединение - там же)
Далее выбираются "Исходный документ" и "Измененный документ", выставляются параметры сравнения.
Определяется формат, как показать изменения (в исходном, в измененном или в новом).
Есть синхронная прокрутка по документам с подсветкой отличий.

Для сравнения двух файлов Excel, есть отдельная утилита в Пуск \ Все программы \ Microsoft Office 2013 \ Средства (Tools) Office 2013 \ Spreadsheet Compare 2013
Также добавляются по путям два файла и выводится в окнах соответствие между ними. Из минусов:
- нет синхронной прокрутки,
- если добавляется в середину столбец, то сравнение не умеет учитывать это смещение (покажет различие),
- при расширении ячеек по содержимому, отдельной клавишей, уже не может "сжать" содержимое обратно.

среда, 19 октября 2016 г.

Быстрый доступ для root'а по SSH в Solaris

Для доступа, например, в Live окружение, когда доступ есть только на консоли без возможности использовать буфер обмена и подобные интерактивные фичи, можно открыть SSH доступ, но по умолчанию роли root'а не разрешен доступ. Поэтому настраиваем:
1. vi /etc/ssh/sshd_config
    PermitRootLogin yes - поменять с no
2. vi /etc/default/login
    #CONSOLE=/dev/console - закомментировать
3. rolemod -K type=normal root
4. svcadm restart ssh - рестарт сервиса
теперь под "пользователем" root можно залогиниться (также можно пароль поменять passwd root).

понедельник, 17 октября 2016 г.

Восстановление zfs пулла из DEGRADED состояния

Однажды утром понедельника обнаружил страшное:

mik17@sol1:~$ zpool status
  pool: rpool
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          c4t0d0s0  ONLINE       0     0     0

errors: No known data errors

  pool: zfs_pool_zones
 state: FAULTED
status: The pool metadata is corrupted and the pool cannot be opened.
action: Recovery is possible, but will result in some data loss.
        Returning the pool to its state as of October 13, 2016 03:10:03 AM MSK
        should correct the problem.  Approximately 20 minutes of data
        must be discarded, irreversibly.  After rewind, several
        persistent user-data errors will remain.  Recovery can be attempted
        by executing 'zpool clear -F zfs_pool_zones'.  A scrub of the pool
        is strongly recommended after recovery.
   see: http://illumos.org/msg/ZFS-8000-72
  scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        zfs_pool_zones  FAULTED      0     0     1  corrupted data
          raidz1-0    DEGRADED     0     0     8
            c4t1d0    DEGRADED     0     0     0  too many errors
            spare-1   DEGRADED     0     0     0
              c4t2d0  DEGRADED     0     0     0  too many errors
              c4t6d0  ONLINE       0     0     0
            c4t3d0    DEGRADED     0     0     0  too many errors
            c4t4d0    DEGRADED     0     0     1  too many errors
            c4t5d0    DEGRADED     0     0     0  too many errors

зоны не стартуют, все пропало )))
для начала попробовал "заклиарить" пулл, так как в дисках сомнений нет (это LUN с СХД)
mik17@sol1:~$ sudo zpool clear -F zfs_pool_zones
cannot clear errors for zfs_pool_zones: I/O error

теперь попробуем пулл "импортнуть":
mik17@sol1:~$ sudo zpool import -F zfs_pool_zones
cannot import 'zfs_pool_zones': a pool with that name is already created/imported,
and no additional pools with that name were found

ну хоть метаданные по нему есть, так что сначала навесим на пулл флаг экспорта:
mik17@sol1:~$ sudo zpool export zfs_pool_zones
скушал
теперь опять импорт
mik17@sol1:~$ sudo zpool import -F zfs_pool_zones
mik17@sol1:~$ sudo zpool status zfs_pool_zones
  pool: zfs_pool_zones
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Mon Oct 17 11:15:29 2016
    306M scanned out of 4.94G at 43.8M/s, 0h1m to go
    60.8M resilvered, 6.06% done
config:

        NAME          STATE     READ WRITE CKSUM
        zfs_pool_zones  ONLINE       0     0     0
          raidz1-0    ONLINE       0     0     0
            c4t1d0    ONLINE       0     0     0
            spare-1   ONLINE       0     0     0
              c4t2d0  ONLINE       0     0     0
              c4t6d0  ONLINE       0     0     0  (resilvering)
            c4t3d0    ONLINE       0     0     0
            c4t4d0    ONLINE       0     0     0
            c4t5d0    ONLINE       0     0     0

errors: 1 data errors, use '-v' for a list
восстановился с ошибками на файловой системе, нужно их scrub'нуть
mik17@sol1:~$ sudo zpool scrub zfs_pool_zones

mik17@sol1:~$ sudo zpool status -v zfs_pool_zones
  pool: zfs_pool_zones
 state: ONLINE
status: One or more devices has experienced an error resulting in data
        corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
        entire pool from backup.
   see: http://illumos.org/msg/ZFS-8000-8A
  scan: scrub in progress since Mon Oct 17 11:38:01 2016
    225M scanned out of 4.94G at 37.5M/s, 0h2m to go
    0 repaired, 4.45% done
config:

        NAME        STATE     READ WRITE CKSUM
        zfs_pool_zones  ONLINE       0     0     4
          raidz1-0  ONLINE       0     0     8
            c4t1d0  ONLINE       0     0     0
            c4t2d0  ONLINE       0     0     0
            c4t3d0  ONLINE       0     0     0
            c4t4d0  ONLINE       0     0     0
            c4t5d0  ONLINE       0     0     0
        spares
          c4t6d0    AVAIL

errors: Permanent errors have been detected in the following files:

        /zfs_pool_zones/zoneSokolov/root/var/cron/log
        /zfs_pool_zones/zonehdscci1/root/var/cron/log
        /zfs_pool_zones/zonepostgres1/root/var/svc/log/application-database-postgresql_84:default_64bit.log
        /zfs_pool_zones/zonepostgres1/root/var/cron/log

после окончания очистки:
mik17@sol1:~$ sudo zpool status -v zfs_pool_zones
  pool: zfs_pool_zones
 state: ONLINE
  scan: resilvered 57.2M in 0h0m with 0 errors on Mon Oct 17 12:08:47 2016
config:

        NAME        STATE     READ WRITE CKSUM
        zfs_pool_zones  ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c4t1d0  ONLINE       0     0     0
            c4t2d0  ONLINE       0     0     0
            c4t3d0  ONLINE       0     0     0
            c4t4d0  ONLINE       0     0     0
            c4t5d0  ONLINE       0     0     0
        spares
          c4t6d0    AVAIL

errors: No known data errors

На другой машинке все сложнее - там и rpool тоже в DEGRADED стейте. но это уже другая история.

вторник, 4 октября 2016 г.

Solaris 11 удаленный рабочий стол (VNC)

Редактируем файл конфигурации
mik17@sol2:~$ su
Password:
mik17@sol2:~# vi /etc/gdm/custom.conf
# GDM configuration storage

[daemon]

[security]

[xdmcp]
        Enable=true
[greeter]

[chooser]

[debug]

:wq


Перезагружаем сервис
mik17@sol2:~# svcadm restart gdm
mik17@sol2:~# inetadm -e xvnc-inetd

Вход в VNC сессию с паролем от пользователя с привилегиями root

четверг, 8 сентября 2016 г.

Как в домене найти Certification Authority

В мемориззз
в Винде (выше 7 точно) есть утилита:

certutil -config - -ping
L-DC2.LNW.local\LNW-ALPHA-CA
Подключение к L-DC2.LNW.local\LNW-ALPHA-CA ...
Интерфейс сервера "LNW-ALPHA-CA" ICertRequest2 действует
CertUtil: -ping - команда успешно выполнена.
ping L-DC2       (192.168.41.22)

Можно еще посмотреть в DNS:

\Users\Cert Publishers (Издатели сертификатов)
свойства\Члены группы

понедельник, 11 июля 2016 г.

Cisco switch (IOS) error disable recovery

Пример на память.

http://www.cisco.com/cisco/web/support/RU/10/105/105416_errdisable_recovery.html

EDU-Switch#sh int gi 0/8
GigabitEthernet0/8 is down, line protocol is down (err-disabled)
  Hardware is Gigabit Ethernet, address is 0008.30хх.хххх (bia 0008.30хх.хххх)
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Auto-duplex, Auto-speed, media type is 10/100/1000BaseTX
  input flow-control is off, output flow-control is unsupported
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 4w6d, output 2d05h, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     9671 packets input, 1590071 bytes, 0 no buffer
     Received 2028 broadcasts (310 multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog, 310 multicast, 0 pause input
     0 input packets with dribble condition detected
     2056200 packets output, 191811224 bytes, 0 underruns
EDU-Switch#sh port-security int gi 0/8
Port Security              : Enabled
Port Status                : Secure-shutdown
Violation Mode             : Shutdown
Aging Time                 : 0 mins
Aging Type                 : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses      : 1
Total MAC Addresses        : 1
Configured MAC Addresses   : 0
Sticky MAC Addresses       : 1
Last Source Address:Vlan   : 0000.5e00.0001:111
Security Violation Count   : 1

EDU-Switch#sh run int gi 0/8
Building configuration...

Current configuration : 255 bytes
!
interface GigabitEthernet0/8
 switchport access vlan 111
 switchport mode access
 switchport port-security
 switchport port-security mac-address sticky
 switchport port-security mac-address sticky 000c.42c1.bea1 vlan access
 spanning-tree portfast
end


EDU-Switch#sh int gi 0/8 status

Port      Name               Status       Vlan       Duplex  Speed Type
Gi0/8                        err-disabled 111          auto   auto 10/100/1000BaseTX

EDU-Switch#sh log

*Apr 17 00:14:43.784: %PM-4-ERR_DISABLE: psecure-violation error detected on Gi0/8, putting Gi0/8 in err-disable state

EDU-Switch#sh errdisable detect
ErrDisable Reason            Detection    Mode
-----------------            ---------    ----
bpduguard                    Enabled      port
channel-misconfig (STP)      Enabled      port
community-limit              Enabled      port
dhcp-rate-limit              Enabled      port
dtp-flap                     Enabled      port
gbic-invalid                 Enabled      port
inline-power                 Enabled      port
invalid-policy               Enabled      port
link-flap                    Enabled      port
loopback                     Enabled      port
lsgroup                      Enabled      port
mac-limit                    Enabled      port
pagp-flap                    Enabled      port
port-mode-failure            Enabled      port
pppoe-ia-rate-limit          Enabled      port
psecure-violation            Enabled      port/vlan
security-violation           Enabled      port
sfp-config-mismatch          Enabled      port
small-frame                  Enabled      port
storm-control                Enabled      port
udld                         Enabled      port
vmps                         Enabled      port

EDU-Switch#sh errdisable recovery
ErrDisable Reason            Timer Status
-----------------            --------------
bpduguard                    Disabled
channel-misconfig (STP)      Disabled
dhcp-rate-limit              Disabled
dtp-flap                     Disabled
gbic-invalid                 Disabled
inline-power                 Disabled
link-flap                    Disabled
mac-limit                    Disabled
loopback                     Disabled
pagp-flap                    Disabled
port-mode-failure            Disabled
pppoe-ia-rate-limit          Disabled
psecure-violation            Disabled
security-violation           Disabled
sfp-config-mismatch          Disabled
small-frame                  Disabled
storm-control                Disabled
udld                         Disabled
vmps                         Disabled

Timer interval: 300 seconds

Interfaces that will be enabled at the next timeout:

EDU-Switch(config)#errdisable recovery cause psecure-violation
EDU-Switch(config)#do sh errdisable recovery
ErrDisable Reason            Timer Status
-----------------            --------------
bpduguard                    Disabled
channel-misconfig (STP)      Disabled
dhcp-rate-limit              Disabled
dtp-flap                     Disabled
gbic-invalid                 Disabled
inline-power                 Disabled
link-flap                    Disabled
mac-limit                    Disabled
loopback                     Disabled
pagp-flap                    Disabled
port-mode-failure            Disabled
pppoe-ia-rate-limit          Disabled
psecure-violation            Enabled
security-violation           Disabled
sfp-config-mismatch          Disabled
small-frame                  Disabled
storm-control                Disabled
udld                         Disabled
vmps                         Disabled

Timer interval: 300 seconds

Interfaces that will be enabled at the next timeout:

Interface       Errdisable reason       Time left(sec)
---------       -----------------       --------------
Gi0/8          psecure-violation          257
Gi0/10         psecure-violation          257
Gi0/12         psecure-violation          257
Gi0/14         psecure-violation          257

вторник, 21 июня 2016 г.

Cisco DHCP snooping грабельки

В мемориззз,

при настройке DHCP snooping отключать передачу информационных опций:
ip dhcp snooping vlan 111-112
ip dhcp snooping
ip dhcp-server 192.168.111.100
ip dhcp-server 192.168.112.100
no ip dhcp snooping verify mac-address # не обязательно отключать
no ip dhcp snooping information option # отключать!!!

interface GigabitEthernet0/1
 switchport trunk native vlan 2
 switchport mode trunk
 ip dhcp snooping trust

sh ip dhcp snooping
Switch DHCP snooping is enabled
DHCP snooping is configured on following VLANs:
111-112
DHCP snooping is operational on following VLANs:
111-112
DHCP snooping is configured on the following L3 Interfaces:

Insertion of option 82 is disabled
   circuit-id default format: vlan-mod-port
   remote-id: 0008.30xx.xxxx (MAC)
Option 82 on untrusted port is not allowed
Verification of hwaddr field is disabled
Verification of giaddr field is enabled
DHCP snooping trust/rate is configured on the following Interfaces:

Interface                  Trusted    Allow option    Rate limit (pps)
-----------------------    -------    ------------    ----------------
GigabitEthernet0/1         yes        yes             unlimited
  Custom circuit-ids: