Password containing left angle bracket causing issues in web.config file asp.net - connection-string

Hi I am trying to build a connectionstring in web.config file in MVC. Everything is fine except that I have to use autogenerated password and latest password has left angle bracket. When I am using this password containing left angle bracket, the connectionstring does not build correctly and I face failed connection.
"Data Source=JungJu.database.windows.net;Initial Catalog=MainDb;User ID=FuntoGo;Password=OV_Xu2v8j2K$#~/<bI,A]d;Authentication=Active Directory Password

Replace it with
<
is is the XML safe replacement for < (less than)

Related

How to encrypt oracle ucp database connection in tomcat config?

I want to encrypt my database connection in tomcat 7 config (server.xml). I'm using the connectionProperties to provide encryption algorithm, but somehow, these properties are not working.
Here is the chunk from my config file:
<Resource
name="jdbc/TestDb" auth="Container"
type="oracle.ucp.jdbc.PoolDataSource"
description="UCP Pool in Tomcat"
factory="oracle.ucp.jdbc.PoolDataSourceImpl"
connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource"
minPoolSize="10"
maxPoolSize="100"
inactiveConnectionTimeout="20"
user="******"
password="*****"
connectionProperties="oracle.net.encryption_client=REQUIRED,
oracle.net.encryption_types_client=AES256,
oracle.net.crypto_checksum_client=REQUIRED,
oracle.net.crypto_checksum_types_client=SHA512"
url="jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=***)))"
connectionPoolName="UCPPool"
sqlForValidateConnection="select 1 from DUAL"
validateConnectionOnBorrow="true" />
Tried with semicolon in connectionProperties in place of comma. But nothing is working.
Please see, if someone can help.
Try entering values in below format -
{prop1=val1, prop2=val2, ..., propN=valN}
All key value pairs should be separated by ", " (comma and space char)and should be placed within {}.
For example in your case, it should be -
connectionProperties="{oracle.net.encryption_client=REQUIRED, oracle.net.encryption_types_client=AES256, oracle.net.crypto_checksum_client=REQUIRED, oracle.net.crypto_checksum_types_client=SHA512}"

ASP-VB Script encoding problem - Microsoft SQL server is not returning error message in page encoding format

I have a ASP/VBScript page. I have set the encoding to UTF-8 using the following:
<%# CodePage=65001 %>
The existing Response.write() messages are coming in UTF-8. But when I add a new Response.write() message, IE shows it in Shift JIS encoding. The System Locale setting is Japanese.
New code added:
if err.number <> 0 then
Response.write <Japanese error message>
Response.end
end if
Why are the existing Response.write() shown in UTF-8 and only new one shown in Shift JIS?
To get over this, I added below line at top of page:
Response.Charset="UTF-8"
On adding this, the new Response.write() started coming in UTF-8. But MS SQL Server error messages (like timeout) also were displayed in UTF-8. They are appearing as junk characters. They are shown correctly only in Shift JIS as MS SQL Server is encoding them as Shift JIS.
How can I overcome this problem?

How to escape LDAP dn for lookup?

I have a small script (spring/groovy/ldap) that finds, in Active Directory, the 'management tree' under a person,
i.e. from a 'root person' the script finds the root person's direct reports then uses recursion: for each direct report find their direct reports, etc.
the directReports users attribute specifies a list of DN's in the form:
CN=Simpson\, Homer,OU=OU_0731DevOps,OU=OU_0100Monitor Services,OU=OU_0001U*Nuclear Energy Corporation,OU=OU_UNuclearUsers,DC=corp,DC=unucleargrp,DC=com
The script does an "ldap lookup" for each direct report by DN, e.g.:
obj = ldapTemplate.lookup(pDn, new UserAttributesMapper())
Problem
The ldap lookup throws an InvalidNameException
[LDAP: error code 34 - 0000208F: LdapErr: DSID-0C090787
I've tried various combinations of escaping but still get the error.
What am I missing???
More Info
This url https://social.technet.microsoft.com/wiki/contents/articles /5312.active-directory-characters-to-escape.aspx shows which characters to escape:
Active Directory requires that the following ten characters be escaped
with the backslash "\" escape character if they appear in any of the
individual components of a distinguished name:
Comma ,
Backslash character \
Pound sign (hash sign) #
Plus sign +
Less than symbol <
Greater than symbol >
Semicolon ;
Double quote (quotation mark) "
Equal sign =
Leading or trailing spaces
Tools
Groovy
Spring Boot
JVM
thanks!
I found the answer by poking around with LDAPNameBuilder.
TLDR:
ldapTemplate.lookup requires stripping off the "DC.." portion of the DN.*
If you know a cleaner/more-official solution, please post!
LDAP Lookup fails with a DN like this:
This DN has "DC=.." components and fails using spring ldap lookup.
CN=Simpson\, Homer,OU=OU_0731DevOps,OU=OU_0100Monitor Services,OU=OU_0001U*Nuclear Energy Corporation,OU=OU_UNuclearUsers,DC=corp,DC=unucleargrp,DC=com
LDAP succeeds with this (no "DC" components):
This DN has no "DC=" components. Spring LDAP template provides the basedn.
CN=Simpson\, Homer,OU=OU_0731DevOps,OU=OU_0100Monitor Services,OU=OU_0001U*Nuclear Energy Corporation
Context Reminder
This application traverses 'management tree.' It gets a persons managees by the 'directReports' attribute (which lists the full-DN's of each direct report). This application wanted to lookup that user by his/her DN.
Tweak/Example
This tweak got the ldap lookup to work:
User lookupUserByDn(String pDn) {
// needed this to get it to work
String dn=pDn.replace(",${ldapConfig.base}","")
ldapTemplate.lookup(dn, new UserAttributesMapper())
}
for the record, my application.yml ldap portion looked like this:
spring:
ldap:
urls: ldap://dc.corp.unucleargrp.com:389
base: DC=corp,DC=unucleargrp,DC=com
username: username_val
password : password_val
According to this https://docs.spring.io/spring-ldap/docs/2.3.1.RELEASE/reference/#contextsource-configuration
Removing the base attribute, All operations going back and forth will use full DNs.

ODK briefcase command-line form export

I am trying to automaticly backup forms submited to transform them to CSV.
I am using this commandline:
java -jar ./ODK_Briefcase_v1.4.5_Production.jar --form_id NameOfTheForm
--odk_username USER --odk_password PASSWORD
--export_directory /var/www/data --storage_directory /var/www/data
--export_filename A_Chaufferie.csv --overwrite_csv_export
--export_start_date 2014/02/05 --export_end_date 2016/02/06
I get the error GRAVE: Form not found
I have no idea what is the purpose of storage_directory. I can't find any forms submissions on mys server (tryed with the linux command find).
Do you know what I am missing?
i have this --help:
java -jar briefcase.jar
-ed,--export_directory </path/to/dir> Directory to export the CSV and
media files into (relative path
unless it begins with / or C:\)
-em,--exclude_media_export Flag to exclude media on export
-end,--export_end_date <yyyy/MM/dd> Include submission dates before
(exclusive) this date in export
to CSV
-f,--export_filename <name.csv> File name for exported CSV
-h,--help Print help information (this
screen)
-id,--form_id <form_id> Form ID of form to download and
export
-oc,--overwrite_csv_export Flag to overwrite CSV on export
-od,--odk_directory </path/to/dir> /odk directory from ODK Collect
(relative path unless it begins
with / or C:\)
-p,--odk_password <password> ODK password
-pf,--pem_file </path/to/file.pem> PEM private key file (relative
path unless it begins with / or
C:\)
-sd,--storage_directory </path/to/dir> Directory to create or find ODK
Briefcase Storage directory
(relative path unless it begins
with / or C:\)
-start,--export_start_date <yyyy/MM/dd> Include submission dates after
(inclusive) this date in export
to CSV
-u,--odk_username <username> ODK username
-url,--aggregate_url <url> ODK Aggregate URL (must start
with http:// or https://)
-v,--version Print version information
I didn't know i had to put --aggregate_url even if the brieface and ODK aggregate are in the same server. Don't miss the http:// or it won't work
java -jar ./ODK_Briefcase_v1.4.5_Production.jar --form_id NameOfTheForm
--odk_username USER --odk_password PASSWORD
--export_directory /var/www/data --storage_directory /var/www/briefcase
--export_filename A_Chaufferie.csv --overwrite_csv_export
--export_start_date 2014/02/05 --export_end_date 2016/02/06
--aggregate_url http://your.odk-aggregate.site

Google App Engine and ttf font not working

I've got a small problem where google app engine is complaining about my ttf file. This is what it says:
Could not guess mimetype for css/fonts/Pacifico.ttf. Using application/octet-stream.
Now I've followed this link and changed my yaml file appropriately (or so I think):
- url: /css/fonts/(.*\.ttf)
static_files: css/fonts/\1
upload: css/fonts/(.*\.ttf)
mime_type: application/x-font-ttf
But when I do this i get the following:
appcfg.py: error: Error parsing C:\Users\Roberto\Desktop\bootstrap\app.yaml: mapping values are not allowed here
in "C:\Users\Roberto\Desktop\bootstrap\app.yaml", line 25, column 17.
2014-01-16 23:22:16 (Process exited with code 2)
Any help in this matter?
I have done a test with glyphicons-halflings-regular.ttf from the Bootstrap project with the same app.yaml handler that you use (save for the indentation change as per the comments) and can verify that it works as expected:
This leads me to believe that you may using an older version of the GAE SDK (I use 1.8.8) or something else is wrong with your installation.
You can try this: appcfg.py uses python's mimetypes module to guess the type from the file extension so in any case, you should be able to solve the issue by adding the application/x-font-ttf mime type to your OS.
You're on Windows so you need to edit your registry and add a application/x-font-ttf key to HKEY_CLASSES_ROOT\MIME\Database\Content Type and add a string value called Extension with the value .ttf under the new key.
Extended procedure for adding the mimetype to Windows
Open the registry editor: Hit Winkey + R and type regedit, hit Enter
Navigate through the registry to the desired location: open HKEY_CLASSES_ROOT, inside it open MIME, inside that open Database and inside that open Content Type. It's like a folder structure.
Right click on Content Type and select New > Key, give it the name application/x-font-ttf.
Right click on the key you just created and select New > String Value. give it the name Extension.
Double click on the value you just created and assign it the Value data .ttf, hit OK.
Exit regedit and you're done!
Final none: I don't think it can be anything to do with the file itself, because the mimetypes module uses only the file extension to work out the MIME type. Unless there is some crazy unprintable character in the filename. You could try using the glyphicons-halflings-regular font I linked to to eliminate this possibility.

Resources