Need to configure SMTP settings on IIS for the ASP.Net Core Identity server for the EMail verification - smtp

I successfully deployed the Identity server and it is working fine also configure the SMTP settings on the VPS but when try to set up it with the ASP.Net Core 3.1 Application unable to find the SMTP in the features using IIS.
I used No Managed Code As Application Pool.
Below is the image regarding my problem

In .net core no need for asp.net setting. It was needed in the older version. We just need to change the configuration in appsettings.json for (SMTP) email setup also for the MTA(Third Party)

I used sendgrid for MTA inshort configure SMTP with sendgrid. Issue is to add its secret andAPI key in the appsettings.production.json
Below is the Code:
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=DatabaseName;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"SendGridUser": "Put User name Here",
"SendGridKey": "Put API Key Here",
"RequireConfirmedEmail": true
}
It didnt't required to setup SMTP for the site only need to configure the SMTP for the main IIS Node it works for it.

Related

Getting websocket error message without using any websocket in react

I am making a simple REST API based Express-React-Node-MySQL stack.
Architecture
Client - React JS / Mui client files
Server - Node - MySQL - Express framework
Ubuntu
Network
PORT 443 forwarding i.e. all requests made on https://myIp:443 or http://myIP:443 land to my home.
Yes I have a domain i.e. https://www.example.in or https://example.in
Using Cloudflare to manage domain traffic.
As you may know cloudflare only accepts port 443 , 2053, 2083 etc as secure https ports, I was forced to change reactjs default port from 3000 to 2053, as linux does not allow ports below 1000 to be used by non root user. In my machine i have configured that, all requests made to port to 443 from outside are redirected to port 2053.
Traffic Sequence
https://example.in -> https://myIP:443 -> redirect -> https://myIP:2053.
Client Architecture
Now by default, react js fires up the localhost as soon as you enter npm start on http://localhost:3000.
I had to change this to https://localhost:2053 because of the reasons mentioned above.
How I am doing that ?
{
"name": "client",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:2083",
"dependencies": {
"#emotion/react": "^11.7.1",
"#emotion/styled": "^11.6.0",
"#fortawesome/fontawesome-svg-core": "^1.3.0-beta3",
"#fortawesome/free-regular-svg-icons": "^6.0.0-beta3",
"#fortawesome/free-solid-svg-icons": "^6.0.0-beta3",
"#fortawesome/react-fontawesome": "^0.1.16",
"#material-ui/core": "^4.12.3",
"#material-ui/icons": "^4.11.2",
"#mui/icons-material": "^5.2.5",
"#mui/material": "^5.2.7",
"#testing-library/jest-dom": "^5.16.1",
"#testing-library/react": "^12.1.2",
"#testing-library/user-event": "^13.5.0",
"js-cookie": "^3.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-google-recaptcha-v3": "^1.9.7",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"recaptcha-v3": "^1.10.0",
"web-vitals": "^2.1.3"
},
"scripts": {
"start": "HTTPS=true PORT=2053 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
this line = > "start": "HTTPS=true PORT=2053 react-scripts start",
Now lets come to what goes wrong.
This happens in the browser console when I fire up my client/reactjs.
I am not using any websocket or socket io kind of thing, why is this error console message being triggered ? What am I doing wrong. PLZ tell :(
This is a great question! Thanks for sharing
To the point: the docs clearly states that
The proxy option supports HTTP, HTTPS and WebSocket connections.
And also that:
If the proxy option is not flexible enough for you, alternatively you can:
Configure the proxy yourself
I know.. this is not such a great option but - using this option is production is not ideal either. Most chances that your app will be served via a real server or via API gateway with a fixed address or a valid domain
Also note that if you are using a secured connection you will also need to manage a valid certificate (or use a manage solution that will provide one)
In short: production and development have different configuration set, hence - in production you will use different config and this error will not be present. This error is likely generated only in development mode using this specific configuration
I hope that satisfy you as the rest of this answer will be more devOps regarding to production configuration rather than development guidelines

Proxy api server through angular application

I am trying to proxy api server through an Angular 6 application and I get the following error:
UNABLE_TO_GET_ISSUER_CERT_LOCALLY .
How to resolve this?
That's because you're trying to reverse proxy a secure connection, and all secure connection require a certificate to encrypt the connection.
You could either drop the security:
"/example": {
"target": "http://example.com"
"secure": false
}
Or generate the certificates (), and letting devServer (ng serve) know where they are......... which i couldn't find any documentation, about. So I suggest you do as I did and set up a reverse proxy in top of angular to manage this; i prefere nginx but you can use node's proxy-middleware.
By the way, I do think the documentation of the case is lacking, so do all of this people -> https://github.com/angular/angular-cli/pull/1896
Refs
https://github.com/webpack/webpack-dev-server/issues/10

Updating issue using Redmine API

I'm trying to make a little app which updates redmine issues. To start with I wanted to test the API calls to make sure I knew what I'm doing and already hit a wall.
I fired up postman with a PUT
URL
http://address:port/issues/1.json
headers:
Content-Type:application/json
X-Redmine-API-Key:MYKEY
X-Redmine-Switch-User:MYUSERNAME
body:
{"issue": { "id":"5729", "subject": "This change happens", "status": { "id": "1", "name": "This change is ignored" } } }
However when I hit send and look in redmine only the subject has been updated, the status doesn't change. I can see also that the last updated field updates to the current time/date.
I've seen several answers to questions like this already, but the solution always seems to be adding the content type to the header... and I've already got that.
Am I missing something obvious?
Here is my redmine environment if relevant:
Environment:
Redmine version 2.5.1.stable
Ruby version 1.9.3-p0 (2011-10-30) [i386-mingw32]
Rails version 3.2.17
Environment production
Database adapter PostgreSQL
SCM:
Subversion 1.8.13
Mercurial 3.4
Git 1.9.5
Filesystem
Redmine plugins:
clipboard_image_paste 1.8
redmine_backlogs v1.0.6
redmine_ckeditor 1.0.16
redmine_dashboard 3.0.0.dev0
redmine_issue_checklist 2.0.5
redmine_questions 0.0.5
redmine_release_notes 1.3.1
redmine_repobrowser 1.3.0
redmine_user_specific_theme 0.0.1
redmine_wiki_extensions 0.6.3
redmine_wiki_lists 0.0.3
According to http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue, it looks like you should only pass in the status id, as "status_id". Could you try something like this?
{"issue":
{
"id":"5729",
"subject": "This change happens",
"status_id": "1"
}
}

packer ssh_private_key_file is invalid

I am trying to use the OpenStack provisioner API in packer to clone an instance. So far I have developed the script:
{
"variables": {
},
"description": "This will create the baked vm images for any environment from dev to prod.",
"builders": [
{
"type": "openstack",
"identity_endpoint": "http://192.168.10.10:5000/v3",
"tenant_name": "admin",
"domain_name": "Default",
"username": "admin",
"password": "****************",
"region": "RegionOne",
"image_name": "cirros",
"flavor": "m1.tiny",
"insecure": "true",
"source_image": "0f9b69ee-4e9f-4807-a7c4-6a58355c37b1",
"communicator": "ssh",
"ssh_keypair_name": "******************",
"ssh_private_key_file": "~/.ssh/id_rsa",
"ssh_username": "root"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 60"
]
}
]
}
But upon running the script using packer build script.json I get the following error:
User:packer User$ packer build script.json
openstack output will be in this color.
1 error(s) occurred:
* ssh_private_key_file is invalid: stat ~/.ssh/id_rsa: no such file or directory
My id_rsa is a file starting and ending with:
------BEGIN RSA PRIVATE KEY------
key
------END RSA PRIVATE KEY--------
Which I thought meant it was a PEM related file so I found this was weird so I made a pastebin of my PACKER_LOG: http://pastebin.com/sgUPRkGs
Initial analysis tell me that the only error is a missing packerconfig file. Upon googling this the top searches tell me if it doesn't find one it defaults. Is this why it is not working?
Any help would be of great assistance. Apparently there are similar problems on the github support page (https://github.com/mitchellh/packer/issues) But I don't understand some of the solutions posted and if they apply to me.
I've tried to be as informative as I can. Happy to provide any information where I can!!
Thank you.
* ssh_private_key_file is invalid: stat ~/.ssh/id_rsa: no such file or directory
The "~" character isn't special to the operating system. It's only special to shells and certain other programs which choose to interpret it as referring to your home directory.
It appears that OpenStack doesn't treat "~" as special, and it's looking for a key file with the literal pathname "~/.ssh/id_rsa". It's failing because it can't find a key file with that literal pathname.
Update the ssh_private_key_file entry to list the actual pathname to the key file:
"ssh_private_key_file": "/home/someuser/.ssh/id_rsa",
Of course, you should also make sure that the key file actually exists at the location that you specify.
Have to leave a post here as this just bit me… I was using a variable with ~/.ssh/id_rsa and then I changed it to use the full path and when I did… I had a space at the end of the variable value being passed in from the command line via Makefile which was causing this error. Hope this saves someone some time.
Kenster's answer got you past your initial question, but it sounds like from your comment that you were still stuck.
Per my reply to your comment, Packer doesn't seem to support supplying a passphrase, but you CAN tell it to ask the running SSH Agent for a decrypted key if the correct passphrase was supplied when the key was loaded. This should allow you to use Packer to build with a protect SSH key as long as you've loaded it into SSH agent before attempting the build.
https://www.packer.io/docs/templates/communicator.html#ssh_agent_auth
The SSH communicator connects to the host via SSH. If you have an SSH
agent configured on the host running Packer, and SSH agent
authentication is enabled in the communicator config, Packer will
automatically forward the SSH agent to the remote host.
The SSH communicator has the following options:
ssh_agent_auth (boolean) - If true, the local SSH agent will be used
to authenticate connections to the remote host. Defaults to false.

Selenium Auth0 can't connect to server

I have a protractor selenium test for an angular2 that I run with protractor conf.js --params.login.username=John --params.login.password=Doe. The test shall try to log in to my backend and fail with access denied.
This is the conf.js:
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
baseUrl:'http://127.0.0.1:4200',
specs: ['mytest.spec.js'],
useAllAngular2AppRoots: true,
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
}
The webdriver was started with webdriver-manager start. The app loads fine and the test fills out the Auth0 popup as shown below. It then clicks the submit button. However, this leads to the error message below being shown instead of the login happening. If I understand correctly, Auth0 can't reach the auth server (which is not the issue when logging in manually).
The version of auth0 lock is 10.0.
Through browser.pause() I could verify that other non-localhost addresses like stackoverflow.com are accessible.
Any idea where this might come from and how to solve it?
Update:
In the developer console the following message is displayed.
XMLHttpRequest cannot load https://MYDOMAIN.eu.auth0.com/usernamepassword/login.
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1:4200' is therefore not allowed access.
The problem was, that the local url http://127.0.0.1:4200 was not listed in the auth0 dashboard under Allowed Origins (CORS), only http://localhost:4200 which I used for testing manually.
The issue was resolved by adding http://127.0.0.1:4200 to Allowed Origins (CORS) and adding the appropriate callback URLs to Allowed Callback URLs.