Get public Ip Address of Google App engine Project - google-app-engine

I hosted my project at www.example.appspot.com and I want to register for a service that required my public Ip address. How do i get the IP address of my app engine project. Thanks.

You can use any DNS lookup tool to get the address of the host.
For example on linux you'd get something along these lines:
$ nslookup www.example.appspot.com
...
Non-authoritative answer:
www.example.appspot.com canonical name = appspot.l.google.com.
Name: appspot.l.google.com
Address: 216.58.219.241
$ host www.example.appspot.com
www.example.appspot.com is an alias for appspot.l.google.com.
appspot.l.google.com has address 216.58.219.241
appspot.l.google.com has IPv6 address 2607:f8b0:4006:80e::2011
appspot.l.google.com mail is handled by 10 alt1.gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 40 alt4.gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 5 gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 30 alt3.gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 20 alt2.gmr-smtp-in.l.google.com.

Google AppEngine doesn't have a single IP. It runs on Google's network on very large number of machines over different regions and therefore it has many IP addresses (or ranges).
Here is how you can find these ranges:
Run dig -t txt _cloud-netblocks.googleusercontent.com
Partial list of CIDR blocks is:
8.34.208.0/20
8.35.192.0/21
8.35.200.0/23
23.236.48.0/20
23.251.128.0/19
107.167.160.0/19
107.178.192.0/18
108.170.192.0/20
108.170.208.0/21
108.170.216.0/22
108.170.220.0/23
108.170.222.0/24
108.59.80.0/20
130.211.4.0/22
146.148.16.0/20
146.148.2.0/23
146.148.32.0/19
146.148.4.0/22
146.148.64.0/18
146.148.8.0/21
162.216.148.0/22
162.222.176.0/21
173.255.112.0/20
192.158.28.0/22
199.192.112.0/22
199.223.232.0/22
199.223.236.0/23

A more updated (April 2018) answer based on what I went through today to launch pixler.io is as follows:
In Google Cloud Platform go to your App Engine and click on "settings", from there you will have to go to "Custom Domains" and add your domain.
You will be asked to verify your domain by adding a TEXT record. After you do that, you will see the IP addresses populated in the "Data" column, you can copy that into your A record

Related

Cannot assign requested address with YugabyteDB and Docker Volume

Problem when using yugabyte with persistence volume in docker.
On first run everything work fine, but when re-create container with existing volume, it fail to start:
master.err :
./../src/yb/master/master_main.cc:131] Network error (yb/util/net/socket.cc:325): Error binding socket to 172.28.0.3:7100: Cannot assign requested address (system error 99)
# 0x2938618 google::LogMessage::SendToLog()
# 0x29394d3 google::LogMessage::Flush()
# 0x29399cf google::LogMessageFatal::~LogMessageFatal()
# 0x2677cde main
# 0x7fb112f46825 __libc_start_main
# 0x260802e _start (edited)
There is a yugabyted.conf in yb-data/conf with the ip is written there
When we re-create container the container will get new ip but the ip in yugabyted.conf is old ip address of container
...
"advertise_address": "172.28.0.3",
...
When starting with yugabyted, the directory set by --base_dir holds the configuration in conf/yugabyted.conf, and the data directory in data which is set by --fs_data_dirs when starting yb-master and yb-tserver.
If you want the data directory in the volume but not the configuration, you can set it with:
--tserver_flags=fs_data_dirs=/ybdata --master_flags=fs_data_dirs=/ybdata
and leave --base_dir within the container
Another possibility if you want the configuration in the external volume is to use a configuration that is not dependent on container addresses, like with:
--advertise_address=0.0.0.0
which will listen on all interfaces

Broadcast an Intent from Historical Broadcast

The story behind it: I'm trying to command an Android box (with a proprietary launcher) that also manages TV channels. To enter the channel section it is not sufficient to type a number, but a specific key must be pressed. I want to find a way to replicate that key, and then use this command on Home Assistant. I could try with a bluetooth sniffer, but it will be after the failure of my actual attempt.
I ran this adb command after pressing the specific key for TV channels:
adb.exe shell dumpsys activity broadcasts history
And the last broadcast in history is this (timvision is the name of the box):
Historical Broadcast foreground #0:
BroadcastRecord{560a0f4 u0 android.intent.action.GLOBAL_BUTTON} to user 0
Intent { act=android.intent.action.GLOBAL_BUTTON flg=0x10000010 (has extras) }
targetComp: {timvision.launcher/timvision.launcher.TimVisionKeyReceiver}
extras: Bundle[{android.intent.extra.KEY_EVENT=KeyEvent { action=ACTION_UP, keyCode=KEYCODE_LAST_CHANNEL, scanCode=377, metaState=0, flags=0x8, repeatCount=0, eventTime=10092564, downTime=10092515, deviceId=27, source=0x301, displayId=-1 }}]
caller=android 3514:system/1000 pid=3514 uid=1000
enqueueClockTime=2022-04-16 14:43:54.577 dispatchClockTime=2022-04-16 14:43:54.578
dispatchTime=-3s691ms (+1ms since enq) finishTime=-3s502ms (+189ms since disp)
resultTo=null resultCode=0 resultData=null
nextReceiver=1 receiver=null
Deliver +189ms #0: (manifest)
priority=0 preferredOrder=0 match=0x0 specificIndex=-1 isDefault=false
ActivityInfo:
name=timvision.launcher.TimVisionKeyReceiver
packageName=timvision.launcher
enabled=true exported=true directBootAware=false
resizeMode=RESIZE_MODE_RESIZEABLE
Is possible to replicate this broadcast ? I tried this (with extra_key values too) but seems is not allowed:
adb.exe shell am broadcast -a android.intent.action.GLOBAL_BUTTON -n timvision.launcher/timvision.launcher.TimVisionKeyReceiver
Error:
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.GLOBAL_BUTTON from pid=32487, uid=2000
Alternatives or ideas are welcome.
Thanks
It is not the solution to the question but it is the solution to my problem. So I post it.
The key to enter in the TV channels section is listed on the official Android documentation and is KEYCODE_LAST_CHANNEL with code 229.
On Home Assistant the service to launch is this:
service: androidtv.adb_command
data:
command: input keyevent 229
target:
entity_id: media_player.your_android_tv_entity

The advanced page cannot be opened when we want to add Active Directory user

When we want to replace a local service account for a domain service account. Systematical we have this error (The advanced page cannot be opened) :
https://image.noelshack.com/fichiers/2019/18/5/1556879210-the-server-is-not-operational.png
This is what we try to do :
https://image.noelshack.com/fichiers/2019/18/5/1556879210-service-login.png
https://image.noelshack.com/fichiers/2019/18/5/1556879210-nologo.png
Note that we don't see the logo and all the CN ...
Thank you for your help :)
PS : The machines are in the same domain, they can be ping each other with the IP or DNS Name.
With the help of Gabriel I found the mistake ...
In the DNS Forward Lookup Zone, I have fill two host with the same IP Adress.
AD.domain.com | Host(A) | 10.10.10.10
domain.com | Host(A) | 10.10.10.10
Unfortunatly, only the AD.domain.com was responding and domain.com was not reachable.
I've removed the row for AD.domain.com and now everything works well !
Thank you for your help !

SMTPSenderRefused when sending mail from GAE dev_appserver on gmail

Here are my email related dev_appserver options:
--smtp_host=smtp.gmail.com --smtp_port=25 --smtp_user=me#mydomain.com --smtp_password="password"
Now, this still doesn't work and every time Google release a new dev_appserver I have to edit api/mail_stub.py to get things to work locally as per this S/O answer.
However, even this workaround has now stopped working. I get the following exception:
SMTPSenderRefused: (555, '5.5.2 Syntax error. mw9sm14633203wib.0 - gsmtp', <email.header.Header instance at 0x10c9c9248>)
Does anyone smarter than me know how to fix it?
UPDATE
I was able to get email to send on dev_appserver by using email addresses (eg. for sender and recipient) in their 'plain' format of a simple string (name#domain.com) rather than using the angle bracket style (Name <name#domain.com>). This is not a problem in production: recipients and sender email addresses can use angle brackets in the mail.send_mail call. I raised a ticket about this divergent behaviour between dev_appserver and production: https://code.google.com/p/googleappengine/issues/detail?id=10211&thanks=10211&ts=1383140754
Looks like it's because the 'sender' is now stored as a "email.header.Header" instance in the dev server instead of a string (since SDK 1.8.3 I think).
From my testing, when a 'From' string like "Name " is passed into smtplib.SMTP.sendmail, it parses the string to find the part within angle brackets, if any, to use as the SMTP sender, giving "". However, if this parameter is an "email.header.Header", then is just converts to string and uses it without further parsing, giving ">", thus causing the problem we're seeing.
Here's the patch I just posted on the issue tracker to google/appengine/api/mail_stub.py to convert this parameter back to a string (works for me):
--- google/appengine/api/mail_stub-orig.py 2014-12-12 20:04:53.612070031 +0000
+++ google/appengine/api/mail_stub.py 2014-12-12 20:05:07.532294605 +0000
## -215,7 +215,7 ##
tos = [mime_message[to] for to in ['To', 'Cc', 'Bcc'] if mime_message[to]]
- smtp.sendmail(mime_message['From'], tos, mime_message.as_string())
+ smtp.sendmail(str(mime_message['From']), tos, mime_message.as_string())
finally:
smtp.quit()
Another alternative is to patch the SMTP server that you use for testing the app engine mail functionality in your dev environment (instead of patching mail_stub.py).
For example, I'm using subethasmtp Wiser and was able to work around this issue by patching org.subethamail.smtp.util.EmailUtils.extractEmailAddress to accept nested angle brackets (details posted here).

How to understand log files downloaded from App Engine?

What is the format of Google App Engine log files, as downloaded by appcfg.sh request_logs?
As far as I've been able to determine, the format of the log file is as follows:
CLIENT_IP_ADDRESS - USERNAME [DATE:TIME TIMEZONE] "METHOD URL HTTP/VERSION" RESPONSE_CODE ??? URL USER_AGENT
LOG_LEVEL:TIMESTAMP MESSAGE
:
LOG_LEVEL:TIMESTAMP MESSAGE
:
LOG_LEVEL:TIMESTAMP MESSAGE
:
Each of the indented lines is associated with the non-indented line above it - that's how you determine which request each of them relates to, I think. The solitary colons are used to separate one log message from the next.
The non-indented lines are in reverse chronological order, but the groups of indented lines below them are in chronological order.
A strange client IP address like 0.1.0.2 indicates a within-App-Engine post from your app to your app's task queue. Actually, though, you can also see that it is within-App-Engine by looking at the user agent for that request.

Resources