<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extend local users expiration - local API bash scripts in Scripts</title>
    <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164208#M1012</link>
    <description>&lt;P&gt;Hi, sorry for later reply.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mgmt_cli -r true show users details-level full --format json | jq -r '.objects[] |select(.name | contains("vpn"))| [.name, .email] |@csv'&amp;nbsp;will do the job with data transformation..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;"user_vpn","user_vpn@test.com"&lt;BR /&gt;"user1_vpn","user1_vpn@test.com"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Dec 2022 16:01:21 GMT</pubDate>
    <dc:creator>Tomas_Vobruba</dc:creator>
    <dc:date>2022-12-05T16:01:21Z</dc:date>
    <item>
      <title>Extend local users expiration - local API bash scripts</title>
      <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/106575#M736</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was asked by customer to help him with writing script to change expiration of local users. Our API from version 1.6.1 can handle this task quite easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two scripts:&lt;/P&gt;
&lt;P&gt;Extend expiration of selected user:&amp;nbsp;&amp;nbsp;script_change_expiration_of_selected_user.sh&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/chkp-mkoldov/1f2ea190c6888be3f46091f815813d73" target="_blank" rel="noopener"&gt;https://gist.github.com/chkp-mkoldov/1f2ea190c6888be3f46091f815813d73&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extend expiration of all local users:&amp;nbsp;script_change_expiration_of_users.sh&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/chkp-mkoldov/b030dc7cf5feb5230d4bfd77c4c1377b" target="_blank" rel="noopener"&gt;https://gist.github.com/chkp-mkoldov/b030dc7cf5feb5230d4bfd77c4c1377b&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take this script as a skeleton. It might be changed in any kind of the manner.&lt;/P&gt;
&lt;P&gt;Cheers Tomas&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 08:16:48 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/106575#M736</guid>
      <dc:creator>Tomas_Vobruba</dc:creator>
      <dc:date>2022-12-08T08:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extend local users expiration - local API bash scripts</title>
      <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/162576#M1003</link>
      <description>&lt;P&gt;Hello Tomas,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there any template script to get an output like in the last screenshot above that checks the expiration time for all users (or specific users whose name includes&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/28757"&gt;@VPN&lt;/a&gt;@)? Can it also show users' e-mail address details?&amp;nbsp;And my last question is, can we print this output to a file with a command to be added to the script and copy it to a remote location such as ftp etc?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note: Version R80.40&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Volkan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 16:09:58 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/162576#M1003</guid>
      <dc:creator>vturan</dc:creator>
      <dc:date>2022-11-20T16:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extend local users expiration - local API bash scripts</title>
      <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/162582#M1004</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;script just reads on input user names, but mgmt_cli itself can&amp;nbsp; give you what are you looking for, but you have to change select from one user "command show user" to multi user select:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-users~v1.8.1%20" target="_blank" rel="noopener"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-users~v1.8.1%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;As you can see, management cli is returning name, so you can easy ask for that:&lt;/P&gt;
&lt;P&gt;[Expert@cp-mgmt:0]# mgmt_cli -r true show users --format json|jq '.objects[] |select((.name)|contains("vpn")).name'&lt;BR /&gt;user_vpn&lt;BR /&gt;user1_vpn&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reading this specified email for output name of user can be done for example by:&lt;/P&gt;
&lt;P&gt;mgmt_cli -r true show users details-level full --format json | jq -r '.objects[] | select(.name | contains ("vpn")) | .email'&lt;/P&gt;
&lt;P&gt;&lt;A href="mailto:user_vpn@checkpoint.com" target="_blank" rel="noopener"&gt;user_vpn@test.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="mailto:user1_vpn@test.com" target="_blank" rel="noopener"&gt;user1_vpn@test.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both together:&lt;/P&gt;
&lt;P&gt;mgmt_cli -r true show users details-level full --format json | jq -r '.objects[] | select(.name | contains ("vpn")) | [.email,.name]'&lt;/P&gt;
&lt;P&gt;[&lt;BR /&gt;"user_vpn@test.com",&lt;BR /&gt;"user_vpn"&lt;BR /&gt;]&lt;/P&gt;
&lt;P&gt;Hope this is what you are looking for.&lt;/P&gt;
&lt;P&gt;Tomas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 18:23:24 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/162582#M1004</guid>
      <dc:creator>Tomas_Vobruba</dc:creator>
      <dc:date>2022-11-20T18:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extend local users expiration - local API bash scripts</title>
      <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164114#M1010</link>
      <description>&lt;P&gt;Hello, is it possible to export this output to a .csv file and schedule a job to periodically update/create this file? Or do we have to do manually whole process?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 07:54:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164114#M1010</guid>
      <dc:creator>CihanB</dc:creator>
      <dc:date>2022-12-05T07:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extend local users expiration - local API bash scripts</title>
      <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164199#M1011</link>
      <description>&lt;P&gt;Yes, jq (used in the CLI commands above) can also output in CSV…with the correct format.&lt;BR /&gt;And, yes, once you have worked out the correct CLI command that gives you the data in the format you want, you can have it run by cron periodically.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 15:23:54 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164199#M1011</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2022-12-05T15:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extend local users expiration - local API bash scripts</title>
      <link>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164208#M1012</link>
      <description>&lt;P&gt;Hi, sorry for later reply.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mgmt_cli -r true show users details-level full --format json | jq -r '.objects[] |select(.name | contains("vpn"))| [.name, .email] |@csv'&amp;nbsp;will do the job with data transformation..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;"user_vpn","user_vpn@test.com"&lt;BR /&gt;"user1_vpn","user1_vpn@test.com"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 16:01:21 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/164208#M1012</guid>
      <dc:creator>Tomas_Vobruba</dc:creator>
      <dc:date>2022-12-05T16:01:21Z</dc:date>
    </item>
  </channel>
</rss>

