Search This Blog
Monday, October 16, 2017
Tuesday, September 05, 2017
Deploy .pfx cert embedded in script (a sort of 'cat << EOF' for windows)
@echo off
::
::
:: In order to prepare the certificate please run
:: 'certutil -encode the_pfx_cert base_64_cert`
:: then paste the base_64_cert in the section below
:: Please note that the certificate password has to be given as start paramater to this script!
:: (eq: "cert-inst.bat S3cr3tPassw0rd")
:: If the cert was already installed, exit
REG QUERY HKCU\SOFTWARE\neXt /v CertInstalled
If %errorlevel%==0 goto :eof
:: define the temp name of the extracted cert
set extractedfile=%temp%\extract-%random%.txt
:: set the password needed to decode the cert
set certpasswd=%~1
:: separate the cert from this script
call:extractembedded embeddedfile %extractedfile%
:: process the extracted file
certutil -decode %extractedfile% %extractedfile%.pfx
certutil -f -user -p %certpasswd% -importpfx %extractedfile%.pfx
:: clean-up
::del %extractedfile% %extractedfile%.pfx
:: leave a trace in the registry, so the cert will not be installed again and again
REG ADD HKCU\SOFTWARE\neXt /v CertInstalled /t REG_DWORD /d 1
:: clean exit
exit /b
:: begin of the embed cert & extraction procedure
:: After the next line, please paste the "base_64_cert" created by certutil -encode
goto:embeddedfile
-----BEGIN CERTIFICATE-----
MIIMngIBAzCCDGQGCSqG
[...]
k05EzAQIFXJaGHOuxZcCAggA
-----END CERTIFICATE-----
:embeddedfile
:: before the previous line you can find the end of the "base_64_cert"
:: cert extraction procedure
:extractembedded
setlocal EnableDelayedExpansion
set embedbegin=goto:%~1
set embedend=:%~1
set embedcert=%~2
if exist %embedcert% del %embedcert%
set tmprndfile=%temp%\%random%.%random%
findstr /n ^^ "%~f0" > %tmprndfile%
call :seekembed < %tmprndfile%
del %tmprndfile%
exit /B
:seekembed
set oneline=:eof
set /P oneline=
if !oneline! == :eof goto nostart
set oneline=!oneline:*:=!
if not !oneline! == %embedbegin% goto seekembed
:getline
set oneline=:eof
set /P oneline=
if !oneline! == :eof goto nostop
set oneline=!oneline:*:=!
if !oneline! == %embedend% goto :eof
echo/!oneline!>> %embedcert%
goto getline
:nostart
echo Error finding start delimiter %embedbegin%
goto :eof
:nostop
echo Error finding stop delimiter %embedend%
goto :eof
::
::
:: In order to prepare the certificate please run
:: 'certutil -encode the_pfx_cert base_64_cert`
:: then paste the base_64_cert in the section below
:: Please note that the certificate password has to be given as start paramater to this script!
:: (eq: "cert-inst.bat S3cr3tPassw0rd")
:: If the cert was already installed, exit
REG QUERY HKCU\SOFTWARE\neXt /v CertInstalled
If %errorlevel%==0 goto :eof
:: define the temp name of the extracted cert
set extractedfile=%temp%\extract-%random%.txt
:: set the password needed to decode the cert
set certpasswd=%~1
:: separate the cert from this script
call:extractembedded embeddedfile %extractedfile%
:: process the extracted file
certutil -decode %extractedfile% %extractedfile%.pfx
certutil -f -user -p %certpasswd% -importpfx %extractedfile%.pfx
:: clean-up
::del %extractedfile% %extractedfile%.pfx
:: leave a trace in the registry, so the cert will not be installed again and again
REG ADD HKCU\SOFTWARE\neXt /v CertInstalled /t REG_DWORD /d 1
:: clean exit
exit /b
:: begin of the embed cert & extraction procedure
:: After the next line, please paste the "base_64_cert" created by certutil -encode
goto:embeddedfile
-----BEGIN CERTIFICATE-----
MIIMngIBAzCCDGQGCSqG
[...]
k05EzAQIFXJaGHOuxZcCAggA
-----END CERTIFICATE-----
:embeddedfile
:: before the previous line you can find the end of the "base_64_cert"
:: cert extraction procedure
:extractembedded
setlocal EnableDelayedExpansion
set embedbegin=goto:%~1
set embedend=:%~1
set embedcert=%~2
if exist %embedcert% del %embedcert%
set tmprndfile=%temp%\%random%.%random%
findstr /n ^^ "%~f0" > %tmprndfile%
call :seekembed < %tmprndfile%
del %tmprndfile%
exit /B
:seekembed
set oneline=:eof
set /P oneline=
if !oneline! == :eof goto nostart
set oneline=!oneline:*:=!
if not !oneline! == %embedbegin% goto seekembed
:getline
set oneline=:eof
set /P oneline=
if !oneline! == :eof goto nostop
set oneline=!oneline:*:=!
if !oneline! == %embedend% goto :eof
echo/!oneline!>> %embedcert%
goto getline
:nostart
echo Error finding start delimiter %embedbegin%
goto :eof
:nostop
echo Error finding stop delimiter %embedend%
goto :eof
Tuesday, August 01, 2017
Boot from grub2 rescue prompt
grub rescue> set prefix=(hd0,1)/boot/grub2 grub rescue> set root=(hd0,1) grub rescue> insmod normal grub rescue> normal grub rescue> insmod linux grub rescue> linux /boot/vmlinuz root=/dev/sda1 grub rescue> initrd /boot/initrd.img grub rescue> boot
Monday, July 03, 2017
Friday, June 02, 2017
Phone extension that rings multiple external numbers (CCME Asterisk)
In this example we want to ring all the external numbers of a few people only by dialing extension 3331.
1: Connect to CCME and create a new dial-peer:
dial-peer voice 3331 voip description External Emergency Responders destination-pattern 3331$ session protocol sipv2 session target ipv4:192.168.0.XXX #(the Asterisk box) dtmf-relay rtp-nte cisco-rtp codec g711ulaw no vad
2: Connect to the asterisk server and add the extension in the default [incoming_context] in /etc/asterisk/extensions.conf: (192.168.0.YYY is the outgoing trunk)
exten => 3331,1,Dial(SIP/5145555555@192.168.0.YYY&SIP/51455555519@192.168.0.YYY&SIP/5145555552@192.168.0.YYY&SIP/5145555553@192.168.0.YYY&SIP/5145555554@192.168.0.YYY&SIP/5145555555@192.168.0.YYY) exten => 3331,n,Hangup
3: Reload asterisk config and test the extension 
Monday, May 01, 2017
Limit number of unix logins
cat .profile
#!/bin/sh limit=3 session=`ps -ef | grep '\-sh' | grep $USER | grep -v grep`
number=`echo $session | wc -l` if [ $number -ge $limit ]; then echo "No more logins / Il n'y a plus de login. You are already logged as: $session " sleep 5 exit 0 fi
# to timeout after 15min of inactivity and forbid users to change the tmout: echo "TMOUT=900 readonly TMOUT export TMOUT" > /etc/profile.d/tmout.sh && chmox +x /etc/profile.d/tmout.sh
Monday, April 03, 2017
Forward all emails from one sendmail to another
- in sendmail.cf change Djdomain.tld to something like Dj_subdomain.domain.tld Do the same thing for DMdomain.tld
- in the same sendmail.cf look for Fw or Fw-o and check the file it refers to (usually /usr/lib/mail/local-host-names); in that file remove the line stating "domain.tld" (in fact, remove everything, leave just _subdomain.domain.tld there), that way sendmail will know that it is not the default destination for the @domain.tld
- if necessary, create /home/$username/.forward (chmod 600, chown $username:$group) and put the right info in it
- in the same sendmail.cf look for Fw or Fw-o and check the file it refers to (usually /usr/lib/mail/local-host-names); in that file remove the line stating "domain.tld" (in fact, remove everything, leave just _subdomain.domain.tld there), that way sendmail will know that it is not the default destination for the @domain.tld
- if necessary, create /home/$username/.forward (chmod 600, chown $username:$group) and put the right info in it
Wednesday, March 01, 2017
Install mc on sco sysV unix
curl http://www.aljex.com/bkw/sco/mc.tar.bz2 |bzcat |tar xvf -
(there is a copy of that archive in my /update directory)
in .profile add PATH=$PATH:/usr/local/bin:/usr/local/sbin
(there is a copy of that archive in my /update directory)
in .profile add PATH=$PATH:/usr/local/bin:/usr/local/sbin
Wednesday, February 01, 2017
Dell Latitude Keyboard light
The backlit keys interface seems to be broken, so you need to mask the controlling service: systemctl mask systemd-backlight@leds\:dell\:\:kbd_backlight.service
then go to BIOS and and change the keyboard led timeout from 10s to 5s for AC Power and Battery mode - "For some reason if the kbd_backlight service is not masked, it somehow forces the bios led timeout back to 10s, and then the keyboard led always remains lit."
then go to BIOS and and change the keyboard led timeout from 10s to 5s for AC Power and Battery mode - "For some reason if the kbd_backlight service is not masked, it somehow forces the bios led timeout back to 10s, and then the keyboard led always remains lit."
Tuesday, January 03, 2017
TS - FR keyboard by default
Keyboard
|
|
Data collected on:
4/21/2015 1:44:16 PM
|
|
General
Details
Domain
|
domain.local
|
Owner
|
DOMAIN\Admins du domaine
|
Created
|
4/21/2015 1:32:00 PM
|
Modified
|
4/21/2015 1:42:44 PM
|
User Revisions
|
18 (AD), 18 (sysvol)
|
Computer Revisions
|
1 (AD), 1 (sysvol)
|
Unique ID
|
{0E240A4C-8A26-4761-8907-DB164F024AFC}
|
GPO Status
|
Enabled
|
Links
Location
|
Enforced
|
Link Status
|
Path
|
TS
|
No
|
Enabled
|
domain.local/Member Servers/TS
|
This list only includes links in the domain of the GPO.
Security Filtering
The settings in this GPO can only apply to the following groups,
users, and computers:
Name
|
NT AUTHORITY\Authenticated Users
|
Delegation
These groups and users have the specified permission for this GPO
Name
|
Allowed
Permissions
|
Inherited
|
NT AUTHORITY\Authenticated Users
|
Read (from Security Filtering)
|
No
|
NT AUTHORITY\ENTERPRISE DOMAIN
CONTROLLERS
|
Read
|
No
|
NT AUTHORITY\SYSTEM
|
Edit settings, delete, modify
security
|
No
|
No
|
Computer Configuration
(Enabled)
Policies
Administrative Templates
Policy definitions (ADMX files) retrieved from the local machine.
System/Group Policy
Policy
|
Setting
|
Comment
|
||
User Group Policy loopback
processing mode
|
Enabled
|
|||
|
||||
User Configuration (Enabled)
Preferences
Windows Settings
Registry
2 (Order: 1)
General
Action
|
Update
|
Properties
Hive
|
HKEY_CURRENT_USER
|
Key path
|
Keyboard
Layout\Preload
|
Value name
|
2
|
Value type
|
REG_SZ
|
Value data
|
00000409
|
Common
Options
Stop
processing items on this extension if an error occurs on this item
|
No
|
Run in
logged-on user's security context (user policy option)
|
No
|
Remove this
item when it is no longer applied
|
No
|
Apply once
and do not reapply
|
No
|
1 (Order: 2)
General
Action
|
Update
|
Properties
Hive
|
HKEY_CURRENT_USER
|
Key path
|
Keyboard
Layout\Preload
|
Value name
|
1
|
Value type
|
REG_SZ
|
Value data
|
00000c0c
|
Common
Options
Stop
processing items on this extension if an error occurs on this item
|
No
|
Run in
logged-on user's security context (user policy option)
|
No
|
Remove this
item when it is no longer applied
|
No
|
Apply once
and do not reapply
|
No
|
ShowStatus (Order: 3)
General
Action
|
Update
|
Properties
Hive
|
HKEY_CURRENT_USER
|
Key path
|
Software\Microsoft\CTF\LangBar
|
Value name
|
ShowStatus
|
Value type
|
REG_DWORD
|
Value data
|
0x4 (4)
|
Common
Options
Stop
processing items on this extension if an error occurs on this item
|
No
|
Run in
logged-on user's security context (user policy option)
|
No
|
Remove this
item when it is no longer applied
|
No
|
Apply once
and do not reapply
|
No
|
Label (Order: 4)
General
Action
|
Update
|
Properties
Hive
|
HKEY_CURRENT_USER
|
Key path
|
Software\Microsoft\CTF\LangBar
|
Value name
|
Label
|
Value type
|
REG_DWORD
|
Value data
|
0x0 (0)
|
Common
Options
Stop
processing items on this extension if an error occurs on this item
|
No
|
Run in
logged-on user's security context (user policy option)
|
No
|
Remove this
item when it is no longer applied
|
No
|
Apply once
and do not reapply
|
No
|
AutoAdjustDeskBand (Order: 5)
General
Action
|
Update
|
Properties
Hive
|
HKEY_CURRENT_USER
|
Key path
|
Software\Microsoft\CTF\MSUTB
|
Value name
|
AutoAdjustDeskBand
|
Value type
|
REG_DWORD
|
Value data
|
0x0 (0)
|
Common
Options
Stop
processing items on this extension if an error occurs on this item
|
No
|
Run in
logged-on user's security context (user policy option)
|
No
|
Remove this
item when it is no longer applied
|
No
|
Apply once
and do not reapply
|
No
|
Subscribe to:
Posts (Atom)
