List of Mobile Devices from Apple Profile Manager - mdm

I have an Apple Profile Manager server with several devices enrolled (iPads, iPhones). The server can be accessed via web interface (e.g.: https://macserver.local/profilemanager).
How can I get the enrolled mobile devices without web crawling?
Is there any web-service/ api that could be used? (couldn't find any)
Thanks in advance and have a great week forwards!

Just to add to this, found this as well. Use this to access the database tested on server 5.6.1 and macOS 10.13
sudo -u _devicemgr psql -h /Library/Server/ProfileManager/Config/var/PostgreSQL devicemgr_v2m0
Source : Access Profile Manager Database

Thanks Victor. Your given path lead me to the database (PostgreSQL)
To access the ProfileManager database:
sudo -u _devicemgr psql -h /Library/Server/ProfileManager/Config/var/PostgreSQL -d devicemgr_v2m0

Apple Profile Manager is a Ruby on Rails app. You can find it here:
/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/
I believe, it is configured to store all info in a sqlite database.
And there are multiple ways how you can get data out of sqlite DB.

Related

How to see what is in your Heroku-Postgress DB

I recently uploaded a WebApplication to Heroku. I developed it using sqlite; however, I then changed it to Heroku-Postgres.
Nonetheless, I am not able to view in any way the data that is in my database.
There are no problems with the code and the WebApplication works perfectly however it would be very useful to be able to tap into the data.
Download the Heroku CLI and get access to the postgres admin console.
heroku pg:psql -a appName
Use this command in terminal, This will connect you to pgadmin console.
You can use dbeaver database client, but it is very slow because it is free db from heroku.
https://dbeaver.io/download/
Or you can use heroku CLI, psql

Access local postgres with SequelPro

I am using Sequel Pro and want to access my local Postgres DB.
When I get prompted in sequel pro to add connection details for my db I oblige:
And then when I click connect I get:
I am on a mac running Catalina 10.15.3.
The database I am running is a postgres installed with brew. When I run brew services list I get:
My application (a laravel application using laravel valet) can access the database.
What can be wrong? I have some thoughts...
If I enter my db and type: select inet_server_addr( ), inet_server_port( );
I get this output:
inet_server_addr | inet_server_port
------------------+------------------
|
(1 row)
And I think that I should get 127.0.0.1 at least in the inet_server_addr column....
I don't know if this is a hint of where the error might be or not.
So, to summarize. My thoughts go in the direction that I am not running the postgres server 100% correctly... BUT i still think it is strange that my app can access the db but not Sequel Pro...
If I typ 127.0.0.1 in my browser I get a 404 - Not Found
How do I do to be able to access my local postgres with Sequel Pro?
As a_horse_with_no_name pointed out in the comments, the website states that Sequel Pro is for MySQL databases, not Postgres:
"Sequel Pro is a fast, easy-to-use Mac database management application for working with MySQL databases."

I dont know how Postgresql created user on my mac

Two days ago, i started learning postgresql. Most tutorials I followed online were either old or the codes wont just work on my mac. I followed a lot of tutorials that did a lot of totally different things.
When i switched on my system today. I noticed Postgresql created a user on my mac. I don't know what this is or maybe i used the wrong CLI code.
When I tried viewing the user, I saw this
should I delete this user or it has a function?
postgres user account
Creating a user account specifically for Postgres, commonly named postgres, is a normal part of a Postgres installation. Your installer app likely prompted you for a password to assign to this new user account.
One reason for this is security: The database’s data files and security configuration files are stored in folders owned by the postgres user. So if your main user account is hijacked, the intruder does not yet have access to the database (often the most valuable thing in storage). The intruder must jump through more hoops to compromise Postgres. Also, the separate ownership prevents other apps from inadvertently stomping on the Postgres files.
You will find Postgres is much more enterprise-oriented than other products such as MySQL. This means locking-down for security. Another example: Postgres by default is configured to not accept connections over the network. To enable connections from other computers, you must change the configuration. Inconvenient for the beginner, but more secure. Like a bar on your car steering wheel and deadbolts on your doors, more security always means more steps to take and more annoyance.
Use a virtual machine
Installing the postgres user account is one of the things that makes Postgres a rather heavyweight installation. I suggest to those learning Postgres to use a virtual machine for Postgres. Something like:
Parallels or Fusion or VirtualBox on your own computer
Cloud server such as FreeBSD on DigitalOcean.com.
To remove Postgres, simply discard the vm.
Postgres.app for macOS
Another option for a Mac user is Postgres.app, created by the person who built one of the first Postgres-as-a-Service implementations (on Heroku). I have not used Postgres.app, but I understand it wraps Postgres, so it does not install the postgres user account. Also, Postgres starts and stops when launch and quit the app, rather than running in the background all the time.
Be aware: you may have conflicts with Postgres.app on a Mac where you already have a conventional installation. I suggest you first carefully remove the conventional Postgres from your Mac before installing Postgres.app. Uninstalling involves finding and deleting various files and folders in various places.
Database-as-a-Service (DBaaS)
Another option to avoid local installation is the increasing choices for running Postgres as a service. This is sometimes referred to as “managed Postgres” because the vendor maintains the installation of Postgres on your behalf. You simply use Postgres to create your database, but you do not fully control Postgres in such a service.
Some examples:
Heroku
Digital Ocean
Azure
Amazon Web Services (AWS)
ElephantSQL
My experience
Personally, I often install Postgres on a Mac using the installer by EnterpriseDB.com. That company sells added-value versions of Postgres, but kindly provides an installer for plain-vanilla Postgres, as a service to the community.
I have also used that same installer from EnterpriseDB.com to install onto a Parallels VM running macOS as the guest OS within the VM on a MacBook Pro running macOS as the host OS. You can easily configure the VM to share the host Mac’s IP address on the network, or you can give the VM its own network address which might be handy for demo/dev/test work.
Thirdly, I have installed Postgres on FreeBSD on DigitalOcean.com.
All three of these options have worked quite well for me. Which is preferable depends on the scenario. For example, the DigitalOcean.com approach is good if I want colleagues to be able to reach the database 24x7 without my own MacBook being available.
This discussion is for development work. For mission-critical deployment, I strongly recommend using heavy-duty server equipment with error-correcting memory and redundant storage such as RAID or ZFS pool. Postgres is extremely reliable but depends, of course, on reliable hardware.
Your tag says Postgres 9.1. That version is quite old now. I suggest using the latest version. By the way, the version numbering system has changed for postgres. The first number is now the roughly-annual release number likely requiring you to dump and reload data to upgrade, and the second number is compatible updates.
As pointed out by #basil-bourque, the account is required for several reasons.
That said, if it annoys you to have the PostgreSQL showing up in the login screen -as it did me-, you can remove it as long as you have admin user rights in MacOS.
Apple Support gives the following command to hide a user from the login screen:
$ sudo dscl . create /Users/hiddenuser IsHidden 1
However, since the PostgreSQL user was not included listed in the login window at installation, that command will yield no result -at least in Catalina, which is my OS.
You should use the following two commands instead, as suggested by josemarluedke:
## add postgres to the list of hidden users on login screen
$ sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add 'postgres'
## instruct not to show any hidden accounts at login
$ sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
Worked for me!

How do I view a PostgreSQL database on heroku with a GUI?

I have a rails app on heroku that is using a Postgre database. My database has > 40 tables and > 10,000 rows. I would like to delete a lot of data, but it would be much easier if I was able to view and interact with it in a GUI table. I can access my data in rails console, but it's taking too long.
pgweb is a great cross-platform GUI, and it's easy to connect to your Heroku Postgres when launching from the command line.
I installed via Homebrew on a Mac (brew install pgweb), but instructions for other platforms are listed on the site. Here's how I launch pgweb connected to a Heroku Postgres DB:
heroku config:get DATABASE_URL | xargs pgweb --url
And if you want to connect to your localhost:
pgweb --host localhost
I'm a little late here, but this may help someone else who stumbles across this thread...
If you go to your Heroku app's dashboard (through the website) > settings > "Reveal Config Vars" > DATABASE_URL, and paste that URL into the browser.
I use TablePlus for database management, when I paste the link into the browser it asks if it can open TablePlus and then I can edit my production database in real time just like I would in development.
I'm not sure what pasting the URL into the browser will do if you don't have TablePlus. I assume it will request to open any other SQL management app you might have.
As slumdog wrote in the comment to your question, you can use pgAdmin, which comes with your local Postgres installation.
This article explains how to connect your remote heroku db with pgAdmin, using heroku credentials: https://medium.com/#vapurrmaid/getting-started-with-heroku-postgres-and-pgadmin-run-on-part-2-90d9499ed8fb
From the article:
"pgAdmin is a GUI for postgresql databases that can be used to access and modify databases that not only exist locally, but also remotely. For a fresh install of pgAdmin, the dashboard likely contains only one server. This is your local server...
We have to configure a new remote server with its credentials.
right click server(s) > create > server …
Fill out the following:
Name: This is solely for you. Name it whatever you want, I chose ‘Heroku-Run — On’
Under the connection tab: hostname/address. If you go back to your datastores ‘reveal credentials’, this is the host credential. It should look like --**...amazonaws.com
Keep the port at 5432, unless your credentials list otherwise
Maintenance database — this is the database field in the credentials
Username — this is the user field in the credentials
Password — the password field in the credentials. I highly advise checking save password so that you don’t have to copypasta this every time you want to connect.
In the SSL tab, mark SSL mode as require
At this point, if we were to hit ‘save’ (please don’t), something very strange would happen. You’d see hundreds if not thousands of databases appear in pgAdmin. This has to do with how Heroku configures their servers. You’ll still only have access to your specific database, not those of others. In order to avoid parsing so many databases, we have to white list only those databases we care about.
go to the Advanced tab and under db restriction copy the database name (it’s the same value as the Maintenance database field filled earlier)."
Article contains other usefull guidelines and screenshots.
Try GUI of DBWeaver.
https://dbeaver.io/
Download it, after that you can connect your heroku postgres using Database Credentials data.
You can use Heroku's hosted DB viewer on the Overview pane of your dashboard:
Create and click the Dataclip:
Dataclip GUI is fairly easy to use, we can type and customize SQL queries at the top etc.

Cant initialize database on google cloud platform

Here is the database I am trying to install (comes with 4 short instructions very easy to follow): https://github.com/toddwschneider/nyc-taxi-data
I used git clone to bring the repository down to my vm. And next I cd into it and run initialize_database.sh. Here is what happens:
pic of terminal
the password I am trying to use is the one provided by my Bitnami Launchpad, which says the admin user is postgres, but when I work on it it says kzherbert, my google account. I have tried su postgres but its not a user on the server so it doesnt work like that. I can use postgres password for psql -U postgres, which will take me to the psql terminal. Also, I have tried using my google account password as well and it does not work. What really interests me about the picture is where the shapefile is relevant and why it repeats and doesnt allow me to exit
Any and all help is greatly appreciated.
The problem is that the database you are trying to install (Unified New York City Taxi and Uber data) assumes you're installing PostreSQl from scratch instead of using the one included in the Bitnami Image.
The script you're using assumes that the user to connect the database is the same that the System User you're using to connect to your server via SSH (kzherbert in your case). However, the password you're trying to use is the one for the user postgres.
You need to connect to PG using the password Google provided you and the user postgres and the create an user kzherbert with the password you desire.