Security

Password field for Modular Input using Python SDK

stephenho
Path Finder

Hi All,

I'm trying to write a python app that requires a username and a password. I've written most of it up using the Python SDK and now that I'm getting into the nitty gritty, I want to encrypt and hide the password value for security purposes.

http://dev.splunk.com/view/SP-CAAAER3

I've used the above URL as a guide, but when I did a search on password fields, I found this article instead.

http://docs.splunk.com/Documentation/Splunk/6.0/AdvancedDev/ModInputsExample

In the second link, it creates a password field using the XML scheme, but I can't find an equivalent for the python code.

I took a look in the (I'm not at my devel pc at the moment) splunklib/modularinput folder and I believe in the arguments module, there is only templates for string, number and float, eg data_type_number, data_type_string, etc.

Is there a way I can code this in Python in a way Splunk will understand or will I need to change my scheme to incorporate the xml?

Thanks in advance.

shaskell_splunk
Splunk Employee
Splunk Employee

You need to create a custom Splunk manager page for your modular input to hide the password and add a password confirmation field.

http://docs.splunk.com/Documentation/Splunk/6.2.1/AdvancedDev/ModInputsCustomizeUI

When you create an element for your password field, use type="password". Make sure that you only set this for 'edit' and 'create' views, not 'list', so the password isn't displayed when the modular input is listed.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...