SMTP and Basic Auth on O365 account have been disabled

For some reason i could not run SMTP and Basic Authentication on a new O365 account today, after hours of searching i found there is some default security settings that is set on the organisation security settings.

After a lot of more times searching i find this text: “You can enable Basic Auth support for a tenant from the Azure portal (Azure Active Directory -> Properties -> Manage Security defaults -> Enable Security defaults = No).”

And this worked for me after set Enable Security defaults to No i could runt SMTP and Basic Auth.

Setup MySQL Server on Docker

So now i come to setup a MySQL Server on my first Docker environement and like MS SQL Server i found a one liner i like to share:

docker run -d --name mysql01 --hostname mysql01 -e MYSQL_ROOT_PASSWORD=Pwd2023 -p 6603:3306 -v mysql-conf:/etc/mysql/conf.d -v mysql-data:/var/lib/mysql --network network01 mysql

I think its self explaind.

How to get Docker containers to communicate by name instead of ip-address`?

Docker adding all new containers default to a bridge network but on the default bridge network you only can communicate between containers with ip-address, to communicate with containers name instead you need to define your own bridge network:

docker network create --driver bridge network01 --subnet=10.11.0.0/16

Then when you run the container add –network network01 to let the container connect to the new network and you can then communicate between containers by using the name you set on the container instead of communicate by ip-address that changes after a reboot and other things.

Setup a MS SQL Server on Docker

I have started to learn Docker and a nice one liner to have saved somewhere is this one that setting up a docker container with MS SQL server and a SA password + setting up a docker volume to hold the data for MS SQL Server.

The one-line:

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>' -p 1433:1433 -v sqlvolume:/var/opt/mssql --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2019-latest

Reference information can be found on https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker

How to change static IP-number on a Cent OS 6 machine

How To Configure Static IP On CentOS 6
=======================================

## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=”eth0″
NM_CONTROLLED=”yes”
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
NAME=”System eth0″
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
IPADDR=192.168.1.44
NETMASK=255.255.255.0

 

## Configure Default Gateway
#
# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1

 

## Restart Network Interface
#

/etc/init.d/network restart

## Configure DNS Server
#
# vi /etc/resolv.conf

nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 192.168.1.1 # Replace with your nameserver ip

Set up Wifi on your Raspberry Pi without a monitor

If you like to setup Wifi on your Raspberry Pi without a monitor you can after write the image to the SD card.

On my Windows machine after running Raspberry Pi Imager i needed to remove the sd card and add it again to the usb port to see the drive named boot.

In that drive you create a text file named wpa_supplicant.conf and adding this lines in it:

country=US # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
  ssid=”YOUR_NETWORK_NAME”
  psk=”YOUR_PASSWORD”
  key_mgmt=WPA-PSK
}

After saved this file with your SSID and password for your Wifi this should connect on first boot to your network.

If you running a Raspberry Pi Zero Wireless you can only connect to a 2.4Ghz network, so you know. The normal ones seems to have 5Ghz but not sure from what version.

 

Reset Windows 10 offline user password

If you forgot your Windows 10 Offline user password you can reset the password by using a windows 10 installation USB stick and some simple hacks.

Good to know is that all the users encrypted saved passwords being reseted so you going to be needed to login again on all applications.

Start with setup a Windows 10 installation USB-memorystick so you can boot on it.

Boot on the USB and when the first prompt for the Windows installation shows, where you select langauge and keyboard layout and time and currcency format press SHIFT + F10 to open a command prompt.

Now we need to replace utilman.exe with cmd.exe, before you do this, you should make acopy of utilman.exe so that you can restore it later. Note that you can only restore this file if you boot again from the Windows DVD. Windows 10 is usually installed on drive D: if you boot from a DVD. You can verify this with “dir d:\windows\system32\utilman.exe.” If the system can’t find utilman.exe, try other drive letters.

move d:\windows\system32\utilman.exe d:\windows\system32\utilman.exe.bak
copy d:\windows\system32\cmd.exe d:\windows\system32\utilman.exe
 
After you replaced utilman.exe successfully, you can restart your computer by type:
 
wpeutil reboot
 
When you get to the Windows 10 sign in page, click the Utility Manager icon and the Commpand Prompt opens.
 
You can now add reset your account password with the below command:
 
net user <username> <password>
 
After run the above command you can now close the command prompt and login on your account with the new password.
 
Notice that resetting a password with this command doesn’t work with a Microsoft account. The only way to reset a Microsoft account password is through the online forms.

First test of WeMos D1 mini Pro with 1-wire temperature sensor DS18S20

I was looking into how to make a small cost wifi temperature sensor and i find WeMos D1 mini Pro as a very little arduino with wifi on it.

So i buy two of them + two 1-wire temperature sensors DS18S20 and starting read about and after a while testing i got the temperature sensor to work.

The code i used to get the temperature sensor values was:
#include <OneWire.h>

// OneWire DS18S20, DS18B20, DS1822 Temperature Example

OneWire ds(D4); // on pin D4 (a 4.7K resistor is necessary)

void setup(void)
{
Serial.begin(9600);
}

void loop(void)
{
byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
float celsius, fahrenheit;

if ( !ds.search(addr))
{
ds.reset_search();
delay(250);
return;
}


if (OneWire::crc8(addr, 7) != addr[7])
{
Serial.println("CRC is not valid!");
return;
}
Serial.println();

// the first ROM byte indicates which chip
switch (addr[0])
{
case 0x10:
type_s = 1;
break;
case 0x28:
type_s = 0;
break;
case 0x22:
type_s = 0;
break;
default:
Serial.println("Device is not a DS18x20 family device.");
return;
}

ds.reset();
ds.select(addr);
ds.write(0x44, 1); // start conversion, with parasite power on at the end
delay(1000);
present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad

for ( i = 0; i < 9; i++)
{
data[i] = ds.read();
}

// Convert the data to actual temperature
int16_t raw = (data[1] << 8) | data[0];
if (type_s) {
raw = raw << 3; // 9 bit resolution default
if (data[7] == 0x10)
{
raw = (raw & 0xFFF0) + 12 - data[6];
}
}
else
{
byte cfg = (data[4] & 0x60);
if (cfg == 0x00) raw = raw & ~7; // 9 bit resolution, 93.75 ms
else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms

}

celsius = (float)raw / 16.0;

Serial.print(" Temperature = ");
Serial.print(celsius);
Serial.print(" Celsius ");

}